]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videa.py
311df58f4a057ecfd128e76ebfe6f5a692ea0c23
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
16 class VideaIE(InfoExtractor
):
21 videok/(?:[^/]+/)*[^?#&]+-|
28 'url': 'http://videa.hu/videok/allatok/az-orult-kigyasz-285-kigyot-kigyo-8YfIAjxwWGwT8HVQ',
29 'md5': '97a7af41faeaffd9f1fc864a7c7e7603',
31 'id': '8YfIAjxwWGwT8HVQ',
33 'title': 'Az őrült kígyász 285 kígyót enged szabadon',
34 'thumbnail': 'http://videa.hu/static/still/1.4.1.1007274.1204470.3',
38 'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
39 'only_matching': True,
41 'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ',
42 'only_matching': True,
44 'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1',
45 'only_matching': True,
49 def _extract_urls(webpage
):
50 return [url
for _
, url
in re
.findall(
51 r
'<iframe[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//videa\
.hu
/player
\?.*?
\bv
=.+?
)\
1',
54 def _real_extract(self, url):
55 video_id = self._match_id(url)
57 info = self._download_xml(
58 'http
://videa
.hu
/videaplayer_get_xml
.php
', video_id,
59 query={'v
': video_id})
61 video = xpath_element(info, './/video
', 'video
', fatal=True)
62 sources = xpath_element(info, './/video_sources
', 'sources
', fatal=True)
64 title = xpath_text(video, './title
', fatal=True)
67 for source in sources.findall('./video_source
'):
68 source_url = source.text
71 f = parse_codecs(source.get('codecs
'))
74 'ext
': mimetype2ext(source.get('mimetype
')) or 'mp4
',
75 'format_id
': source.get('name
'),
76 'width
': int_or_none(source.get('width
')),
77 'height
': int_or_none(source.get('height
')),
80 self._sort_formats(formats)
82 thumbnail = xpath_text(video, './poster_src
')
83 duration = int_or_none(xpath_text(video, './duration
'))
86 is_adult = xpath_text(video, './is_adult_content
', default=None)
88 age_limit = 18 if is_adult == '1' else 0
93 'thumbnail
': thumbnail,
95 'age_limit
': age_limit,