From 2aba815b5597f73a2d3edfbfcb22101d096d256e Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 10 Jan 2016 00:00:16 +0100 Subject: [PATCH 01/12] Implement new Bridge to mangareader.net This Bridge returns information about the last updates on mangareader.net --- bridges/MangareaderBridge.php | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 bridges/MangareaderBridge.php diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php new file mode 100644 index 0000000..8e61056 --- /dev/null +++ b/bridges/MangareaderBridge.php @@ -0,0 +1,77 @@ +maintainer = "logmanoriginal"; + $this->name = "Mangareader Bridge"; + $this->uri = "http://www.mangareader.net"; + $this->description = "Returns the latest Manga updates"; + $this->update = "2016-01-09"; + + $this->parameters["Get latest updates"] = '[]'; + + } + + public function collectData(array $param){ + + /* We'll use the DOM parser for this as it makes navigation easier */ + $html = file_get_contents("http://www.mangareader.net"); + $doc = new DomDocument; + @$doc->loadHTML($html); + + /* The latest updates are on the frontpage, navigate via XPath */ + $xpath = new DomXPath($doc); + + /* Query each item (consists of Manga + chapters) */ + $nodes = $xpath->query("//*[@id='latestchapters']/table//td"); + + foreach ($nodes as $node){ + /* Query the manga */ + $manga = $xpath->query("a[@class='chapter']", $node)->item(0); + + /* Collect the chapters for each Manga */ + $chapters = $xpath->query("a[@class='chaptersrec']", $node); + + if (isset($manga) && $chapters->length >= 1){ + $item = new \Item(); + $item->uri = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); + $item->title = htmlspecialchars($manga->nodeValue); + + /* Add each chapter to the feed */ + $item->content = ""; + + foreach ($chapters as $chapter){ + if($item->content <> ""){ + $item->content .= "
"; + } + $item->content .= "" . htmlspecialchars($chapter->nodeValue) . ""; + } + + $this->items[] = $item; + } + } + + /* Return some dummy-data if no content available */ + if(count($this->items) == 0){ + $item = new \Item(); + $item->content = "

No updates available

"; + + $this->items[] = $item; + } + } + + public function getName(){ + return 'Mangareader Bridge'; + } + + public function getURI(){ + return 'http://www.mangareader.net'; + } + + public function getCacheDuration(){ + return 10800; // 3 hours + } +} +?> From ff9c60f53cd06a88e23af45a7379d5d2b1ab057b Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 10 Jan 2016 09:45:56 +0100 Subject: [PATCH 02/12] Use '/latest' instead of the main page to reduce loading time --- bridges/MangareaderBridge.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 8e61056..55ba59c 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -8,7 +8,7 @@ class MangareaderBridge extends BridgeAbstract{ $this->name = "Mangareader Bridge"; $this->uri = "http://www.mangareader.net"; $this->description = "Returns the latest Manga updates"; - $this->update = "2016-01-09"; + $this->update = "2016-01-10"; $this->parameters["Get latest updates"] = '[]'; @@ -17,7 +17,7 @@ class MangareaderBridge extends BridgeAbstract{ public function collectData(array $param){ /* We'll use the DOM parser for this as it makes navigation easier */ - $html = file_get_contents("http://www.mangareader.net"); + $html = file_get_contents("http://www.mangareader.net/latest"); $doc = new DomDocument; @$doc->loadHTML($html); From e6f388d6e44a96739c8a47ef30d410210e52e7e3 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sat, 16 Jan 2016 16:30:29 +0100 Subject: [PATCH 03/12] Add new option to receive chapter updates for one specific manga --- bridges/MangareaderBridge.php | 137 ++++++++++++++++++++++++---------- 1 file changed, 98 insertions(+), 39 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 55ba59c..551649e 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -1,5 +1,5 @@ maintainer = "logmanoriginal"; $this->name = "Mangareader Bridge"; $this->uri = "http://www.mangareader.net"; - $this->description = "Returns the latest Manga updates"; - $this->update = "2016-01-10"; - - $this->parameters["Get latest updates"] = '[]'; + $this->description = "Returns the latest updates. Set limits to -1 to disable the limit."; + $this->update = "2016-01-16"; + $this->parameters["Get site updates"] = '[]'; + $this->parameters["Get manga updates"] = ' + [ + { + "name" : "Manga path", + "identifier" : "path", + "type" : "text", + "required" : "true", + "pattern" : "[a-zA-Z0-9-_]*", + "exampleValue" : "bleach, umi-no-kishidan" + }, + { + "name" : "Limit", + "identifier" : "limit", + "type" : "number", + "exampleValue" : "10" + } + ]'; } public function collectData(array $param){ - /* We'll use the DOM parser for this as it makes navigation easier */ - $html = file_get_contents("http://www.mangareader.net/latest"); - $doc = new DomDocument; + $this->request = ''; + + $path = "latest"; + $limit = MANGAREADER_LIMIT; + + if(isset($param['path'])){ + $path = $param['path']; + } + + if(isset($param['limit']) && $param['limit'] !== ""){ + $limit = $param['limit']; + } + + // We'll use the DOM parser for this as it makes navigation easier + $html = file_get_contents("http://www.mangareader.net/" . $path); + if(!$html){ + $this->returnError('Could not receive data for ' . $path . '!', 400); + } + $doc = new DomDocument; @$doc->loadHTML($html); - /* The latest updates are on the frontpage, navigate via XPath */ + // Navigate via XPath $xpath = new DomXPath($doc); - /* Query each item (consists of Manga + chapters) */ - $nodes = $xpath->query("//*[@id='latestchapters']/table//td"); + // Build feed based on the context (site updates or manga updates) + if($path === "latest"){ + + $this->request = 'Latest'; + + // Query each item (consists of Manga + chapters) + $nodes = $xpath->query("//*[@id='latestchapters']/table//td"); - foreach ($nodes as $node){ - /* Query the manga */ - $manga = $xpath->query("a[@class='chapter']", $node)->item(0); - - /* Collect the chapters for each Manga */ - $chapters = $xpath->query("a[@class='chaptersrec']", $node); + foreach ($nodes as $node){ + // Query the manga + $manga = $xpath->query("a[@class='chapter']", $node)->item(0); + + // Collect the chapters for each Manga + $chapters = $xpath->query("a[@class='chaptersrec']", $node); - if (isset($manga) && $chapters->length >= 1){ - $item = new \Item(); - $item->uri = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); - $item->title = htmlspecialchars($manga->nodeValue); - - /* Add each chapter to the feed */ - $item->content = ""; - - foreach ($chapters as $chapter){ - if($item->content <> ""){ - $item->content .= "
"; - } - $item->content .= "" . htmlspecialchars($chapter->nodeValue) . ""; - } - - $this->items[] = $item; - } - } - - /* Return some dummy-data if no content available */ + if (isset($manga) && $chapters->length >= 1){ + $item = new \Item(); + $item->uri = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); + $item->title = htmlspecialchars($manga->nodeValue); + + // Add each chapter to the feed + $item->content = ""; + + foreach ($chapters as $chapter){ + if($item->content <> ""){ + $item->content .= "
"; + } + $item->content .= "" . htmlspecialchars($chapter->nodeValue) . ""; + } + + $this->items[] = $item; + } + } + } else { + + $this->request = $xpath->query(".//*[@id='mangaproperties']//*[@class='aname']")->item(0)->nodeValue; + + $query = "(.//*[@id='listing']//tr)[position() > 1]"; + + if($limit !== -1){ + $query = "(.//*[@id='listing']//tr)[position() > 1][position() <= " . $limit . "]"; + } + + $chapters = $xpath->query($query); + + foreach ($chapters as $chapter){ + $item = new \Item(); + $item->title = $xpath->query("td[1]/a", $chapter)->item(0)->nodeValue; // first column contains anchor with the name + $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); // anchor includes path (with leading '/') + $item->description = substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strlen($item->title) + 4); // first column provides " : ", we only want the description + $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; // second column provides the release date + $item->content = $item->description . "
" . $item->date; + $this->items[] = $item; + } + } + + // Return some dummy-data if no content available if(count($this->items) == 0){ $item = new \Item(); $item->content = "

No updates available

"; @@ -63,7 +122,7 @@ class MangareaderBridge extends BridgeAbstract{ } public function getName(){ - return 'Mangareader Bridge'; + return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge'; } public function getURI(){ @@ -74,4 +133,4 @@ class MangareaderBridge extends BridgeAbstract{ return 10800; // 3 hours } } -?> +?> \ No newline at end of file From 2e4e0077a8aa5069c246d202ed5622569153b2f3 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 19 Jan 2016 21:36:41 +0100 Subject: [PATCH 04/12] Move date information into a time tag --- bridges/MangareaderBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 551649e..17523d8 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -107,7 +107,7 @@ class MangareaderBridge extends BridgeAbstract{ $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); // anchor includes path (with leading '/') $item->description = substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strlen($item->title) + 4); // first column provides " : ", we only want the description $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; // second column provides the release date - $item->content = $item->description . "
" . $item->date; + $item->content = $item->description . "
"; $this->items[] = $item; } } From 0e1b84263e87f4304cc9216340e67e596dbfbe16 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 19 Jan 2016 21:41:14 +0100 Subject: [PATCH 05/12] Return items starting at the end, not the beginning when working with limits --- bridges/MangareaderBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 17523d8..60fa885 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -96,7 +96,7 @@ class MangareaderBridge extends BridgeAbstract{ $query = "(.//*[@id='listing']//tr)[position() > 1]"; if($limit !== -1){ - $query = "(.//*[@id='listing']//tr)[position() > 1][position() <= " . $limit . "]"; + $query = "(.//*[@id='listing']//tr)[position() > 1][position() > last() - " . $limit . "]"; } $chapters = $xpath->query($query); From 170818a6253f118204bd38e892d13de01abcc351 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Wed, 20 Jan 2016 20:52:57 +0100 Subject: [PATCH 06/12] Return entire chapter name as item title --- bridges/MangareaderBridge.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 60fa885..ec3bc8b 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -8,7 +8,7 @@ class MangareaderBridge extends BridgeAbstract{ $this->name = "Mangareader Bridge"; $this->uri = "http://www.mangareader.net"; $this->description = "Returns the latest updates. Set limits to -1 to disable the limit."; - $this->update = "2016-01-16"; + $this->update = "2016-01-20"; $this->parameters["Get site updates"] = '[]'; $this->parameters["Get manga updates"] = ' @@ -103,10 +103,10 @@ class MangareaderBridge extends BridgeAbstract{ foreach ($chapters as $chapter){ $item = new \Item(); - $item->title = $xpath->query("td[1]/a", $chapter)->item(0)->nodeValue; // first column contains anchor with the name - $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); // anchor includes path (with leading '/') - $item->description = substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strlen($item->title) + 4); // first column provides " : ", we only want the description - $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; // second column provides the release date + $item->title = $xpath->query("td[1]", $chapter)->item(0)->nodeValue; + $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); + $item->description = substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strrpos($item->title, ": ") + 2); + $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; $item->content = $item->description . "
"; $this->items[] = $item; } From a73807130ac0ce745f7fb58506c482ac4359555e Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Wed, 20 Jan 2016 20:56:09 +0100 Subject: [PATCH 07/12] Reduce parameter name to bare minimum --- bridges/MangareaderBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index ec3bc8b..a77f2a0 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -14,7 +14,7 @@ class MangareaderBridge extends BridgeAbstract{ $this->parameters["Get manga updates"] = ' [ { - "name" : "Manga path", + "name" : "Path", "identifier" : "path", "type" : "text", "required" : "true", From 4422024cfd952179ce49f0116b57072c754cfb37 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Wed, 20 Jan 2016 21:58:50 +0100 Subject: [PATCH 08/12] Add new option to get popular updates --- bridges/MangareaderBridge.php | 216 ++++++++++++++++++++++++++++++++-- 1 file changed, 209 insertions(+), 7 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index a77f2a0..f737325 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -11,8 +11,172 @@ class MangareaderBridge extends BridgeAbstract{ $this->update = "2016-01-20"; $this->parameters["Get site updates"] = '[]'; - $this->parameters["Get manga updates"] = ' - [ + $this->parameters["Get popular updates"] = + '[ + { + "name" : "Category", + "identifier" : "category", + "type" : "list", + "required" : "true", + "values" : [ + { + "name" : "All", + "value" : "all" + }, + { + "name" : "Action", + "value" : "action" + }, + { + "name" : "Adventure", + "value" : "adventure" + }, + { + "name" : "Comedy", + "value" : "comedy" + }, + { + "name" : "Demons", + "value" : "demons" + }, + { + "name" : "Drama", + "value" : "drama" + }, + { + "name" : "Ecchi", + "value" : "ecchi" + }, + { + "name" : "Fantasy", + "value" : "fantasy" + }, + { + "name" : "Gender Bender", + "value" : "gender-bender" + }, + { + "name" : "Harem", + "value" : "harem" + }, + { + "name" : "Historical", + "value" : "historical" + }, + { + "name" : "Horror", + "value" : "horror" + }, + { + "name" : "Josei", + "value" : "josei" + }, + { + "name" : "Magic", + "value" : "magic" + }, + { + "name" : "Martial Arts", + "value" : "martial-arts" + }, + { + "name" : "Mature", + "value" : "mature" + }, + { + "name" : "Mecha", + "value" : "mecha" + }, + { + "name" : "Military", + "value" : "military" + }, + { + "name" : "Mystery", + "value" : "mystery" + }, + { + "name" : "One Shot", + "value" : "one-shot" + }, + { + "name" : "Psychological", + "value" : "psychological" + }, + { + "name" : "Romance", + "value" : "romance" + }, + { + "name" : "School Life", + "value" : "school-life" + }, + { + "name" : "Sci-Fi", + "value" : "sci-fi" + }, + { + "name" : "Seinen", + "value" : "seinen" + }, + { + "name" : "Shoujo", + "value" : "shoujo" + }, + { + "name" : "Shoujoai", + "value" : "shoujoai" + }, + { + "name" : "Shounen", + "value" : "shounen" + }, + { + "name" : "Shounenai", + "value" : "shounenai" + }, + { + "name" : "Slice of Life", + "value" : "slice-of-life" + }, + { + "name" : "Smut", + "value" : "smut" + }, + { + "name" : "Sports", + "value" : "sports" + }, + { + "name" : "Super Power", + "value" : "super-power" + }, + { + "name" : "Supernatural", + "value" : "supernatural" + }, + { + "name" : "Tragedy", + "value" : "tragedy" + }, + { + "name" : "Vampire", + "value" : "vampire" + }, + { + "name" : "Yaoi", + "value" : "yaoi" + }, + { + "name" : "Yuri", + "value" : "yuri" + } + ], + "exampleValue" : "All" + } + ]'; + $this->parameters["Get manga updates"] = + '[ { "name" : "Path", "identifier" : "path", @@ -34,14 +198,24 @@ class MangareaderBridge extends BridgeAbstract{ $this->request = ''; + $type = "latest"; // can be "latest", "popular" or "path". Default is "latest"! $path = "latest"; $limit = MANGAREADER_LIMIT; - if(isset($param['path'])){ - $path = $param['path']; + if(isset($param['category'])){ // Get popular updates + $type = "popular"; + $path = "popular"; + if($param['category'] !== "all"){ + $path .= "/" . $param['category']; + } } - if(isset($param['limit']) && $param['limit'] !== ""){ + if(isset($param['path'])){ // Get manga updates + $type = "path"; + $path = $param['path']; + } + + if(isset($param['limit']) && $param['limit'] !== ""){ // Get manga updates (optional parameter) $limit = $param['limit']; } @@ -57,7 +231,7 @@ class MangareaderBridge extends BridgeAbstract{ $xpath = new DomXPath($doc); // Build feed based on the context (site updates or manga updates) - if($path === "latest"){ + if($type === "latest"){ $this->request = 'Latest'; @@ -89,7 +263,35 @@ class MangareaderBridge extends BridgeAbstract{ $this->items[] = $item; } } - } else { + } + + if($type === "popular"){ + + $pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue; + $this->request = substr($pagetitle, 0, strrpos($pagetitle, " -")); // "Popular mangas for ..." + + // Query all mangas + $mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']"); + + foreach ($mangas as $manga){ + + // The thumbnail is encrypted in a css-style... + // format: "background-image:url('')" + $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); + + $item = new \Item(); + $item->title = $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue; + $item->uri = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); + $item->author = $xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue; + $item->chaptercount = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; + $item->genre = $xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue; + $item->thumbnailUri = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24); + $item->content = '' . $item->title . '

' . $item->genre . '

' . $item->chaptercount . '

'; + $this->items[] = $item; + } + } + + if($type === "path") { $this->request = $xpath->query(".//*[@id='mangaproperties']//*[@class='aname']")->item(0)->nodeValue; From 621c7af6b7d024e345accb00a3d208d221e33ecc Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Thu, 21 Jan 2016 21:49:23 +0100 Subject: [PATCH 09/12] Add title to inputs and improve descriptions --- bridges/MangareaderBridge.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index f737325..0aa5fb8 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -7,11 +7,11 @@ class MangareaderBridge extends BridgeAbstract{ $this->maintainer = "logmanoriginal"; $this->name = "Mangareader Bridge"; $this->uri = "http://www.mangareader.net"; - $this->description = "Returns the latest updates. Set limits to -1 to disable the limit."; - $this->update = "2016-01-20"; + $this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; + $this->update = "2016-01-21"; - $this->parameters["Get site updates"] = '[]'; - $this->parameters["Get popular updates"] = + $this->parameters["Get latest updates"] = '[]'; + $this->parameters["Get popular mangas"] = '[ { "name" : "Category", @@ -172,7 +172,8 @@ class MangareaderBridge extends BridgeAbstract{ "value" : "yuri" } ], - "exampleValue" : "All" + "exampleValue" : "All", + "title" : "Select your category" } ]'; $this->parameters["Get manga updates"] = @@ -183,13 +184,15 @@ class MangareaderBridge extends BridgeAbstract{ "type" : "text", "required" : "true", "pattern" : "[a-zA-Z0-9-_]*", - "exampleValue" : "bleach, umi-no-kishidan" + "exampleValue" : "bleach, umi-no-kishidan", + "title" : "URL part of desired manga" }, { "name" : "Limit", "identifier" : "limit", "type" : "number", - "exampleValue" : "10" + "exampleValue" : "10", + "title" : "Number of items to return.\n-1 returns all" } ]'; } @@ -233,7 +236,7 @@ class MangareaderBridge extends BridgeAbstract{ // Build feed based on the context (site updates or manga updates) if($type === "latest"){ - $this->request = 'Latest'; + $this->request = 'Latest updates'; // Query each item (consists of Manga + chapters) $nodes = $xpath->query("//*[@id='latestchapters']/table//td"); From 182dcbec60a42cb8179c885a3670685b2bf777e1 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Fri, 22 Jan 2016 19:30:45 +0100 Subject: [PATCH 10/12] Encode special chars for feeds to work properly --- bridges/MangareaderBridge.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 0aa5fb8..5ad9498 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -283,11 +283,11 @@ class MangareaderBridge extends BridgeAbstract{ $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); $item = new \Item(); - $item->title = $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue; + $item->title = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue); $item->uri = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); - $item->author = $xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue; + $item->author = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue); $item->chaptercount = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; - $item->genre = $xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue; + $item->genre = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue); $item->thumbnailUri = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24); $item->content = '' . $item->title . '

' . $item->genre . '

' . $item->chaptercount . '

'; $this->items[] = $item; @@ -308,9 +308,9 @@ class MangareaderBridge extends BridgeAbstract{ foreach ($chapters as $chapter){ $item = new \Item(); - $item->title = $xpath->query("td[1]", $chapter)->item(0)->nodeValue; + $item->title = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); - $item->description = substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strrpos($item->title, ": ") + 2); + $item->description = htmlspecialchars(substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strrpos($item->title, ": ") + 2)); $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; $item->content = $item->description . "
"; $this->items[] = $item; From d1fe87651dddc4e162f7a87105419722086e867e Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Fri, 22 Jan 2016 19:34:19 +0100 Subject: [PATCH 11/12] Add items in reverse order (add to front) for correct ordering --- bridges/MangareaderBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 5ad9498..daa640b 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -313,7 +313,7 @@ class MangareaderBridge extends BridgeAbstract{ $item->description = htmlspecialchars(substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strrpos($item->title, ": ") + 2)); $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; $item->content = $item->description . "
"; - $this->items[] = $item; + array_unshift($this->items, $item); } } From e2043574f2b6edda13824e5d868f9d88967fbd04 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Fri, 22 Jan 2016 19:56:07 +0100 Subject: [PATCH 12/12] Remove content duplication --- bridges/MangareaderBridge.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index daa640b..3d92682 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -8,7 +8,7 @@ class MangareaderBridge extends BridgeAbstract{ $this->name = "Mangareader Bridge"; $this->uri = "http://www.mangareader.net"; $this->description = "Returns the latest updates, popular mangas or manga updates (new chapters)"; - $this->update = "2016-01-21"; + $this->update = "2016-01-22"; $this->parameters["Get latest updates"] = '[]'; $this->parameters["Get popular mangas"] = @@ -310,9 +310,7 @@ class MangareaderBridge extends BridgeAbstract{ $item = new \Item(); $item->title = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); - $item->description = htmlspecialchars(substr($xpath->query("td[1]", $chapter)->item(0)->nodeValue, strrpos($item->title, ": ") + 2)); - $item->date = $xpath->query("td[2]", $chapter)->item(0)->nodeValue; - $item->content = $item->description . "
"; + $item->timestamp = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue); array_unshift($this->items, $item); } }