]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videa.py
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': r
're:^https?://.*',
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,
47 'url': 'https://videakid.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
48 'only_matching': True,
50 'url': 'https://videakid.hu/player?v=8YfIAjxwWGwT8HVQ',
51 'only_matching': True,
53 'url': 'https://videakid.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1',
54 'only_matching': True,
58 def _extract_urls(webpage
):
59 return [url
for _
, url
in re
.findall(
60 r
'<iframe[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//videa\
.hu
/player
\?.*?
\bv
=.+?
)\
1',
63 def _real_extract(self, url):
64 video_id = self._match_id(url)
66 info = self._download_xml(
67 'http
://videa
.hu
/videaplayer_get_xml
.php
', video_id,
68 query={'v
': video_id})
70 video = xpath_element(info, './/video
', 'video
', fatal=True)
71 sources = xpath_element(info, './/video_sources
', 'sources
', fatal=True)
73 title = xpath_text(video, './title
', fatal=True)
76 for source in sources.findall('./video_source
'):
77 source_url = source.text
80 f = parse_codecs(source.get('codecs
'))
83 'ext
': mimetype2ext(source.get('mimetype
')) or 'mp4
',
84 'format_id
': source.get('name
'),
85 'width
': int_or_none(source.get('width
')),
86 'height
': int_or_none(source.get('height
')),
89 self._sort_formats(formats)
91 thumbnail = xpath_text(video, './poster_src
')
92 duration = int_or_none(xpath_text(video, './duration
'))
95 is_adult = xpath_text(video, './is_adult_content
', default=None)
97 age_limit = 18 if is_adult == '1' else 0
102 'thumbnail
': thumbnail,
103 'duration
': duration,
104 'age_limit
': age_limit,