-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss.py
46 lines (36 loc) · 1.24 KB
/
rss.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def get_feed_url(item):
return "https://www.geschichte.fm/feed/mp3/"
feed_url = item["claims"]["P1019"][0].get_target()
print("Feed url" + feed_url)
return feed_url
def process_podcast_channel_item(feed_url, item):
d = feedparser.parse(feed_url)
print(json.dumps(d.feed, indent=4))
print(d.feed.keys())
instance_of = item["claims"]["P31"][0]["main"]
print(instance_of)
for key in d.feed.keys():
if key == "title":
title = d.feed["title"]
item["claims"]["P1476"][0].get_target()
# https://www.wikidata.org/wiki/Q24634210
# print(d.feed.keys)
# print(d.feed.entries[0].keys)
exit(0)
channel_data = {
"title": d.feed.title,
"link": d.feed.link,
"description": d.feed.description,
"published": d.feed.published,
"published_parsed": d.feed.published_parsed
# "language": feed.language
}
entry = {
"title": d.entries[0].title,
"link": d.entries[0].link,
"description": d.entries[0].description,
"published": d.entries[0].published,
"published_parsed": d.entries[0].published_parsed,
"id": d.entries[0].id
}
print(json.dumps(entry, indent=4))