af_comics: support buni webtoon episodes
This commit is contained in:
parent
8c3efd51ec
commit
ffa3f9309f
|
@ -18,9 +18,8 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
|
|||
// lol at people who block clients by user agent
|
||||
// oh noes my ad revenue Q_Q
|
||||
|
||||
$res = fetch_file_contents($article["link"], false, false, false,
|
||||
false, false, 0,
|
||||
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
|
||||
$res = fetch_file_contents(["url" => $article["link"],
|
||||
"useragent" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"]);
|
||||
|
||||
$doc = new DOMDocument();
|
||||
|
||||
|
@ -30,10 +29,34 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
|
|||
|
||||
if ($basenode) {
|
||||
$article["content"] = $doc->saveHTML($basenode);
|
||||
return true;
|
||||
}
|
||||
|
||||
// buni-specific
|
||||
$webtoon_link = $xpath->query("//a[contains(@href,'www.webtoons.com')]")->item(0);
|
||||
|
||||
if ($webtoon_link) {
|
||||
|
||||
$res = fetch_file_contents(["url" => $webtoon_link->getAttribute("href"),
|
||||
"useragent" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"]);
|
||||
|
||||
if (@$doc->loadHTML($res)) {
|
||||
$xpath = new DOMXPath($doc);
|
||||
$basenode = $xpath->query('//div[@id="_viewerBox"]')->item(0);
|
||||
|
||||
if ($basenode) {
|
||||
$imgs = $xpath->query("//img[@data-url]", $basenode);
|
||||
|
||||
foreach ($imgs as $img) {
|
||||
$img->setAttribute("src", $img->getAttribute("data-url"));
|
||||
}
|
||||
|
||||
$article["content"] = $doc->saveHTML($basenode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue