]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vidme.py
e0b55078b2c9af8bf654ee6cd6982305074cb39b
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
11 class VidmeIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://vid\.me/(?:e/)?(?P<id>[\da-zA-Z]+)'
14 'url': 'https://vid.me/QNB',
15 'md5': 'f42d05e7149aeaec5c037b17e5d3dc82',
19 'title': 'Fishing for piranha - the easy way',
20 'description': 'source: https://www.facebook.com/photo.php?v=312276045600871',
22 'timestamp': 1406313244,
23 'upload_date': '20140725',
24 'thumbnail': 're:^https?://.*\.jpg',
27 # From http://naked-yogi.tumblr.com/post/118312946248/naked-smoking-stretching
28 'url': 'https://vid.me/e/Wmur',
29 'only_matching': True,
32 def _real_extract(self
, url
):
33 url
= url
.replace('vid.me/e/', 'vid.me/')
34 video_id
= self
._match
_id
(url
)
35 webpage
= self
._download
_webpage
(url
, video_id
)
37 video_url
= self
._html
_search
_regex
(
38 r
'<source src="([^"]+)"', webpage
, 'video URL')
40 title
= self
._og
_search
_title
(webpage
)
41 description
= self
._og
_search
_description
(webpage
, default
='')
42 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
43 timestamp
= int_or_none(self
._og
_search
_property
('updated_time', webpage
, fatal
=False))
44 width
= int_or_none(self
._og
_search
_property
('video:width', webpage
, fatal
=False))
45 height
= int_or_none(self
._og
_search
_property
('video:height', webpage
, fatal
=False))
46 duration
= float_or_none(self
._html
_search
_regex
(
47 r
'data-duration="([^"]+)"', webpage
, 'duration', fatal
=False))
48 view_count
= str_to_int(self
._html
_search
_regex
(
49 r
'<(?:li|span) class="video_views">\s*([\d,\.]+)\s*plays?', webpage
, 'view count', fatal
=False))
50 like_count
= str_to_int(self
._html
_search
_regex
(
51 r
'class="score js-video-vote-score"[^>]+data-score="([\d,\.\s]+)">',
52 webpage
, 'like count', fatal
=False))
58 'description': description
,
59 'thumbnail': thumbnail
,
60 'timestamp': timestamp
,
64 'view_count': view_count
,
65 'like_count': like_count
,