X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ftechtalks.py;h=a5b62c717160380c873117e878017f5c3573939a;hb=HEAD;hp=a55f236cbbca0ac5ef70db2b22eb3c94a778b2c1;hpb=1c1218fefcbabb49a0d06fc45d64a299920460ec;p=youtube-dl diff --git a/youtube_dl/extractor/techtalks.py b/youtube_dl/extractor/techtalks.py index a55f236cb..a5b62c717 100644 --- a/youtube_dl/extractor/techtalks.py +++ b/youtube_dl/extractor/techtalks.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import re from .common import InfoExtractor @@ -8,58 +10,73 @@ from ..utils import ( class TechTalksIE(InfoExtractor): - _VALID_URL = r'https?://techtalks\.tv/talks/[^/]*/(?P\d+)/' + _VALID_URL = r'https?://techtalks\.tv/talks/(?:[^/]+/)?(?P\d+)' - _TEST = { - u'url': u'http://techtalks.tv/talks/learning-topic-models-going-beyond-svd/57758/', - u'playlist': [ + _TESTS = [{ + 'url': 'http://techtalks.tv/talks/learning-topic-models-going-beyond-svd/57758/', + 'info_dict': { + 'id': '57758', + 'title': 'Learning Topic Models --- Going beyond SVD', + }, + 'playlist': [ { - u'file': u'57758.flv', - u'info_dict': { - u'title': u'Learning Topic Models --- Going beyond SVD', + 'info_dict': { + 'id': '57758', + 'ext': 'flv', + 'title': 'Learning Topic Models --- Going beyond SVD', }, }, { - u'file': u'57758-slides.flv', - u'info_dict': { - u'title': u'Learning Topic Models --- Going beyond SVD', + 'info_dict': { + 'id': '57758-slides', + 'ext': 'flv', + 'title': 'Learning Topic Models --- Going beyond SVD', }, }, ], - u'params': { + 'params': { # rtmp download - u'skip_download': True, + 'skip_download': True, }, - } + }, { + 'url': 'http://techtalks.tv/talks/57758', + 'only_matching': True, + }] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) talk_id = mobj.group('id') webpage = self._download_webpage(url, talk_id) - rtmp_url = self._search_regex(r'netConnectionUrl: \'(.*?)\'', webpage, - u'rtmp url') - play_path = self._search_regex(r'href=\'(.*?)\' [^>]*id="flowplayer_presenter"', - webpage, u'presenter play path') + rtmp_url = self._search_regex( + r'netConnectionUrl: \'(.*?)\'', webpage, 'rtmp url') + play_path = self._search_regex( + r'href=\'(.*?)\' [^>]*id="flowplayer_presenter"', + webpage, 'presenter play path') title = clean_html(get_element_by_attribute('class', 'title', webpage)) video_info = { - 'id': talk_id, - 'title': title, - 'url': rtmp_url, - 'play_path': play_path, - 'ext': 'flv', - } + 'id': talk_id, + 'title': title, + 'url': rtmp_url, + 'play_path': play_path, + 'ext': 'flv', + } m_slides = re.search(r'