about summary refs log tree commit diff
path: root/youtube_dl/extractor/techtalks.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-10-17 08:20:58 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-10-17 08:20:58 +0200
commitd21ab292008b114ea9e99edc2e9f2adde49415ef (patch)
tree6114b2c5e6dcda41d40efbafa42b8008ea27b8a0 /youtube_dl/extractor/techtalks.py
parent54ed626cf8fa68b76a6ae21f659d84482ab319df (diff)
downloadyoutube-dl-d21ab292008b114ea9e99edc2e9f2adde49415ef.tar.gz
youtube-dl-d21ab292008b114ea9e99edc2e9f2adde49415ef.tar.xz
youtube-dl-d21ab292008b114ea9e99edc2e9f2adde49415ef.zip
Add an extractor for techtalks.tv (closes #1606)
Diffstat (limited to 'youtube_dl/extractor/techtalks.py')
-rw-r--r--youtube_dl/extractor/techtalks.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/youtube_dl/extractor/techtalks.py b/youtube_dl/extractor/techtalks.py
new file mode 100644
index 000000000..a55f236cb
--- /dev/null
+++ b/youtube_dl/extractor/techtalks.py
@@ -0,0 +1,65 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+    get_element_by_attribute,
+    clean_html,
+)
+
+
+class TechTalksIE(InfoExtractor):
+    _VALID_URL = r'https?://techtalks\.tv/talks/[^/]*/(?P<id>\d+)/'
+
+    _TEST = {
+        u'url': u'http://techtalks.tv/talks/learning-topic-models-going-beyond-svd/57758/',
+        u'playlist': [
+            {
+                u'file': u'57758.flv',
+                u'info_dict': {
+                    u'title': u'Learning Topic Models --- Going beyond SVD',
+                },
+            },
+            {
+                u'file': u'57758-slides.flv',
+                u'info_dict': {
+                    u'title': u'Learning Topic Models --- Going beyond SVD',
+                },
+            },
+        ],
+        u'params': {
+            # rtmp download
+            u'skip_download': 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')
+        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',
+            }
+        m_slides = re.search(r'<a class="slides" href=\'(.*?)\'', webpage)
+        if m_slides is None:
+            return video_info
+        else:
+            return [
+                video_info,
+                # The slides video
+                {
+                    'id': talk_id + '-slides',
+                    'title': title,
+                    'url': rtmp_url,
+                    'play_path': m_slides.group(1),
+                    'ext': 'flv',
+                },
+            ]