From c1a3c9ddb2cd9401fd40cca460b4577ea25f185f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Thu, 4 Sep 2014 19:48:29 +0700 Subject: [PATCH] [techtalks] Modernize --- youtube_dl/extractor/techtalks.py | 76 ++++++++++++++++++------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/youtube_dl/extractor/techtalks.py b/youtube_dl/extractor/techtalks.py index a55f236cb..16e945d8e 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 @@ -11,24 +13,30 @@ class TechTalksIE(InfoExtractor): _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': [ + '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, }, } @@ -36,30 +44,36 @@ class TechTalksIE(InfoExtractor): 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'