2021-05-26 09:32:39 +00:00
|
|
|
import feedparser
|
|
|
|
|
|
|
|
|
2021-05-27 09:32:21 +00:00
|
|
|
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
|