Support more Player FM links.

This commit is contained in:
lost 2021-11-08 00:00:00 +00:00
parent 6e69d88b0d
commit cfb3e4a6be
5 changed files with 29 additions and 5 deletions

View File

@ -1 +1 @@
2021-07-23 (pre-release)
2021-11-08 (pre-release)

View File

@ -18,7 +18,7 @@ supported_sites = {
"lbry" : ["odysee.com"],
"player_fm" : ["player.fm/series/"],
"player_fm" : ["player.fm"],
"pocketcasts" : ["pca.st"],

View File

@ -6,13 +6,13 @@ from utils import notify,debug,error
# args should be a dictionary of arguments
# return page bytes, response code
def download (platform, url, args, verbosity, return_http_code=False):
def download (platform, url, args, verbosity, return_http_code=False, follow_location=True):
page_bytes = BytesIO()
c = pycurl.Curl()
c.setopt(c.URL, url)
c.setopt(c.WRITEDATA, page_bytes)
c.setopt(c.FOLLOWLOCATION, True)
c.setopt(c.FOLLOWLOCATION, follow_location)
# TODO: handle possible arguments
# if args["user_agent"]:

View File

@ -17,7 +17,28 @@ def extract (url, page=None, network=False, verbosity=3, args={}):
if not network:
return None
page = download (platform, url, args, verbosity)
if not "player.fm/series/" in url:
# it might be a page that redirects to /series/something
page = download (platform, url, args, verbosity, follow_location=False)
redirect_link = search (page, '<html><body>You are being <a href="', '">redirected</a>.</body></html>')
if not redirect_link is None:
url = redirect_link
else:
return None
# if it's in the form player.fm/series/series-name then get that page
index = url.find("player.fm/series/")
series = url[index + len("player.fm/series/"):]
# if it's player.fm/series/series-name/episode-name truncate to
# player.fm/series/series-name
index2 = series.find("/")
if index2 >= 0:
series = series[:index2]
page_to_download = "https://player.fm/series/" + series
page = download (platform, page_to_download, args, verbosity)
feed = extract_from_page (page, verbosity)
if not feed is None:
return feed

View File

@ -1 +1,4 @@
https://player.fm/series/tea-with-queen-and-j https://feeds.soundcloud.com/users/soundcloud:users:83464467/sounds.rss
https://player.fm/series/full-body-chills https://feeds.megaphone.fm/ADL1824189476
https://player.fm/series/full-body-chills/radio-hell https://feeds.megaphone.fm/ADL1824189476
https://player.fm/1BCuWqe https://feeds.soundcloud.com/users/soundcloud:users:12999054/sounds.rss