mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
Remove global in subclass of VideoExtractor()
Using `site = Youku()` as global variable will prevent the extractor from getting different video links simutaneously. Each extractor should create its own Youku() instance in order to avoid interference under multithreading.
This commit is contained in:
parent
7aeb94fc7d
commit
b9bc7361eb
@ -163,9 +163,19 @@ class Youku(VideoExtractor):
|
|||||||
if not self.streams[stream_id]['src'] and self.password_protected:
|
if not self.streams[stream_id]['src'] and self.password_protected:
|
||||||
log.e('[Failed] Wrong password.')
|
log.e('[Failed] Wrong password.')
|
||||||
|
|
||||||
site = Youku()
|
def my_download_by_url(*args, **kwargs):
|
||||||
download = site.download_by_url
|
site = Youku()
|
||||||
download_playlist = site.download_playlist_by_url
|
return site.download_by_url(*args, **kwargs)
|
||||||
|
|
||||||
youku_download_by_vid = site.download_by_vid
|
def my_download_playlist_by_url(*args, **kwargs):
|
||||||
|
site = Youku()
|
||||||
|
return site.download_playlist_by_url(*args, **kwargs)
|
||||||
|
|
||||||
|
# youku_download_by_vid = site.download_by_vid
|
||||||
# Used by: acfun.py bilibili.py miomio.py tudou.py
|
# Used by: acfun.py bilibili.py miomio.py tudou.py
|
||||||
|
def youku_download_by_vid(*args, **kwargs):
|
||||||
|
site = Youku()
|
||||||
|
return site.download_by_vid(*args, **kwargs)
|
||||||
|
|
||||||
|
download = my_download_by_url
|
||||||
|
download_playlist = my_download_playlist_by_url
|
||||||
|
@ -205,6 +205,13 @@ class YouTube(VideoExtractor):
|
|||||||
self.streams[stream_id]['src'] = [src]
|
self.streams[stream_id]['src'] = [src]
|
||||||
self.streams[stream_id]['size'] = urls_size(self.streams[stream_id]['src'])
|
self.streams[stream_id]['size'] = urls_size(self.streams[stream_id]['src'])
|
||||||
|
|
||||||
site = YouTube()
|
def my_download_by_url(*args, **kwargs):
|
||||||
download = site.download_by_url
|
site = YouTube()
|
||||||
download_playlist = site.download_playlist_by_url
|
return site.download_by_url(*args, **kwargs)
|
||||||
|
|
||||||
|
def my_download_playlist_by_url(*args, **kwargs):
|
||||||
|
site = YouTube()
|
||||||
|
return site.download_playlist_by_url(*args, **kwargs)
|
||||||
|
|
||||||
|
download = my_download_by_url
|
||||||
|
download_playlist = my_download_playlist_by_url
|
||||||
|
Loading…
Reference in New Issue
Block a user