]> git.wh0rd.org - tt-rss.git/blob - plugins/af_comics/filters/af_comics_tfd.php
78792d25455f941f3b892eb26519f8c662a1fef1
[tt-rss.git] / plugins / af_comics / filters / af_comics_tfd.php
1 <?php
2 class Af_Comics_Tfd extends Af_ComicFilter {
3
4 function supported() {
5 return array("Toothpaste For Dinner", "Married to the Sea");
6 }
7
8 function process(&$article) {
9 if (strpos($article["link"], "toothpastefordinner.com") !== FALSE ||
10 strpos($article["link"], "marriedtothesea.com") !== FALSE) {
11 $res = fetch_file_contents($article["link"], false, false, false,
12 false, false, 0,
13 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
14
15 if (!$res) return $article;
16
17 $doc = new DOMDocument();
18
19 if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
20 $xpath = new DOMXPath($doc);
21 $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
22
23 if ($basenode) {
24 $article["content"] = $doc->saveXML($basenode);
25 return true;
26 }
27 }
28 }
29
30 return false;
31 }
32 }