diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 1c53a5632..638678edc 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -731,6 +731,7 @@ from .viki import ( VikiIE, VikiChannelIE, ) +from .vivo import VivoIE from .vk import ( VKIE, VKUserVideosIE, diff --git a/youtube_dl/extractor/vivo.py b/youtube_dl/extractor/vivo.py new file mode 100644 index 000000000..2d26d50a0 --- /dev/null +++ b/youtube_dl/extractor/vivo.py @@ -0,0 +1,49 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +from ..compat import ( + compat_urllib_parse, + compat_urllib_request, +) + +import re + +class VivoIE(InfoExtractor): + _VALID_URL = r'http://(?:www\.)?vivo\.sx/(?P[a-f0-9]{10})' + _TEST = { + 'url': 'http://vivo.sx/d7ddda0e78', + 'md5': '2f36fed6235b16da96ce9b4dc890940d', + 'info_dict': { + 'id': 'd7ddda0e78', + 'ext': 'mp4', + 'title': 'Chicken', + 'alt_title': 'Chicken', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + url = 'http://vivo.sx/%s' % video_id + + webpage = self._download_webpage(url, video_id) + + # self._sleep(7, video_id) + + headers = { + b'Content-Type': b'application/x-www-form-urlencoded', + } + post = compat_urllib_parse.urlencode(self._hidden_inputs(webpage)) + req = compat_urllib_request.Request(url, post, headers) + webpage = self._download_webpage(req, video_id, note='Downloading video page ...') + + m = re.search(r'
', webpage) + + return { + 'id': video_id, + 'title': m.group("title"), + 'alt_title': m.group("name"), + 'url' : m.group("url"), + 'ext': 'mp4', + }