]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_comics/filters/af_comics_comicpress.php
5c4daa3374c44f51771ee021fc22ee21cf03183e
2 class Af_Comics_ComicPress
extends Af_ComicFilter
{
5 return array("Buni", "Buttersafe", "Whomp!", "Happy Jar", "CSection",
6 "Extra Fabulous Comics");
9 function process(&$article) {
10 $owner_uid = $article["owner_uid"];
12 if (strpos($article["guid"], "bunicomic.com") !== FALSE ||
13 strpos($article["guid"], "buttersafe.com") !== FALSE ||
14 strpos($article["guid"], "whompcomic.com") !== FALSE ||
15 strpos($article["guid"], "extrafabulouscomics.com") !== FALSE ||
16 strpos($article["guid"], "happyjar.com") !== FALSE ||
17 strpos($article["guid"], "csectioncomics.com") !== FALSE) {
19 if (strpos($article["plugin_data"], "af_comics,$owner_uid:") === FALSE) {
21 // lol at people who block clients by user agent
22 // oh noes my ad revenue Q_Q
24 $res = fetch_file_contents($article["link"], false, false, false,
26 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
28 $doc = new DOMDocument();
29 @$doc->loadHTML($res);
34 $xpath = new DOMXPath($doc);
35 $basenode = $xpath->query('//div[@id="comic"]')->item(0);
38 $article["content"] = $doc->saveXML($basenode);
39 $article["plugin_data"] = "af_comics,$owner_uid:" . $article["plugin_data"];
42 } else if (isset($article["stored"]["content"])) {
43 $article["content"] = $article["stored"]["content"];