mirror of
https://github.com/maubot/rss.git
synced 2025-01-05 13:00:50 -05:00
Fix possible feed reading errors
This commit is contained in:
parent
e92d8fceb9
commit
8a769bbe18
11
rss/bot.py
11
rss/bot.py
@ -118,9 +118,16 @@ class RSSBot(Plugin):
|
||||
async def read_feed(self, url: str) -> str:
|
||||
try:
|
||||
resp = await self.http.get(url)
|
||||
except aiohttp.client_exceptions.ClientError:
|
||||
except Exception:
|
||||
self.log.exception(f"Error fetching {url}")
|
||||
return ""
|
||||
content = await resp.text()
|
||||
try:
|
||||
content = await resp.text()
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
content = await resp.text(encoding="utf-8")
|
||||
except:
|
||||
content = str(await resp.read())[2:-1]
|
||||
return content
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
Reference in New Issue
Block a user