mirror of https://tt-rss.org/git/tt-rss.git
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
|
// lol at people who block clients by user agent
|
||||||
// oh noes my ad revenue Q_Q
|
// oh noes my ad revenue Q_Q
|
||||||
|
|
||||||
$res = fetch_file_contents($article["link"], false, false, false,
|
$res = fetch_file_contents(["url" => $article["link"],
|
||||||
false, false, 0,
|
"useragent" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"]);
|
||||||
"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
|
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
|
|
||||||
|
@ -30,11 +29,35 @@ class Af_Comics_ComicPress extends Af_ComicFilter {
|
||||||
|
|
||||||
if ($basenode) {
|
if ($basenode) {
|
||||||
$article["content"] = $doc->saveHTML($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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue