[vivo] Add new extractor
This commit is contained in:
parent
8c97f81943
commit
ab1e9a2b68
@ -731,6 +731,7 @@ from .viki import (
|
|||||||
VikiIE,
|
VikiIE,
|
||||||
VikiChannelIE,
|
VikiChannelIE,
|
||||||
)
|
)
|
||||||
|
from .vivo import VivoIE
|
||||||
from .vk import (
|
from .vk import (
|
||||||
VKIE,
|
VKIE,
|
||||||
VKUserVideosIE,
|
VKUserVideosIE,
|
||||||
|
49
youtube_dl/extractor/vivo.py
Normal file
49
youtube_dl/extractor/vivo.py
Normal file
@ -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<id>[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'<div class="stream-content" data-url="(?P<url>.+?)" data-name="(?P<name>.*?)(?:\.mp4)?" data-title="(?P<title>.*?)(?:\.mp4)?".*?>', webpage)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': m.group("title"),
|
||||||
|
'alt_title': m.group("name"),
|
||||||
|
'url' : m.group("url"),
|
||||||
|
'ext': 'mp4',
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user