mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
Youku: fix #352
This commit is contained in:
parent
6ac6f936a1
commit
78f5e1b6b1
@ -989,7 +989,10 @@ class VideoExtractor():
|
||||
print(" - id: \033[7m%s\033[0m" % stream_id)
|
||||
print(" container: %s" % stream['container'])
|
||||
print(" video-profile: %s" % stream['video_profile'])
|
||||
print(" size: %s MiB (%s bytes)" % (round(stream['size'] / 1048576, 1), stream['size']))
|
||||
if 'size' in stream:
|
||||
print(" size: %s MiB (%s bytes)" % (round(stream['size'] / 1048576, 1), stream['size']))
|
||||
else:
|
||||
print(" size: Unknown")
|
||||
#print(" # download-with: \033[4myou-get --stream=%s\033[0m" % stream_id)
|
||||
print()
|
||||
|
||||
|
@ -10,6 +10,7 @@ class Youku(VideoExtractor):
|
||||
{'id': 'hd3', 'container': 'flv', 'video_profile': '1080P'},
|
||||
{'id': 'hd2', 'container': 'flv', 'video_profile': '超清'},
|
||||
{'id': 'mp4', 'container': 'mp4', 'video_profile': '高清'},
|
||||
{'id': 'flvhd', 'container': 'flv', 'video_profile': '高清'},
|
||||
{'id': 'flv', 'container': 'flv', 'video_profile': '标清'},
|
||||
{'id': '3gphd', 'container': '3gp', 'video_profile': '高清(3GP)'},
|
||||
]
|
||||
@ -50,6 +51,12 @@ class Youku(VideoExtractor):
|
||||
stream_size = int(metadata0['streamsizes'][stream_id])
|
||||
self.streams[stream_id] = {'container': stream_type['container'], 'video_profile': stream_type['video_profile'], 'size': stream_size}
|
||||
|
||||
if not self.streams:
|
||||
for stream_type in self.stream_types:
|
||||
if stream_type['id'] in metadata0['streamtypes_o']:
|
||||
stream_id = stream_type['id']
|
||||
self.streams[stream_id] = {'container': stream_type['container'], 'video_profile': stream_type['video_profile']}
|
||||
|
||||
def extract(self, **kwargs):
|
||||
if 'stream_id' in kwargs and kwargs['stream_id']:
|
||||
# Extract the stream
|
||||
@ -65,6 +72,8 @@ class Youku(VideoExtractor):
|
||||
log.w('Use \'-y\' to specify a proxy server for extracting stream data.\n')
|
||||
|
||||
self.streams[stream_id]['src'] = __class__.parse_m3u8(m3u8)
|
||||
if self.streams[stream_id]['src'] and 'size' not in self.streams[stream_id]:
|
||||
self.streams[stream_id]['size'] = urls_size(self.streams[stream_id]['src'])
|
||||
|
||||
site = Youku()
|
||||
download = site.download_by_url
|
||||
|
Loading…
Reference in New Issue
Block a user