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