Page 1 of 1

Saturday Morning Breakfast Cereal feed change

Posted: 04 Mar 2015, 18:58
by randompherret
SMBC updated the feed to not have the comic, here have it back.

https://github.com/randompherret/Tiny-T ... s_smbc.php

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 03:41
by TheAdam
404-ing. Is this project dead?

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 04:58
by randompherret
Just cleaned up my github, I didn't realize I had ever posted it. With the changes to the feed from today I have updated it.
save to /ttrss/plugins/af_comics/filters/af_comics_smbc.php

/e code bad

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 15:24
by Latimer
Maybe I'm doing something wrong, but PHP complains about parse error:

Parse error: syntax error, unexpected '$' in /../af_comics/filters/af_comics_smbc.php on line 20

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 16:00
by fox
probably should be ->item(0), a typo

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 17:08
by Latimer
Yeah, I guessed that, but then it complained about something else, and I didn't have time to investigate.

e: missed semicolon, duh. ->item(0);

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 18:35
by randompherret
Strange, must have been a copy /paste issue as it is correct on my live system. Corrected here.

Code: Select all

<?php
class Af_Comics_Smbc extends Af_ComicFilter {

        function supported() {
                return array("Saturday Morning Breakfast Cereal");
        }

        function process(&$article) {
                $owner_uid = $article["owner_uid"];

                if (strpos($article["link"], "www.smbc-comics.com/comic/") !== FALSE) {

                                $doc = new DOMDocument();
                                @$doc->loadHTML(fetch_file_contents($article["link"]));

                                $basenode = false;

                                if ($doc) {
                                        $xpath = new DOMXPath($doc);
                                        $basenode = $xpath->query('(//img[@id="cc-comic"])')->item(0);

                                        if ($basenode) {
                                                $article["content"] = $doc->saveXML($basenode);
                                        }
                                }

                        return true;
                }

                return false;
        }
}
?>

Re: Saturday Morning Breakfast Cereal feed change

Posted: 27 Jun 2016, 18:59
by Latimer
Thank you, and thanks for posting the plugin, too.