]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vidme.py
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',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
32 video_url
= self
._html
_search
_regex
(
33 r
'<source src="([^"]+)"', webpage
, 'video URL')
35 title
= self
._og
_search
_title
(webpage
)
36 description
= self
._og
_search
_description
(webpage
, default
='')
37 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
38 timestamp
= int_or_none(self
._og
_search
_property
('updated_time', webpage
, fatal
=False))
39 width
= int_or_none(self
._og
_search
_property
('video:width', webpage
, fatal
=False))
40 height
= int_or_none(self
._og
_search
_property
('video:height', webpage
, fatal
=False))
41 duration
= float_or_none(self
._html
_search
_regex
(
42 r
'data-duration="([^"]+)"', webpage
, 'duration', fatal
=False))
43 view_count
= str_to_int(self
._html
_search
_regex
(
44 r
'<(?:li|span) class="video_views">\s*([\d,\.]+)\s*plays?', webpage
, 'view count', fatal
=False))
45 like_count
= str_to_int(self
._html
_search
_regex
(
46 r
'class="score js-video-vote-score"[^>]+data-score="([\d,\.\s]+)">',
47 webpage
, 'like count', fatal
=False))
53 'description': description
,
54 'thumbnail': thumbnail
,
55 'timestamp': timestamp
,
59 'view_count': view_count
,
60 'like_count': like_count
,