1 from __future__ import unicode_literals
6 from .common import InfoExtractor
16 class VeeHDIE(InfoExtractor):
17 _VALID_URL = r'https?://veehd\.com/video/(?P<id>\d+)'
20 'url': 'http://veehd.com/video/4686958',
24 'title': 'Time Lapse View from Space ( ISS)',
25 'uploader_id': 'spotted',
26 'description': 'md5:f0094c4cf3a72e22bc4e4239ef767ad7',
30 def _real_extract(self, url):
31 video_id = self._match_id(url)
33 # VeeHD seems to send garbage on the first request.
34 # See https://github.com/rg3/youtube-dl/issues/2102
35 self._download_webpage(url, video_id, 'Requesting webpage')
36 webpage = self._download_webpage(url, video_id)
37 player_path = self._search_regex(
38 r'\$\("#playeriframe"\).attr\({src : "(.+?)"',
39 webpage, 'player path')
40 player_url = compat_urlparse.urljoin(url, player_path)
42 self._download_webpage(player_url, video_id, 'Requesting player page')
43 player_page = self._download_webpage(
44 player_url, video_id, 'Downloading player page')
45 config_json = self._search_regex(
46 r'value=\'config=({.+?})\'', player_page, 'config json')
47 config = json.loads(config_json)
49 video_url = compat_urlparse.unquote(config['clip']['url'])
50 title = clean_html(get_element_by_id('videoName', webpage).rpartition('|')[0])
51 uploader_id = self._html_search_regex(r'<a href="/profile/\d+">(.+?)</a>',
53 thumbnail = self._search_regex(r'<img id="veehdpreview" src="(.+?)"',
55 description = self._html_search_regex(r'<td class="infodropdown".*?<div>(.*?)<ul',
56 webpage, 'description', flags=re.DOTALL)
64 'uploader_id': uploader_id,
65 'thumbnail': thumbnail,
66 'description': description,