From e56a4c9e9bc459346d23554207b910a1b772000d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Sat, 4 Jul 2015 05:42:53 +0600 Subject: [PATCH] [thisamericanlife] Improve and simplify --- youtube_dl/extractor/thisamericanlife.py | 42 +++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/youtube_dl/extractor/thisamericanlife.py b/youtube_dl/extractor/thisamericanlife.py index 295523271..36493a5de 100644 --- a/youtube_dl/extractor/thisamericanlife.py +++ b/youtube_dl/extractor/thisamericanlife.py @@ -1,38 +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', - 'thumbnail': 'http://www.thisamericanlife.org/sites/default/files/imagecache/large_square/episodes/487_lg_2.jpg', - 'description': 'We spent five months at Harper High School in Chicago, where last year alone 29 current and recent students were shot. 29. We went to get a sense of what it means to live in the midst of all this gun violence, how teens and adults navigate a world of funerals and Homecoming dances.', + 'description': 'md5:ee40bdf3fb96174a9027f76dbecea655', + 'thumbnail': 're:^https?://.*\.jpg$', }, - 'params': { - # m38u download - 'skip_download': True, - }, - } + }, { + '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) + + webpage = self._download_webpage( + 'http://www.thisamericanlife.org/radio-archives/episode/%s' % video_id, video_id) return { 'id': video_id, - 'title': self._html_search_regex(r'