X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fthisamericanlife.py;h=91e45f2c3def81545454e20e0b5e07617fa54030;hb=a6211d237b4e7051ca018cc09440502561fedaa7;hp=6118afa1afc7942266a8ca3659ac8d6afcf7b0ea;hpb=2a46a27e6c704f7b99242243747fa7d8ac68cefc;p=youtube-dl diff --git a/youtube_dl/extractor/thisamericanlife.py b/youtube_dl/extractor/thisamericanlife.py index 6118afa1a..91e45f2c3 100644 --- a/youtube_dl/extractor/thisamericanlife.py +++ b/youtube_dl/extractor/thisamericanlife.py @@ -1,32 +1,40 @@ -# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class ThisAmericanLifeIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/radio-archives/episode/(?P\d+)' - _TEST = { + _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/(?:radio-archives/episode/|play_full\.php\?play=)(?P\d+)' + _TESTS = [{ 'url': 'http://www.thisamericanlife.org/radio-archives/episode/487/harper-high-school-part-one', - 'md5': '5cda28076c9f9d1fd0b0f5cff5959948', + 'md5': '8f7d2da8926298fdfca2ee37764c11ce', 'info_dict': { 'id': '487', + 'ext': 'm4a', 'title': '487: Harper High School, Part One', - 'url' : 'http://stream.thisamericanlife.org/487/stream/487_64k.m3u8', - 'ext': 'aac', - } - } + 'description': 'md5:ee40bdf3fb96174a9027f76dbecea655', + 'thumbnail': r're:^https?://.*\.jpg$', + }, + }, { + 'url': 'http://www.thisamericanlife.org/play_full.php?play=487', + 'only_matching': True, + }] def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) - title = self._html_search_regex(r']*>(.*?)', webpage, 'title') - media_url = 'http://stream.thisamericanlife.org/' + video_id + '/stream/' + video_id + '_64k.m3u8' + webpage = self._download_webpage( + 'http://www.thisamericanlife.org/radio-archives/episode/%s' % video_id, video_id) return { 'id': video_id, - 'title': title, - 'url': media_url, - 'ext': 'aac', + 'url': 'http://stream.thisamericanlife.org/{0}/stream/{0}_64k.m3u8'.format(video_id), + 'protocol': 'm3u8_native', + 'ext': 'm4a', + 'acodec': 'aac', + 'vcodec': 'none', + 'abr': 64, + 'title': self._html_search_meta(r'twitter:title', webpage, 'title', fatal=True), + 'description': self._html_search_meta(r'description', webpage, 'description'), + 'thumbnail': self._og_search_thumbnail(webpage), }