Accounted for no artworkURL

This commit is contained in:
Dan Dembinski
2020-03-09 16:34:28 -04:00
parent 32fd101e5a
commit a3b27e1dea
3 changed files with 14 additions and 5 deletions

View File

@@ -4,7 +4,8 @@ import requests
API_URL = '''http://podcast-api.caprover.dandev.us'''
def feedImport ():
outline = opml.parse("podcast_republic_podcasts.opml")
# outline = opml.parse("podcast_republic_podcasts.opml")
outline = opml.parse("test.opml")
#get the number of shows from the OPML file
x = len(outline)
y=0
@@ -17,10 +18,10 @@ def feedImport ():
desc = outline[y].pr_desc
#checks to see if the podcast URL already exists for logged in user and skips it if it has already been imported.
# payload = '''{"userid" : 1, "newURL": "''' + str(url) + '''"}'''
r = requests.post(API_URL+'/addFeed/', json={"userID" : 1, "newURL" : url})
print(r.text)
# print(payload)
# print(r.text)
print(url)
y=y+1
feedImport()

View File

@@ -129,7 +129,10 @@ def addFeed():
parsed = fp.parse(data['newURL'])
title = str(parsed.feed.title)
if not parsed.feed.title:
artwork = str(parsed.feed.image)
else:
artwork = None
# checks to see if the podcast URL already exists for logged in user and skips it if it has already been imported.
# if the show doesn't already exist for the logged in user it gets added

5
test.opml Normal file
View File

@@ -0,0 +1,5 @@
<?xml version='1.0' encoding='UTF-8' standalone='no' ?><opml version="1.0"><head><title>Podcast Republic Subscribed Feeds</title></head><body>
<outline text="Mountain Radio Astronomy" title="Mountain Radio Astronomy" type="rss" xmlUrl="http://www.gb.nrao.edu/epo/mra.xml" pr_Id="153540555" pr_artwork="https://is4-ssl.mzstatic.com/image/thumb/Features/v4/5f/88/96/5f8896e9-9be5-529a-af14-cc807367568a/mza_1382744875394257421.png/60x60bb.jpg" pr_artwork_large="https://is4-ssl.mzstatic.com/image/thumb/Features/v4/5f/88/96/5f8896e9-9be5-529a-af14-cc807367568a/mza_1382744875394257421.png/600x600bb.jpg" pr_desc="Ever wonder about radio astronomy? Join us at the National Radio Astronomy Observatory in Green Bank, WV for fascinating interviews with astronomers who are using the largest fully steerable telescope in the world: The Robert C. Byrd Green Bank Telelscope. Each episode is about 20-30 minutes in length." pr_au="0" meidaType="0" PodSourceType="0" PodUniqueCriteria="0" playbackSpeed="1.0" />
</body></opml>