Youku: fix a regression bug which caused '-y' not work

This commit is contained in:
Mort Yao 2014-07-31 22:28:30 +02:00
parent 585eb8d441
commit d6ec844902
2 changed files with 17 additions and 13 deletions

View File

@ -912,9 +912,15 @@ def script_main(script_name, download, download_playlist = None):
try: try:
if stream_id: if stream_id:
if not extractor_proxy:
download_main(download, download_playlist, args, playlist, stream_id=stream_id, output_dir=output_dir, merge=merge, info_only=info_only) download_main(download, download_playlist, args, playlist, stream_id=stream_id, output_dir=output_dir, merge=merge, info_only=info_only)
else: else:
download_main(download, download_playlist, args, playlist, stream_id=stream_id, extractor_proxy=extractor_proxy, output_dir=output_dir, merge=merge, info_only=info_only)
else:
if not extractor_proxy:
download_main(download, download_playlist, args, playlist, output_dir=output_dir, merge=merge, info_only=info_only) download_main(download, download_playlist, args, playlist, output_dir=output_dir, merge=merge, info_only=info_only)
else:
download_main(download, download_playlist, args, playlist, extractor_proxy=extractor_proxy, output_dir=output_dir, merge=merge, info_only=info_only)
except KeyboardInterrupt: except KeyboardInterrupt:
if traceback: if traceback:
raise raise

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
from .common import match1, download_urls from .common import match1, download_urls, parse_host, set_proxy, unset_proxy
from .util import log from .util import log
class Extractor(): class Extractor():
@ -30,9 +30,8 @@ class VideoExtractor():
def download_by_url(self, url, **kwargs): def download_by_url(self, url, **kwargs):
self.url = url self.url = url
#global extractor_proxy if kwargs['extractor_proxy']:
#if extractor_proxy: set_proxy(parse_host(kwargs['extractor_proxy']))
# set_proxy(parse_host(extractor_proxy))
self.prepare(**kwargs) self.prepare(**kwargs)
try: try:
@ -42,17 +41,16 @@ class VideoExtractor():
self.extract(**kwargs) self.extract(**kwargs)
#if extractor_proxy: if kwargs['extractor_proxy']:
# unset_proxy() unset_proxy()
self.download(**kwargs) self.download(**kwargs)
def download_by_vid(self, vid, **kwargs): def download_by_vid(self, vid, **kwargs):
self.vid = vid self.vid = vid
#global extractor_proxy if kwargs['extractor_proxy']:
#if extractor_proxy: set_proxy(parse_host(kwargs['extractor_proxy']))
# set_proxy(parse_host(extractor_proxy))
self.prepare(**kwargs) self.prepare(**kwargs)
try: try:
@ -61,8 +59,8 @@ class VideoExtractor():
self.streams_sorted = [dict([('itag', stream_type['itag'])] + list(self.streams[stream_type['itag']].items())) for stream_type in self.__class__.stream_types if stream_type['itag'] in self.streams] self.streams_sorted = [dict([('itag', stream_type['itag'])] + list(self.streams[stream_type['itag']].items())) for stream_type in self.__class__.stream_types if stream_type['itag'] in self.streams]
self.extract(**kwargs) self.extract(**kwargs)
#if extractor_proxy: if kwargs['extractor_proxy']:
# unset_proxy() unset_proxy()
self.download(**kwargs) self.download(**kwargs)