Re: importing entries
Bill Mill <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
On Apr 7, 2005 1:19 AM, Wari Wahab <[email protected]> wrote: > > I tested this on both Ted's and my sites' main RSS files, and it > > worked like a charm. It seems, in looking over some RSS from others, > > that some feeds use the 'content:encoded' tag, while others use > > 'description'. I test for a content tag (which is a little wonky in > > cElementTree, so there's room for improvement in that test), and if > > it's there, use that. If not, I use the description. > > These parsing issues are usually taken care of by the feedparser by > Mark Pilgrim. It even does so without using an unforgiving XML parser. > > > Also, how do you want to do file naming? I sanitize the title and use > > the first 200 characters of it, but that's suboptimal. > > There's also date/time that wasn't imported, easily solvable though. > What about comment feeds support? These are things that first time > users will ask for. I forgot about that - but it's just an os.utime() . I had thought of it earlier, but forgot it when I went to write the script. > > But I have to say Bill that it's a great try at coming up with what > Will wanted. Nice job :) > > I'd say use the feedparser library @ > http://diveintomark.org/projects/feed_parser/feedparser.py and you have > years of bug fixes to support all other RSS anomalies and you got the > bonus of supporting atom, and is unicode too. > > Just did a quick lookup and looks like there's a nice feedparser > website. http://feedparser.org/ > I'll give it a shot. I don't know why the content:encoded tag comes out all goofy in cElementTree - I'm going to shoot Frederik an email. Otherwise, my code would be really *really* simple. > Using feedparser, your code would be simpler, and you just have to deal > with domains that you have not faced yet in the world of RSS. Really > Simple Syndication isn't. > Peace Bill Mill bill.mill at gmail.com ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click