add notification script to detect new Zander episodes (run via cron). can later easily be extended to automatic download of new episodes
This commit is contained in:
26
zanderdetect.py
Normal file
26
zanderdetect.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from defusedxml.ElementTree import fromstring
|
||||
import urllib.request
|
||||
|
||||
url = "https://www1.wdr.de/mediathek/audio/zeitzeichen/zeitzeichen-podcast-100.podcast"
|
||||
|
||||
def findZander(today):
|
||||
for n, item in enumerate(today):
|
||||
if item.tag.find("title") >= 0:
|
||||
title = today[n].text
|
||||
if item.tag.find("author") >= 0:
|
||||
author = today[n].text
|
||||
if item.tag.find("enclosure") >= 0:
|
||||
podcasturl = today[n].attrib["url"]
|
||||
|
||||
if author.find("Zander") > 0:
|
||||
print(f"ZanderAlert: {title}\nDownload-URL: {podcasturl}")
|
||||
|
||||
with urllib.request.urlopen(url) as response:
|
||||
feed = fromstring(response.read())[0]
|
||||
|
||||
for i in feed:
|
||||
if i.tag == "item":
|
||||
findZander(i)
|
||||
break
|
||||
Reference in New Issue
Block a user