[Zope] rss

Andy McKay andym@ActiveState.com
Wed, 13 Dec 2000 15:37:17 -0800


So it does, thanks! I throught I read through Site Access and managed to
skip that. Yep a simple cron job and it will be updating nightly.

Cheers.

--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "Kevin Teague" <kteague@stormix.com>
To: "Andy McKay" <andym@activestate.com>; <zope@zope.org>
Sent: Wednesday, December 13, 2000 3:20 PM
Subject: Re: [Zope] rss


> I'm setting up some rss feeds, and I've just used the Site Summary
> product from here:
>
> http://www.zope.org/Members/edmundd/SiteSummary
>
> With Site Summary you can use the importRSS method to pull in a channel.
> I use a modified version of this script running on a cron job to update
> the rss channels:
>
> http://www.zope.org/Members/phd/cron-zope/pack-db_fs
>
> The script looks like this (it's still kind of hack-ish, but it works
> :). My only problem now is to figure out how to have member preferences
> handle a list of rss channels with the PTK.
>
>
> #!/usr/bin/python
>
> username="kteague"
> password="******"
> zope="http://www.evileggs.org/"
>
> import sys, urllib, re
>
> class NoGUIURLopener(urllib.FancyURLopener):
>    def __init__(self, username, password, *args):
>       apply(urllib.FancyURLopener.__init__, (self,) + args)
>
>       self.username = username
>       self.password = password
>       self.asked = 0
>
>    def prompt_user_passwd(self, host, realm):
>       if self.asked:
>          raise "Unauthorized"
>       else:
>          self.asked = 1
>          return self.username, self.password
>
>
> channel_id = ""
> rss_url = ""
>
> try:
>     f = open("channellist.txt")
> except:
>    print 'Could not open the channellist.txt file.'
> lines = f.readlines()
> f.close()
>
> for line in lines:
>     if re.search('^\n$', line):
>         continue
>     m = re.search('(.*?)\s+(.*)', line)
>     try:
>         (channel_id, rss_url) = m.groups()
>     except:
>         print 'Can not properly parse line:\n%s' % (line)
>         continue
>     urllib._urlopener = NoGUIURLopener(username, password)
>     urllib.urlretrieve("%s/rss/%s/importRSS?url=%s" % (zope, channel_id,
> rss_url))
>
>
>
> ==================
> And the 'channellist.txt' text file just has the Zope id's of the Site
> Summary objects and the rss channel URLs, like so:
>
>
> Advogato   http://www.advogato.com/rss/articles.xml
> Linux.com   http://www.linux.com/mrn/front_page.rss
>
>
> --
>   Kevin Teague, Zopista
>   http://www.stormix.com
>