Formatted-RSS-to-Telegram/FR2T/parser.py

18 lines
295 B
Python
Raw Permalink Normal View History

2021-05-26 09:32:39 +00:00
import feedparser
def rssParser(url: str, user_agent: str):
2021-05-27 10:31:26 +00:00
return feedparser.parse(url, agent=user_agent)["entries"]
2021-05-26 09:32:39 +00:00
def objParser(obj: dict, url: str):
paths = url.split(".")
for p in paths:
2021-05-27 12:40:18 +00:00
if p.isdigit():
p = int(p)
2021-05-26 09:32:39 +00:00
obj = obj[p]
return obj