提交 ba861d4c 编写于 作者: M Mort Yao

support PyPy3: use explicit `self` (fix #410)

上级 8bd8ebd4
...@@ -67,7 +67,7 @@ class Youku(VideoExtractor): ...@@ -67,7 +67,7 @@ class Youku(VideoExtractor):
def download_playlist_by_url(self, url, **kwargs): def download_playlist_by_url(self, url, **kwargs):
self.url = url self.url = url
playlist_id = __class__.get_playlist_id_from_url(self.url) playlist_id = self.__class__.get_playlist_id_from_url(self.url)
if playlist_id is None: if playlist_id is None:
log.wtf('[Failed] Unsupported URL pattern.') log.wtf('[Failed] Unsupported URL pattern.')
...@@ -77,13 +77,13 @@ class Youku(VideoExtractor): ...@@ -77,13 +77,13 @@ class Youku(VideoExtractor):
self.p_playlist() self.p_playlist()
for video in videos: for video in videos:
index = parse_query_param(video, 'f') index = parse_query_param(video, 'f')
__class__().download_by_url(video, index=index, **kwargs) self.__class__().download_by_url(video, index=index, **kwargs)
def prepare(self, **kwargs): def prepare(self, **kwargs):
assert self.url or self.vid assert self.url or self.vid
if self.url and not self.vid: if self.url and not self.vid:
self.vid = __class__.get_vid_from_url(self.url) self.vid = self.__class__.get_vid_from_url(self.url)
if self.vid is None: if self.vid is None:
self.download_playlist_by_url(self.url, **kwargs) self.download_playlist_by_url(self.url, **kwargs)
...@@ -137,7 +137,7 @@ class Youku(VideoExtractor): ...@@ -137,7 +137,7 @@ class Youku(VideoExtractor):
# Extract stream with the best quality # Extract stream with the best quality
stream_id = self.streams_sorted[0]['id'] stream_id = self.streams_sorted[0]['id']
new_ep, sid, token = __class__.generate_ep(self.vid, self.ep) new_ep, sid, token = self.__class__.generate_ep(self.vid, self.ep)
m3u8_query = parse.urlencode(dict( m3u8_query = parse.urlencode(dict(
ctype=12, ctype=12,
ep=new_ep, ep=new_ep,
...@@ -159,7 +159,7 @@ class Youku(VideoExtractor): ...@@ -159,7 +159,7 @@ class Youku(VideoExtractor):
m3u8 = get_html(m3u8_url) m3u8 = get_html(m3u8_url)
self.streams[stream_id]['src'] = __class__.parse_m3u8(m3u8) self.streams[stream_id]['src'] = self.__class__.parse_m3u8(m3u8)
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.')
......
...@@ -89,7 +89,7 @@ class YouTube(VideoExtractor): ...@@ -89,7 +89,7 @@ class YouTube(VideoExtractor):
def download_playlist_by_url(self, url, **kwargs): def download_playlist_by_url(self, url, **kwargs):
self.url = url self.url = url
playlist_id = __class__.get_playlist_id_from_url(self.url) playlist_id = self.__class__.get_playlist_id_from_url(self.url)
if playlist_id is None: if playlist_id is None:
log.wtf('[Failed] Unsupported URL pattern.') log.wtf('[Failed] Unsupported URL pattern.')
...@@ -104,13 +104,13 @@ class YouTube(VideoExtractor): ...@@ -104,13 +104,13 @@ class YouTube(VideoExtractor):
for video in videos: for video in videos:
vid = parse_query_param(video, 'v') vid = parse_query_param(video, 'v')
index = parse_query_param(video, 'index') index = parse_query_param(video, 'index')
__class__().download_by_url(__class__.get_url_from_vid(vid), index=index, **kwargs) self.__class__().download_by_url(self.__class__.get_url_from_vid(vid), index=index, **kwargs)
def prepare(self, **kwargs): def prepare(self, **kwargs):
assert self.url or self.vid assert self.url or self.vid
if not self.vid and self.url: if not self.vid and self.url:
self.vid = __class__.get_vid_from_url(self.url) self.vid = self.__class__.get_vid_from_url(self.url)
if self.vid is None: if self.vid is None:
self.download_playlist_by_url(self.url, **kwargs) self.download_playlist_by_url(self.url, **kwargs)
...@@ -199,7 +199,7 @@ class YouTube(VideoExtractor): ...@@ -199,7 +199,7 @@ class YouTube(VideoExtractor):
elif self.streams[stream_id]['s'] is not None: elif self.streams[stream_id]['s'] is not None:
s = self.streams[stream_id]['s'] s = self.streams[stream_id]['s']
js = get_content(self.html5player) js = get_content(self.html5player)
sig = __class__.decipher(js, s) sig = self.__class__.decipher(js, s)
src += '&signature={}'.format(sig) src += '&signature={}'.format(sig)
self.streams[stream_id]['src'] = [src] self.streams[stream_id]['src'] = [src]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册