[videa] Fix some extraction errors (#1028)

Authored by: nyuszika7h
pull/1035/head
nyuszika7h 3 years ago committed by GitHub
parent 57aa7b8511
commit 4762621925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,10 +47,24 @@ class VideaIE(InfoExtractor):
}, },
}, { }, {
'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH', 'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
'only_matching': True, 'md5': 'd57ccd8812c7fd491d33b1eab8c99975',
'info_dict': {
'id': 'jAHDWfWSJH5XuFhH',
'ext': 'mp4',
'title': 'Supercars előzés',
'thumbnail': r're:^https?://.*',
'duration': 64,
},
}, { }, {
'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ', 'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ',
'only_matching': True, 'md5': '97a7af41faeaffd9f1fc864a7c7e7603',
'info_dict': {
'id': '8YfIAjxwWGwT8HVQ',
'ext': 'mp4',
'title': 'Az őrült kígyász 285 kígyót enged szabadon',
'thumbnail': r're:^https?://.*',
'duration': 21,
},
}, { }, {
'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1', 'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1',
'only_matching': True, 'only_matching': True,
@ -100,10 +114,14 @@ class VideaIE(InfoExtractor):
video_page = self._download_webpage(url, video_id) video_page = self._download_webpage(url, video_id)
player_url = self._search_regex( if 'videa.hu/player' in url:
r'<iframe.*?src="(/player\?[^"]+)"', video_page, 'player url') player_url = url
player_url = urljoin(url, player_url) player_page = video_page
player_page = self._download_webpage(player_url, video_id) else:
player_url = self._search_regex(
r'<iframe.*?src="(/player\?[^"]+)"', video_page, 'player url')
player_url = urljoin(url, player_url)
player_page = self._download_webpage(player_url, video_id)
nonce = self._search_regex( nonce = self._search_regex(
r'_xt\s*=\s*"([^"]+)"', player_page, 'nonce') r'_xt\s*=\s*"([^"]+)"', player_page, 'nonce')
@ -134,7 +152,7 @@ class VideaIE(InfoExtractor):
sources = xpath_element( sources = xpath_element(
info, './video_sources', 'sources', fatal=True) info, './video_sources', 'sources', fatal=True)
hash_values = xpath_element( hash_values = xpath_element(
info, './hash_values', 'hash values', fatal=True) info, './hash_values', 'hash values', fatal=False)
title = xpath_text(video, './title', fatal=True) title = xpath_text(video, './title', fatal=True)
@ -143,15 +161,16 @@ class VideaIE(InfoExtractor):
source_url = source.text source_url = source.text
source_name = source.get('name') source_name = source.get('name')
source_exp = source.get('exp') source_exp = source.get('exp')
if not (source_url and source_name and source_exp): if not (source_url and source_name):
continue continue
hash_value = xpath_text(hash_values, 'hash_value_' + source_name) hash_value = None
if not hash_value: if hash_values:
continue hash_value = xpath_text(hash_values, 'hash_value_' + source_name)
source_url = update_url_query(source_url, { if hash_value and source_exp:
'md5': hash_value, source_url = update_url_query(source_url, {
'expires': source_exp, 'md5': hash_value,
}) 'expires': source_exp,
})
f = parse_codecs(source.get('codecs')) f = parse_codecs(source.get('codecs'))
f.update({ f.update({
'url': self._proto_relative_url(source_url), 'url': self._proto_relative_url(source_url),

Loading…
Cancel
Save