]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/thisamericanlife.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / thisamericanlife.py
CommitLineData
2a46a27e
EW
1from .common import InfoExtractor
2
3
4class ThisAmericanLifeIE(InfoExtractor):
e56a4c9e
S
5 _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/(?:radio-archives/episode/|play_full\.php\?play=)(?P<id>\d+)'
6 _TESTS = [{
2a46a27e 7 'url': 'http://www.thisamericanlife.org/radio-archives/episode/487/harper-high-school-part-one',
e56a4c9e 8 'md5': '8f7d2da8926298fdfca2ee37764c11ce',
2a46a27e
EW
9 'info_dict': {
10 'id': '487',
e56a4c9e 11 'ext': 'm4a',
2a46a27e 12 'title': '487: Harper High School, Part One',
e56a4c9e 13 'description': 'md5:ee40bdf3fb96174a9027f76dbecea655',
ec85ded8 14 'thumbnail': r're:^https?://.*\.jpg$',
e41840c5 15 },
e56a4c9e
S
16 }, {
17 'url': 'http://www.thisamericanlife.org/play_full.php?play=487',
18 'only_matching': True,
19 }]
2a46a27e
EW
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
e56a4c9e
S
23
24 webpage = self._download_webpage(
add96eb9 25 f'http://www.thisamericanlife.org/radio-archives/episode/{video_id}', video_id)
2a46a27e 26
2a46a27e
EW
27 return {
28 'id': video_id,
add96eb9 29 'url': f'http://stream.thisamericanlife.org/{video_id}/stream/{video_id}_64k.m3u8',
e56a4c9e
S
30 'protocol': 'm3u8_native',
31 'ext': 'm4a',
32 'acodec': 'aac',
33 'vcodec': 'none',
34 'abr': 64,
35 'title': self._html_search_meta(r'twitter:title', webpage, 'title', fatal=True),
36 'description': self._html_search_meta(r'description', webpage, 'description'),
37 'thumbnail': self._og_search_thumbnail(webpage),
2a46a27e 38 }