]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vidme.py
5c89824c164272358923e245e60a4f86466287c4
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class VidmeIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://vid\.me/(?:e/)?(?P<id>[\da-zA-Z]+)'
16 'url': 'https://vid.me/QNB',
17 'md5': 'f42d05e7149aeaec5c037b17e5d3dc82',
21 'title': 'Fishing for piranha - the easy way',
22 'description': 'source: https://www.facebook.com/photo.php?v=312276045600871',
24 'timestamp': 1406313244,
25 'upload_date': '20140725',
26 'thumbnail': 're:^https?://.*\.jpg',
30 def _real_extract(self
, url
):
31 mobj
= re
.match(self
._VALID
_URL
, url
)
32 video_id
= mobj
.group('id')
34 webpage
= self
._download
_webpage
(url
, video_id
)
36 video_url
= self
._html
_search
_regex
(r
'<source src="([^"]+)"', webpage
, 'video URL')
38 title
= self
._og
_search
_title
(webpage
)
39 description
= self
._og
_search
_description
(webpage
, default
='')
40 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
41 timestamp
= int_or_none(self
._og
_search
_property
('updated_time', webpage
, fatal
=False))
42 width
= int_or_none(self
._og
_search
_property
('video:width', webpage
, fatal
=False))
43 height
= int_or_none(self
._og
_search
_property
('video:height', webpage
, fatal
=False))
44 duration
= float_or_none(self
._html
_search
_regex
(
45 r
'data-duration="([^"]+)"', webpage
, 'duration', fatal
=False))
46 view_count
= str_to_int(self
._html
_search
_regex
(
47 r
'<span class="video_views">\s*([\d,\.]+)\s*plays?', webpage
, 'view count', fatal
=False))
48 like_count
= str_to_int(self
._html
_search
_regex
(
49 r
'class="score js-video-vote-score"[^>]+data-score="([\d,\.\s]+)">',
50 webpage
, 'like count', fatal
=False))
51 comment_count
= str_to_int(self
._html
_search
_regex
(
52 r
'class="js-comment-count"[^>]+data-count="([\d,\.\s]+)">',
53 webpage
, 'comment count', fatal
=False))
59 'description': description
,
60 'thumbnail': thumbnail
,
61 'timestamp': timestamp
,
65 'view_count': view_count
,
66 'like_count': like_count
,
67 'comment_count': comment_count
,