Youku: error_code -8 (mainland-only video)

This commit is contained in:
Mort Yao 2014-07-30 04:09:47 +02:00
parent f4e28d77f2
commit 18ff097597

View File

@ -62,6 +62,11 @@ class Youku(VideoExtractor):
log.wtf('[Failed] Video not found.')
metadata0 = meta['data'][0]
if 'error_code' in metadata0 and metadata0['error_code']:
if metadata0['error_code'] == -8:
log.w('[Warning] This video can only be streamed within Mainland China!')
log.w('Use \'-y\' to specify a proxy server for extracting stream data.\n')
self.title = metadata0['title']
if 'dvd' in metadata0 and 'audiolang' in metadata0['dvd']:
@ -96,10 +101,7 @@ class Youku(VideoExtractor):
m3u8_url = "http://v.youku.com/player/getM3U8/vid/{vid}/type/{stream_id}/video.m3u8".format(vid=self.vid, stream_id=stream_id)
m3u8 = get_html(m3u8_url)
if not m3u8:
log.w('[Warning] This video can only be streamed within Mainland China!')
log.w('Use \'-y\' to specify a proxy server for extracting stream data.\n')
if m3u8:
self.streams[stream_id]['src'] = __class__.parse_m3u8(m3u8)
site = Youku()