youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit e41840c522fa09a08812c6e6724063f955426f21
parent 2a46a27e6c704f7b99242243747fa7d8ac68cefc
Author: Eric Wong <eric@taedium.com>
Date:   Mon, 15 Jun 2015 09:35:48 -0700

[thisamericanlife] get info from <meta> tags

Diffstat:
Myoutube_dl/extractor/thisamericanlife.py | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/youtube_dl/extractor/thisamericanlife.py b/youtube_dl/extractor/thisamericanlife.py @@ -6,6 +6,7 @@ from .common import InfoExtractor class ThisAmericanLifeIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/radio-archives/episode/(?P<id>\d+)' + _TEST = { 'url': 'http://www.thisamericanlife.org/radio-archives/episode/487/harper-high-school-part-one', 'md5': '5cda28076c9f9d1fd0b0f5cff5959948', @@ -14,19 +15,26 @@ class ThisAmericanLifeIE(InfoExtractor): '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.', + }, + 'params': { + # m38u download + 'skip_download': 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'<h1[^>]*>(.*?)</h1>', webpage, 'title') - media_url = 'http://stream.thisamericanlife.org/' + video_id + '/stream/' + video_id + '_64k.m3u8' + # TODO check to see if there's a free mp3. if so, download that, otherwise get the m3u8 stream. return { 'id': video_id, - 'title': title, - 'url': media_url, + 'title': self._html_search_regex(r'<meta property="twitter:title" content="(.*?)"', webpage, 'title'), + 'url': 'http://stream.thisamericanlife.org/' + video_id + '/stream/' + video_id + '_64k.m3u8', 'ext': 'aac', + 'thumbnail': self._html_search_regex(r'<meta property="og:image" content="(.*?)"', webpage, 'thumbnail'), + 'description': self._html_search_regex(r'<meta name="description" content="(.*?)"', webpage, 'description'), }