jmoiron / speedparser

feedparser but faster and worse
MIT License
102 stars 20 forks source link

Not work with http://news.ycombinator.com/rss #17

Open luminousmen opened 7 years ago

luminousmen commented 7 years ago
>>> import speedparser
>>> feed = "http://news.ycombinator.com/rss"
>>> speedparser.parse(feed)
{'bozo_tb': 'Traceback (most recent call last):\n  File "/home/kir/.virtualenvs/rss/lib/python3.5/site-packages/speedparser/speedparser.py", line 688, in parse\n    parser = SpeedParser(document, cleaner, unix_timestamp, encoding)\n  File "/home/kir/.virtualenvs/rss/lib/python3.5/site-packages/speedparser/speedparser.py", line 585, in __init__\n    self.tree = tree.getroottree()\nAttributeError: \'NoneType\' object has no attribute \'getroottree\'\n', 'bozo_exception': AttributeError("'NoneType' object has no attribute 'getroottree'",), 'bozo': 1, 'feed': {}, 'entries': []}
foxylad commented 6 years ago

It seems speedparser does not include feedparsers handling of URLs. You have to get the feed with something like:

import urllib2
feed=urllib2.urlopen('http://newsroom.co.nz/feed/rss')
speedparser.parse(feed.read())