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