Add Castbox support.

This commit is contained in:
lost 2021-11-08 00:00:00 +00:00
parent c44fcd8246
commit 04e4bfa0eb
Signed by: 0x80
GPG Key ID: 00B9C3A6C02F71F6
3 changed files with 37 additions and 0 deletions

View File

@ -3,6 +3,8 @@
supported_sites = {
"apple_podcasts" : [ "podcasts.apple.com" ],
"castbox" : ["castbox.fm"],
"castro_fm" : ["castro.fm"],
"chirbit" : [

View File

@ -0,0 +1,28 @@
#!/usr/bin/python3
from utils import *
from download_page import download
from urllib.parse import unquote
# portable code to get filename
import os
platform = os.path.basename(__file__)
if platform.endswith(".py"):
platform = platform[:(-3)]
def extract_from_page (page, verbosity):
# it's like %22%2C%22rss_url%22%3A%22https%3A%2F%2Ffeeds.npr.org%2F510310%2Fpodcast.xml%22%2C%22
# and we have to fix the codes
feed = search (page, '%22%2C%22rss_url%22%3A%22', '%22%2C%22')
if not feed is None:
return unquote(feed)
def extract (url, page=None, network=False, verbosity=3, args={}):
# cannot get feed from URL alone
if not network:
return None
page = download (platform, url, args, verbosity)
feed = extract_from_page (page, verbosity)
if not feed is None:
return feed

7
tests/castbox.txt Normal file
View File

@ -0,0 +1,7 @@
# channel pages
https://castbox.fm/channel/id2698771 https://feeds.npr.org/510310/podcast.xml
https://castbox.fm/channel/id1238764 https://rss.art19.com/generation-why-podcast
# episode pages
https://castbox.fm/episode/Congress-Passes-Biden's-Trillion-Dollar-Transit%2C-Broadband%2C-And-Power-Bill-id2698771-id440269324 https://feeds.npr.org/510310/podcast.xml
https://castbox.fm/episode/Introducing%3A-Operator-id1238764-id440095234 https://rss.art19.com/generation-why-podcast