[extractor/youku] Improve error message (#6690)

Authored by: carusocr
Closes #6551
This commit is contained in:
Chris Caruso 2023-04-11 04:45:22 -07:00 committed by GitHub
parent 0a6918a4a1
commit ef0848abd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import time
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
clean_html,
get_element_by_class, get_element_by_class,
js_to_json, js_to_json,
str_or_none, str_or_none,
@ -26,48 +27,8 @@ class YoukuIE(InfoExtractor):
''' '''
_TESTS = [{ _TESTS = [{
# MD5 is unstable
'url': 'http://v.youku.com/v_show/id_XMTc1ODE5Njcy.html',
'info_dict': {
'id': 'XMTc1ODE5Njcy',
'title': '★Smile﹗♡ Git Fresh -Booty Music舞蹈.',
'ext': 'mp4',
'duration': 74.73,
'thumbnail': r're:^https?://.*',
'uploader': '。躲猫猫、',
'uploader_id': '36017967',
'uploader_url': 'http://i.youku.com/u/UMTQ0MDcxODY4',
'tags': list,
}
}, {
'url': 'http://player.youku.com/player.php/sid/XNDgyMDQ2NTQw/v.swf', 'url': 'http://player.youku.com/player.php/sid/XNDgyMDQ2NTQw/v.swf',
'only_matching': True, 'only_matching': True,
}, {
'url': 'http://v.youku.com/v_show/id_XODgxNjg1Mzk2_ev_1.html',
'info_dict': {
'id': 'XODgxNjg1Mzk2',
'ext': 'mp4',
'title': '武媚娘传奇 85',
'duration': 1999.61,
'thumbnail': r're:^https?://.*',
'uploader': '疯狂豆花',
'uploader_id': '62583473',
'uploader_url': 'http://i.youku.com/u/UMjUwMzMzODky',
'tags': list,
},
}, {
'url': 'http://v.youku.com/v_show/id_XMTI1OTczNDM5Mg==.html',
'info_dict': {
'id': 'XMTI1OTczNDM5Mg',
'ext': 'mp4',
'title': '花千骨 04',
'duration': 2363,
'thumbnail': r're:^https?://.*',
'uploader': '放剧场-花千骨',
'uploader_id': '772849359',
'uploader_url': 'http://i.youku.com/u/UMzA5MTM5NzQzNg==',
'tags': list,
},
}, { }, {
'url': 'http://v.youku.com/v_show/id_XNjA1NzA2Njgw.html', 'url': 'http://v.youku.com/v_show/id_XNjA1NzA2Njgw.html',
'note': 'Video protected with password', 'note': 'Video protected with password',
@ -81,6 +42,7 @@ class YoukuIE(InfoExtractor):
'uploader_id': '322014285', 'uploader_id': '322014285',
'uploader_url': 'http://i.youku.com/u/UMTI4ODA1NzE0MA==', 'uploader_url': 'http://i.youku.com/u/UMTI4ODA1NzE0MA==',
'tags': list, 'tags': list,
'skip': '404',
}, },
'params': { 'params': {
'videopassword': '100600', 'videopassword': '100600',
@ -192,7 +154,7 @@ class YoukuIE(InfoExtractor):
else: else:
msg = 'Youku server reported error %i' % error.get('code') msg = 'Youku server reported error %i' % error.get('code')
if error_note is not None: if error_note is not None:
msg += ': ' + error_note msg += ': ' + clean_html(error_note)
raise ExtractorError(msg) raise ExtractorError(msg)
# get video title # get video title