1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-14 16:38:29 +00:00

playerfm Add extractor

This commit is contained in:
Rohan Wadhwa 2025-04-25 20:14:26 -04:00
parent 2381881fe5
commit b4a8df0eba
2 changed files with 65 additions and 0 deletions

View File

@ -1559,6 +1559,7 @@
PlatziCourseIE, PlatziCourseIE,
PlatziIE, PlatziIE,
) )
from .playerfm import PlayerFmIE
from .playplustv import PlayPlusTVIE from .playplustv import PlayPlusTVIE
from .playsuisse import PlaySuisseIE from .playsuisse import PlaySuisseIE
from .playtvak import PlaytvakIE from .playtvak import PlaytvakIE

View File

@ -0,0 +1,64 @@
from .common import ExtractorError, InfoExtractor
from ..utils import determine_ext, join_nonempty
class PlayerFmIE(InfoExtractor):
_VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
_TESTS = [{
'url': 'https://player.fm/series/chapo-trap-house/movie-mindset-33-casino-feat-felix',
'info_dict': {
'id': 'movie-mindset-33-casino-feat-felix',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': 'Movie Mindset 33 - Casino feat. Felix',
'creators': ['Chapo Trap House'],
'description': 'The first episode of this season of Movie Mindset is free for all listeners as always. To listen to the rest of the season, subscribe at <a href="http://www.patreon.com/chapotraphouse">www.patreon.com/chapotraphouse</a> When you love movies, youve got to watch them. Theres no other way…Movie Mindset Season 3 commences with our first ever single feature on the most referenced movie in Chapo Trap House history: Martin Scorseses masterpiece Casino. Will and Hesse are joined by Felix to take a kaleidoscopic and dizzying dive into the inferno of American greed that is Las Vegas. Anchored by a triumvirate of all career great performances from Robert De Niro, Sharon Stone and Joe Pesci in FULL PSYCHO MODE, Casino is by equal turns hilarious and stomach turning and stands alone as Scorseses grandest and most generous examination of evil and the tragic flaws that doom us all. Should you listen even if you havent seen this movie? Why take a chance? At least that the way we feel about it.',
'duration': 6830,
'ext': 'mp3',
},
}, {
'url': 'https://player.fm/series/nbc-nightly-news-with-lester-holt/thursday-april-24-2025',
'info_dict': {
'id': 'thursday-april-24-2025',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': 'Thursday, April 24, 2025',
'creators': ['Lester Holt', 'NBC News'],
'description': '<p>Trump urges Putin to \'STOP\' after deadly Russian strike on Ukraine; More than 90,000 people have paid their respects to Pope Francis; Miami shooting leaves three injured; and more on tonights broadcast.</p>',
'duration': 1250,
'ext': 'mp3',
},
}, {
'url': 'https://player.fm/series/soccer-101/ep-109-its-kicking-off-how-have-the-rules-for-kickoff-changed-what-are-the-best-approaches-to-getting-the-game-underway-and-how-could-we-improve-on-the-present-system',
'info_dict': {
'id': 'ep-109-its-kicking-off-how-have-the-rules-for-kickoff-changed-what-are-the-best-approaches-to-getting-the-game-underway-and-how-could-we-improve-on-the-present-system',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': '#109 It\'s kicking off! How have the rules for kickoff changed, what are the best approaches to getting the game underway, and how could we improve on the present system?',
'creators': ['Soccer Roundup'],
'description': '`<p>Ryan is joined by Joe and Taylor to answer the age old question (in your best Jerry Seinfeld impression), "What\'s the deal with kickoff?!" How does a game get underway, how have the rules regarding kickoff evolved since the mid-1800s, what are the different approaches to getting your tactics right from kickoff, how could we improve upon the current system, and much much more!</p><p>The Soccer 101 theme, and plenty of other excellent music, can be found right here: <a href="https://aerialist.bandcamp.com/">https://aerialist.bandcamp.com</a>.</p>`',
'duration': 1765,
'ext': 'mp3',
},
}]
def _real_extract(self, url):
# podcast url is always after last backlash
video_id = self._match_id(url)
data = self._download_json(url + '.json', None)
thumbnail = data['image']['url'] if 'image' in data else data['series']['image']['url']
video_url = join_nonempty('https', self._search_regex(r'redirect.mp3/(.*)', data['url'], 'redirect'), delim='://')
if not video_url:
raise ExtractorError('URL to podcast not found', expected=True)
formats = [{
'url': video_url,
'ext': determine_ext(video_url, default_ext=''),
}]
return {
'id': video_id,
'thumbnail': thumbnail,
'title': data['title'],
'creators': data['series']['author'].split(', '),
'description': data['description'],
'duration': data['duration'],
'formats': formats,
}