]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/veehd.py
b1c854a646c601d4dadaa1dce7fab8d6fc315b3d
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',
19 'file': '4686958.mp4',
21 'title': 'Time Lapse View from Space ( ISS)',
22 'uploader_id': 'spotted',
23 'description': 'md5:f0094c4cf3a72e22bc4e4239ef767ad7',
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
31 # VeeHD seems to send garbage on the first request.
32 # See https://github.com/rg3/youtube-dl/issues/2102
33 self
._download
_webpage
(url
, video_id
, 'Requesting webpage')
34 webpage
= self
._download
_webpage
(url
, video_id
)
35 player_path
= self
._search
_regex
(
36 r
'\$\("#playeriframe"\).attr\({src : "(.+?)"',
37 webpage
, 'player path')
38 player_url
= compat_urlparse
.urljoin(url
, player_path
)
40 self
._download
_webpage
(player_url
, video_id
, 'Requesting player page')
41 player_page
= self
._download
_webpage
(
42 player_url
, video_id
, 'Downloading player page')
43 config_json
= self
._search
_regex
(
44 r
'value=\'config
=({.+?
})\'', player_page, 'config json
')
45 config = json.loads(config_json)
47 video_url = compat_urlparse.unquote(config['clip
']['url
'])
48 title = clean_html(get_element_by_id('videoName
', webpage).rpartition('|
')[0])
49 uploader_id = self._html_search_regex(r'<a href
="/profile/\d+">(.+?
)</a
>',
51 thumbnail = self._search_regex(r'<img
id="veehdpreview" src
="(.+?)"',
53 description = self._html_search_regex(r'<td
class="infodropdown".*?
<div
>(.*?
)<ul
',
54 webpage, 'description
', flags=re.DOTALL)
62 'uploader_id
': uploader_id,
63 'thumbnail
': thumbnail,
64 'description
': description,