]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/freevideo.py
Imported Upstream version 2016.06.25
[youtubedl] / youtube_dl / extractor / freevideo.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import ExtractorError
5
6
7 class FreeVideoIE(InfoExtractor):
8 _VALID_URL = r'^https?://www.freevideo.cz/vase-videa/(?P<id>[^.]+)\.html(?:$|[?#])'
9
10 _TEST = {
11 'url': 'http://www.freevideo.cz/vase-videa/vysukany-zadecek-22033.html',
12 'info_dict': {
13 'id': 'vysukany-zadecek-22033',
14 'ext': 'mp4',
15 'title': 'vysukany-zadecek-22033',
16 'age_limit': 18,
17 },
18 'skip': 'Blocked outside .cz',
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage, handle = self._download_webpage_handle(url, video_id)
24 if '//www.czechav.com/' in handle.geturl():
25 raise ExtractorError(
26 'Access to freevideo is blocked from your location',
27 expected=True)
28
29 video_url = self._search_regex(
30 r'\s+url: "(http://[a-z0-9-]+.cdn.freevideo.cz/stream/.*?/video.mp4)"',
31 webpage, 'video URL')
32
33 return {
34 'id': video_id,
35 'url': video_url,
36 'title': video_id,
37 'age_limit': 18,
38 }