]>
jfr.im git - yt-dlp.git/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',
29 # tests uploader field
30 'url': 'https://vid.me/4Iib',
34 'title': 'The Carver',
35 'description': 'md5:e9c24870018ae8113be936645b93ba3c',
36 'duration': 97.859999999999999,
37 'timestamp': 1433203629,
38 'upload_date': '20150602',
40 'thumbnail': 're:^https?://.*\.jpg',
45 'skip_download': True,
48 # From http://naked-yogi.tumblr.com/post/118312946248/naked-smoking-stretching
49 'url': 'https://vid.me/e/Wmur',
50 'only_matching': True,
53 def _real_extract(self
, url
):
54 url
= url
.replace('vid.me/e/', 'vid.me/')
55 video_id
= self
._match
_id
(url
)
56 webpage
= self
._download
_webpage
(url
, video_id
)
58 video_url
= self
._html
_search
_regex
(
59 r
'<source src="([^"]+)"', webpage
, 'video URL')
61 title
= self
._og
_search
_title
(webpage
)
62 description
= self
._og
_search
_description
(webpage
, default
='')
63 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
64 timestamp
= int_or_none(self
._og
_search
_property
(
65 'updated_time', webpage
, fatal
=False))
66 width
= int_or_none(self
._og
_search
_property
(
67 'video:width', webpage
, fatal
=False))
68 height
= int_or_none(self
._og
_search
_property
(
69 'video:height', webpage
, fatal
=False))
70 duration
= float_or_none(self
._html
_search
_regex
(
71 r
'data-duration="([^"]+)"', webpage
, 'duration', fatal
=False))
72 view_count
= str_to_int(self
._html
_search
_regex
(
73 r
'<(?:li|span) class="video_views">\s*([\d,\.]+)\s*plays?',
74 webpage
, 'view count', fatal
=False))
75 like_count
= str_to_int(self
._html
_search
_regex
(
76 r
'class="score js-video-vote-score"[^>]+data-score="([\d,\.\s]+)">',
77 webpage
, 'like count', fatal
=False))
78 uploader
= self
._html
_search
_regex
(
79 'class="video_author_username"[^>]*>([^<]+)',
80 webpage
, 'uploader', default
=None)
86 'description': description
,
87 'thumbnail': thumbnail
,
88 'timestamp': timestamp
,
92 'view_count': view_count
,
93 'like_count': like_count
,