Skip to content

Commit

Permalink
Ignore non-problematic feed parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Aug 3, 2020
1 parent 2079504 commit 21a65bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rss/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ async def _parse_rss(cls, feed: Feed, resp: aiohttp.ClientResponse
headers = {"Content-Location": feed.url, **resp.headers, "Content-Encoding": "identity"}
parsed_data = feedparser.parse(content, response_headers=headers)
if parsed_data.bozo:
raise ValueError("Feed is not valid")
if not isinstance(parsed_data.bozo_exception, feedparser.ThingsNobodyCaresAboutButMe):
raise parsed_data.bozo_exception
feed = Feed(id=feed.id, url=feed.url, title=parsed_data.get("title", feed.url),
subtitle=parsed_data.get("description", ""), link=parsed_data.get("link", ""),
subscriptions=feed.subscriptions)
Expand Down

0 comments on commit 21a65bc

Please sign in to comment.