X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/46113edab215c2211a604c06245c16d5d4e57dcf..eed74133841b43ce901ee0dd31c7dad5a234bd48:/youtube_dl/extractor/freevideo.py diff --git a/youtube_dl/extractor/freevideo.py b/youtube_dl/extractor/freevideo.py new file mode 100644 index 0000000..f755e3c --- /dev/null +++ b/youtube_dl/extractor/freevideo.py @@ -0,0 +1,38 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ExtractorError + + +class FreeVideoIE(InfoExtractor): + _VALID_URL = r'^http://www.freevideo.cz/vase-videa/(?P[^.]+)\.html(?:$|[?#])' + + _TEST = { + 'url': 'http://www.freevideo.cz/vase-videa/vysukany-zadecek-22033.html', + 'info_dict': { + 'id': 'vysukany-zadecek-22033', + 'ext': 'mp4', + "title": "vysukany-zadecek-22033", + "age_limit": 18, + }, + 'skip': 'Blocked outside .cz', + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage, handle = self._download_webpage_handle(url, video_id) + if '//www.czechav.com/' in handle.geturl(): + raise ExtractorError( + 'Access to freevideo is blocked from your location', + expected=True) + + video_url = self._search_regex( + r'\s+url: "(http://[a-z0-9-]+.cdn.freevideo.cz/stream/.*?/video.mp4)"', + webpage, 'video URL') + + return { + 'id': video_id, + 'url': video_url, + 'title': video_id, + 'age_limit': 18, + }