]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/snotr.py
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': 40700000,
24 'description': 'A drone flying through Fourth of July Fireworks',
25 'thumbnail': 're:^https?://.*\.jpg$',
27 'expected_warnings': ['description'],
29 'url': 'http://www.snotr.com/video/530/David_Letteman_-_George_W_Bush_Top_10',
33 'title': 'David Letteman - George W. Bush Top 10',
35 'filesize_approx': 8500000,
36 'description': 'The top 10 George W. Bush moments, brought to you by David Letterman!',
37 'thumbnail': 're:^https?://.*\.jpg$',
41 def _real_extract(self
, url
):
42 mobj
= re
.match(self
._VALID
_URL
, url
)
43 video_id
= mobj
.group('id')
45 webpage
= self
._download
_webpage
(url
, video_id
)
46 title
= self
._og
_search
_title
(webpage
)
48 description
= self
._og
_search
_description
(webpage
)
49 info_dict
= self
._parse
_html
5_media
_entries
(
50 url
, webpage
, video_id
, m3u8_entry_protocol
='m3u8_native')[0]
52 view_count
= str_to_int(self
._html
_search
_regex
(
53 r
'<p[^>]*>\s*<strong[^>]*>Views:</strong>\s*<span[^>]*>([\d,\.]+)',
54 webpage
, 'view count', fatal
=False))
56 duration
= parse_duration(self
._html
_search
_regex
(
57 r
'<p[^>]*>\s*<strong[^>]*>Length:</strong>\s*<span[^>]*>([\d:]+)',
58 webpage
, 'duration', fatal
=False))
60 filesize_approx
= parse_filesize(self
._html
_search
_regex
(
61 r
'<p[^>]*>\s*<strong[^>]*>Filesize:</strong>\s*<span[^>]*>([^<]+)',
62 webpage
, 'filesize', fatal
=False))
66 'description': description
,
68 'view_count': view_count
,
70 'filesize_approx': filesize_approx
,