]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/thisamericanlife.py
debian/{compat,control}: Update compat to 10.
[youtubedl] / youtube_dl / extractor / thisamericanlife.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class ThisAmericanLifeIE(InfoExtractor):
7 _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/(?:radio-archives/episode/|play_full\.php\?play=)(?P<id>\d+)'
8 _TESTS = [{
9 'url': 'http://www.thisamericanlife.org/radio-archives/episode/487/harper-high-school-part-one',
10 'md5': '8f7d2da8926298fdfca2ee37764c11ce',
11 'info_dict': {
12 'id': '487',
13 'ext': 'm4a',
14 'title': '487: Harper High School, Part One',
15 'description': 'md5:ee40bdf3fb96174a9027f76dbecea655',
16 'thumbnail': r're:^https?://.*\.jpg$',
17 },
18 }, {
19 'url': 'http://www.thisamericanlife.org/play_full.php?play=487',
20 'only_matching': True,
21 }]
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25
26 webpage = self._download_webpage(
27 'http://www.thisamericanlife.org/radio-archives/episode/%s' % video_id, video_id)
28
29 return {
30 'id': video_id,
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),
40 }