mirror of
https://github.com/l1ving/youtube-dl
synced 2024-11-22 16:17:50 +08:00
[crunchyroll] Handle error message
This commit is contained in:
parent
70cb73922b
commit
1d430674c7
@ -2,6 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
import base64
|
import base64
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
@ -113,6 +114,12 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
if note_m:
|
if note_m:
|
||||||
raise ExtractorError(note_m)
|
raise ExtractorError(note_m)
|
||||||
|
|
||||||
|
mobj = re.search(r'Page\.messaging_box_controller\.addItems\(\[(?P<msg>{.+?})\]\)', webpage)
|
||||||
|
if mobj:
|
||||||
|
msg = json.loads(mobj.group('msg'))
|
||||||
|
if msg.get('type') == 'error':
|
||||||
|
raise ExtractorError('crunchyroll returned error: %s' % msg['message_body'], expected=True)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<h1[^>]*>(.+?)</h1>', webpage, 'video_title', flags=re.DOTALL)
|
video_title = self._html_search_regex(r'<h1[^>]*>(.+?)</h1>', webpage, 'video_title', flags=re.DOTALL)
|
||||||
video_title = re.sub(r' {2,}', ' ', video_title)
|
video_title = re.sub(r' {2,}', ' ', video_title)
|
||||||
video_description = self._html_search_regex(r'"description":"([^"]+)', webpage, 'video_description', default='')
|
video_description = self._html_search_regex(r'"description":"([^"]+)', webpage, 'video_description', default='')
|
||||||
|
Loading…
Reference in New Issue
Block a user