[videa] Add new extractor

This commit is contained in:
pnc 2016-01-08 09:58:41 +01:00
parent 5dbe81a1d3
commit 94f4ea4475
2 changed files with 56 additions and 0 deletions

View File

@ -788,6 +788,7 @@ from .vgtv import (
from .vh1 import VH1IE
from .vice import ViceIE
from .viddler import ViddlerIE
from .videa import VideaIE
from .videodetective import VideoDetectiveIE
from .videofyme import VideofyMeIE
from .videomega import VideoMegaIE

View File

@ -0,0 +1,55 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
)
class VideaIE(InfoExtractor):
_VALID_URL = r'https?://videa\.hu/videok/(.+?)/?(?P<id>\d+)'
IE_NAME = 'videa.hu'
_TEST = {
'url': 'http://videa.hu/videok/kreativ/igy-lehet-nekimenni-a-hosegnek-ballon-hoseg-CZqIVSVYfJKf9bHC',
'md5': 'e9a24350bbd485746d23519319949e72',
'info_dict': {
'id': 'CZqIVSVYfJKf9bHC',
'ext': '1150387',
'title': 'Így lehet nekimenni a hőségnek',
'description': '',
'uploader': 'viktoratakarító',
}
}
def _real_extract(self, url):
# the last part of the slug is the real video hash id
video_id = self._search_regex(r'([A-Za-z0-9]+)$', url, 'video id')
info_data = compat_urllib_parse.urlencode({
'format': 'json',
'url': url,
})
# access the oembed data for video infos
info = self._download_json(
'http://videa.hu/oembed/?url=%s&format=json' % info_data, url, 'Downloading video info')
# get the player xmldata for the video file url
flvplayer = self._download_xml(
'http://videa.hu/flvplayer_get_video_xml.php?v=%s' % video_id, 'Downloading player datas')
duration = flvplayer.find('./video/duration').text;
values = flvplayer.find('./video/versions').text;
for elem in flvplayer.findall('video/versions/version'):
video_url = elem.get('video_url')
return {
'id': video_id,
'title': info['title'],
'url': video_url,
'thumbnail': info['thumbnail_url'],
'description': '',
'uploader': info['author_name'],
}