Saturday Morning Breakfast Cereal feed change

Post plugins and custom CSS snippets here
randompherret
Bear Rating Trainee
Bear Rating Trainee
Posts: 36
Joined: 04 Jul 2013, 08:11

Saturday Morning Breakfast Cereal feed change

Postby randompherret » 04 Mar 2015, 18:58

SMBC updated the feed to not have the comic, here have it back.

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

TheAdam
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 07 Mar 2016, 00:29

Re: Saturday Morning Breakfast Cereal feed change

Postby TheAdam » 27 Jun 2016, 03:41

404-ing. Is this project dead?

randompherret
Bear Rating Trainee
Bear Rating Trainee
Posts: 36
Joined: 04 Jul 2013, 08:11

Re: Saturday Morning Breakfast Cereal feed change

Postby randompherret » 27 Jun 2016, 04:58

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
Last edited by randompherret on 27 Jun 2016, 18:59, edited 1 time in total.

Latimer
Bear Rating Master
Bear Rating Master
Posts: 131
Joined: 17 Mar 2013, 19:35

Re: Saturday Morning Breakfast Cereal feed change

Postby Latimer » 27 Jun 2016, 15:24

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

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Saturday Morning Breakfast Cereal feed change

Postby fox » 27 Jun 2016, 16:00

probably should be ->item(0), a typo

Latimer
Bear Rating Master
Bear Rating Master
Posts: 131
Joined: 17 Mar 2013, 19:35

Re: Saturday Morning Breakfast Cereal feed change

Postby Latimer » 27 Jun 2016, 17:08

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);

randompherret
Bear Rating Trainee
Bear Rating Trainee
Posts: 36
Joined: 04 Jul 2013, 08:11

Re: Saturday Morning Breakfast Cereal feed change

Postby randompherret » 27 Jun 2016, 18:35

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;
        }
}
?>

Latimer
Bear Rating Master
Bear Rating Master
Posts: 131
Joined: 17 Mar 2013, 19:35

Re: Saturday Morning Breakfast Cereal feed change

Postby Latimer » 27 Jun 2016, 18:59

Thank you, and thanks for posting the plugin, too.


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 1 guest