diff options
author | Andrew Dolgov <[email protected]> | 2017-04-10 19:46:16 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-04-10 19:46:16 +0300 |
commit | b8f23d68484d8c0672d6c01a1344804dd5aba17f (patch) | |
tree | d19a74e623a3cc0f8a2d66599934836be9c3d45c /plugins | |
parent | 0eed023e7d20fff6c435d331f35b7f98b76f81e3 (diff) | |
parent | 32024bdf219f9b620cb4693b3a974b19afe00f2f (diff) |
Merge branch 'fix_af_comic_tfd_filter' into 'master'
Fix the TFD filter and add Married to the sea
A while ago TFD changed the html for the comics page and broke the filter.
Here is a patch to show the comics in the feed again, as well as add Married to the Sea (sister site)
See merge request !50
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/af_comics/filters/af_comics_tfd.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php index d47c164ee..eeec28fa3 100644 --- a/plugins/af_comics/filters/af_comics_tfd.php +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -2,11 +2,12 @@ class Af_Comics_Tfd extends Af_ComicFilter { function supported() { - return array("Toothpaste For Dinner"); + return array("Toothpaste For Dinner", "Married to the Sea"); } function process(&$article) { - if (strpos($article["link"], "toothpastefordinner.com") !== FALSE) { + if (strpos($article["link"], "toothpastefordinner.com") !== FALSE || + strpos($article["link"], "marriedtothesea.com") !== FALSE) { $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)"); @@ -14,13 +15,13 @@ class Af_Comics_Tfd extends Af_ComicFilter { if (!$res) return $article; $doc = new DOMDocument(); - $doc->loadHTML($res); - + @$doc->loadHTML(fetch_file_contents($article["link"])); + $basenode = false; if ($doc) { $xpath = new DOMXPath($doc); - $basenode = $xpath->query('//img[@class="comic"]')->item(0); + $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0); if ($basenode) { $article["content"] = $doc->saveXML($basenode); |