[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / gputechconf.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class GPUTechConfIE(InfoExtractor):
8     _VALID_URL = r'https?://on-demand\.gputechconf\.com/gtc/2015/video/S(?P<id>\d+)\.html'
9     _TEST = {
10         'url': 'http://on-demand.gputechconf.com/gtc/2015/video/S5156.html',
11         'md5': 'a8862a00a0fd65b8b43acc5b8e33f798',
12         'info_dict': {
13             'id': '5156',
14             'ext': 'mp4',
15             'title': 'Coordinating More Than 3 Million CUDA Threads for Social Network Analysis',
16             'duration': 1219,
17         }
18     }
19
20     def _real_extract(self, url):
21         video_id = self._match_id(url)
22         webpage = self._download_webpage(url, video_id)
23
24         root_path = self._search_regex(
25             r'var\s+rootPath\s*=\s*"([^"]+)', webpage, 'root path',
26             default='http://evt.dispeak.com/nvidia/events/gtc15/')
27         xml_file_id = self._search_regex(
28             r'var\s+xmlFileId\s*=\s*"([^"]+)', webpage, 'xml file id')
29
30         return {
31             '_type': 'url_transparent',
32             'id': video_id,
33             'url': '%sxml/%s.xml' % (root_path, xml_file_id),
34             'ie_key': 'DigitallySpeaking',
35         }