Forum    Search    FAQ

Board index » Sluggy Related Forums » Sluggy Related Chat




Post new topic  Reply to topic  [ 2 posts ] 
 
Author Message
 Post Posted: Tue Sep 05, 2017 1:39 pm 
Offline
Joined: Fri Feb 09, 2007 2:16 pm
Posts: 4
While we wait for the Sluggy RSS feed to be restored ಠ_ಠ I've created a temporary unofficial RSS feed.

https://dfab-179016.appspot.com/sluggy-rss.php

The feed includes only the latest comic (and doesn't update when there's a news entry with no comic). It should be good enough for feed readers that query the feed at least daily.

I've included the Google AppEngine PHP implementation below. It's designed to scape the http://sluggy.com home page no more than once a minute.

P.S. This only took about half an hour to code. I feel certain that the Sluggy admin team could do the same in less than a day.

Code:
<?php

function get_sluggy_date() {
   $memcache = new Memcache;
   $date = $memcache->get('date');
   if ($date) return $date;
   $homepage = file_get_contents("http://sluggy.com");

   preg_match('/data-comic_date="(.*?)"/', $homepage, $matches);
   $date = $matches[1];
   $memcache->set('date', $date, 60);
   return $date;
}

$comic_date = get_sluggy_date();
$url = "http://archives.sluggy.com/daily.php?date=$comic_date";

Header( "Content-Type: application/atom+xml; charset=utf-8");


echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Unofficial Sluggy Feed</title>
  <link rel="self" href="https://dfab-179016.appspot.com/sluggy-rss.php"/>
  <updated><?= $comic_date ?>T06:00:00Z</updated>
  <id>https://dfab-179016.appspot.com/sluggy-rss/</id>

  <entry>
    <title>Sluggy <?= $comic_date ?></title>
    <author><name>sluggy</name></author>
    <link href="<?= $url ?>"/>
    <id><?= $url ?></id>
    <updated><?= $comic_date ?>T06:00:00Z</updated>
    <content type="html"><![CDATA[<a href="<?= $url ?>"><?= $comic_date ?></a>]]></content>
  </entry>

</feed>

Top 
   
 Post Posted: Tue Sep 19, 2017 3:45 pm 
Offline
Joined: Mon Dec 21, 2009 9:31 am
Posts: 2
you're my hero

Top 
   
Display posts from previous:  Sort by  
 
Post new topic  Reply to topic  [ 2 posts ] 

Board index » Sluggy Related Forums » Sluggy Related Chat


Who is online

Users browsing this forum: Bing [Bot] and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: