mirror of
https://github.com/maubot/rss.git
synced 2025-07-15 11:29:30 -04:00
Fix possible feed reading errors
This commit is contained in:
parent
e92d8fceb9
commit
8a769bbe18
1 changed files with 9 additions and 2 deletions
|
@ -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 ""
|
||||
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…
Add table
Add a link
Reference in a new issue