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,
26 'url': 'http://www.snotr.com/video/530/David_Letteman_-_George_W_Bush_Top_10',
30 'title': 'David Letteman - George W. Bush Top 10',
32 'filesize_approx': 8912896,
36 def _real_extract(self, url):
37 mobj = re.match(self._VALID_URL, url)
38 video_id = mobj.group('id')
40 webpage = self._download_webpage(url, video_id)
41 title = self._og_search_title(webpage)
43 description = self._og_search_description(webpage)
45 video_url = "http://cdn.videos.snotr.com/%s.flv" % video_id
47 view_count = str_to_int(self._html_search_regex(
48 r'<p>\n<strong>Views:</strong>\n([\d,\.]+)</p>',
49 webpage, 'view count', fatal=False))
51 duration = parse_duration(self._html_search_regex(
52 r'<p>\n<strong>Length:</strong>\n\s*([0-9:]+).*?</p>',
53 webpage, 'duration', fatal=False))
55 filesize_approx = float_or_none(self._html_search_regex(
56 r'<p>\n<strong>Filesize:</strong>\n\s*([0-9.]+)\s*megabyte</p>',
57 webpage, 'filesize', fatal=False), invscale=1024 * 1024)
63 'view_count': view_count,
65 'filesize_approx': filesize_approx,