2 from __future__ import unicode_literals
6 from .common import InfoExtractor
18 class VideaIE(InfoExtractor):
19 _VALID_URL = r'https?://(?:.+?\.)?videa\.hu/videok/(?P<id>[^#?]+)'
21 'url': 'http://videa.hu/videok/allatok/az-orult-kigyasz-285-kigyot-kigyo-8YfIAjxwWGwT8HVQ',
22 'md5': '97a7af41faeaffd9f1fc864a7c7e7603',
24 'id': '8YfIAjxwWGwT8HVQ',
25 'display_id': '8YfIAjxwWGwT8HVQ',
27 'title': 'Az őrült kígyász 285 kígyót enged szabadon',
28 'thumbnail': 'http://videa.hu/static/still/1.4.1.1007274.1204470.3',
32 'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
33 'only_matching': True,
36 def _real_extract(self, url):
37 video_id = self._match_id(url)
39 video_data = self._download_json("http://videa.hu/oembed/?" + urlencode_postdata({"url": url.split('?')[0], "format": "json"}), video_id)
40 video_url = self._search_regex(
41 r'src="(.+?)"', video_data.get('html'), 'embed url')
44 '_type': 'url_transparent',
46 'ie_key': 'VideaEmbed'
49 class VideaEmbedIE(InfoExtractor):
50 _VALID_URL = r'(?P<protocol>https?:)(?P<baseurl>//(?:.+?\.)?videa\.hu)/player(?:\?v=|/v/)(?P<id>[^/#?]+)';
52 'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ',
53 'md5': '97a7af41faeaffd9f1fc864a7c7e7603',
55 'id': '8YfIAjxwWGwT8HVQ',
57 'title': 'Az őrült kígyász 285 kígyót enged szabadon',
58 'thumbnail': 'http://videa.hu/static/still/1.4.1.1007274.1204470.3',
62 'url': 'http://videa.hu/player?v=jAHDWfWSJH5XuFhH',
63 'only_matching': True,
67 def _extract_url(webpage):
69 r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:.+?\.)?videa\.hu/player(?:\?v=|/v/)[^/#?]+)\1',
72 return mobj.group('url')
74 def _real_extract(self, url):
75 protocol, base_url, display_id = re.search(self._VALID_URL, url).groups()
76 xml = self._download_xml(protocol + base_url + "/flvplayer_get_video_xml.php?v=" + display_id, display_id)
80 for xml_media in xml.findall('video') + xml.findall('audio'):
81 media_url = protocol + xpath_attr(xml_media, 'versions/version', 'video_url')
85 'title': xpath_text(xml_media, 'title', 'title', True),
86 'duration': parse_duration(xpath_text(xml_media, 'duration')),
87 'thumbnail': protocol + xpath_text(xml_media, 'still', 'still', True),
93 self._downloader.report_warning(
94 'found multiple medias; please '
95 'report this with the video URL to http://yt-dl.org/bug')
97 raise ExtractorError('No media entries found')