mirror of
https://github.com/maubot/rss.git
synced 2025-07-26 00:25:36 -04:00
Update feedparser input
This commit is contained in:
parent
b58202ebfb
commit
a8f1340125
1 changed files with 2 additions and 1 deletions
|
@ -22,6 +22,7 @@ from time import mktime, time
|
||||||
import asyncio
|
import asyncio
|
||||||
import hashlib
|
import hashlib
|
||||||
import html
|
import html
|
||||||
|
import io
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import attr
|
import attr
|
||||||
|
@ -264,7 +265,7 @@ class RSSBot(Plugin):
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
content = str(await resp.read())[2:-1]
|
content = str(await resp.read())[2:-1]
|
||||||
headers = {"Content-Location": feed.url, **resp.headers, "Content-Encoding": "identity"}
|
headers = {"Content-Location": feed.url, **resp.headers, "Content-Encoding": "identity"}
|
||||||
parsed_data = feedparser.parse(content, response_headers=headers)
|
parsed_data = feedparser.parse(io.StringIO(content), response_headers=headers)
|
||||||
if parsed_data.bozo:
|
if parsed_data.bozo:
|
||||||
if not isinstance(parsed_data.bozo_exception, feedparser.ThingsNobodyCaresAboutButMe):
|
if not isinstance(parsed_data.bozo_exception, feedparser.ThingsNobodyCaresAboutButMe):
|
||||||
raise parsed_data.bozo_exception
|
raise parsed_data.bozo_exception
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue