]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/snotr.py
da3b05a8dc8ca89345e755225ed7885fa580c973
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class SnotrIE(InfoExtractor
):
15 _VALID_URL
= r
'http?://(?:www\.)?snotr\.com/video/(?P<id>\d+)/([\w]+)'
17 'url': 'http://www.snotr.com/video/13708/Drone_flying_through_fireworks',
21 'title': 'Drone flying through fireworks!',
23 'filesize_approx': 98566144,
24 'description': 'A drone flying through Fourth of July Fireworks',
27 'url': 'http://www.snotr.com/video/530/David_Letteman_-_George_W_Bush_Top_10',
31 'title': 'David Letteman - George W. Bush Top 10',
33 'filesize_approx': 8912896,
34 'description': 'The top 10 George W. Bush moments, brought to you by David Letterman!',
38 def _real_extract(self
, url
):
39 mobj
= re
.match(self
._VALID
_URL
, url
)
40 video_id
= mobj
.group('id')
42 webpage
= self
._download
_webpage
(url
, video_id
)
43 title
= self
._og
_search
_title
(webpage
)
45 description
= self
._og
_search
_description
(webpage
)
46 video_url
= "http://cdn.videos.snotr.com/%s.flv" % video_id
48 view_count
= str_to_int(self
._html
_search
_regex
(
49 r
'<p>\n<strong>Views:</strong>\n([\d,\.]+)</p>',
50 webpage
, 'view count', fatal
=False))
52 duration
= parse_duration(self
._html
_search
_regex
(
53 r
'<p>\n<strong>Length:</strong>\n\s*([0-9:]+).*?</p>',
54 webpage
, 'duration', fatal
=False))
56 filesize_approx
= float_or_none(self
._html
_search
_regex
(
57 r
'<p>\n<strong>Filesize:</strong>\n\s*([0-9.]+)\s*megabyte</p>',
58 webpage
, 'filesize', fatal
=False), invscale
=1024 * 1024)
62 'description': description
,
65 'view_count': view_count
,
67 'filesize_approx': filesize_approx
,