]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/veehd.py
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class VeeHDIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://veehd\.com/video/(?P<id>\d+)'
18 'url': 'http://veehd.com/video/4686958',
22 'title': 'Time Lapse View from Space ( ISS)',
23 'uploader_id': 'spotted',
24 'description': 'md5:f0094c4cf3a72e22bc4e4239ef767ad7',
28 def _real_extract(self
, url
):
29 mobj
= re
.match(self
._VALID
_URL
, url
)
30 video_id
= mobj
.group('id')
32 # VeeHD seems to send garbage on the first request.
33 # See https://github.com/rg3/youtube-dl/issues/2102
34 self
._download
_webpage
(url
, video_id
, 'Requesting webpage')
35 webpage
= self
._download
_webpage
(url
, video_id
)
36 player_path
= self
._search
_regex
(
37 r
'\$\("#playeriframe"\).attr\({src : "(.+?)"',
38 webpage
, 'player path')
39 player_url
= compat_urlparse
.urljoin(url
, player_path
)
41 self
._download
_webpage
(player_url
, video_id
, 'Requesting player page')
42 player_page
= self
._download
_webpage
(
43 player_url
, video_id
, 'Downloading player page')
44 config_json
= self
._search
_regex
(
45 r
'value=\'config
=({.+?
})\'', player_page, 'config json
')
46 config = json.loads(config_json)
48 video_url = compat_urlparse.unquote(config['clip
']['url
'])
49 title = clean_html(get_element_by_id('videoName
', webpage).rpartition('|
')[0])
50 uploader_id = self._html_search_regex(r'<a href
="/profile/\d+">(.+?
)</a
>',
52 thumbnail = self._search_regex(r'<img
id="veehdpreview" src
="(.+?)"',
54 description = self._html_search_regex(r'<td
class="infodropdown".*?
<div
>(.*?
)<ul
',
55 webpage, 'description
', flags=re.DOTALL)
63 'uploader_id
': uploader_id,
64 'thumbnail
': thumbnail,
65 'description
': description,