mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-23 03:02:50 +01:00
Make decode_video_url static (used in both post and creator extractor).
This commit is contained in:
parent
9037077fa4
commit
f14dbfe079
@ -50,6 +50,12 @@ class HotleakExtractor(Extractor):
|
|||||||
params["page"] += 1
|
params["page"] += 1
|
||||||
|
|
||||||
|
|
||||||
|
def decode_video_url(encoded_url):
|
||||||
|
sliced_url = encoded_url[16:-16]
|
||||||
|
reversed_url = sliced_url[::-1]
|
||||||
|
return base64.b64decode(reversed_url).decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
class HotleakPostExtractor(HotleakExtractor):
|
class HotleakPostExtractor(HotleakExtractor):
|
||||||
"""Extractor for individual posts on hotleak"""
|
"""Extractor for individual posts on hotleak"""
|
||||||
subcategory = "post"
|
subcategory = "post"
|
||||||
@ -84,11 +90,6 @@ class HotleakPostExtractor(HotleakExtractor):
|
|||||||
HotleakExtractor.__init__(self, match)
|
HotleakExtractor.__init__(self, match)
|
||||||
self.creator, self.type, self.id = match.groups()
|
self.creator, self.type, self.id = match.groups()
|
||||||
|
|
||||||
def decode_video_url(self, encoded_url):
|
|
||||||
sliced_url = encoded_url[16:-16]
|
|
||||||
reversed_url = sliced_url[::-1]
|
|
||||||
return base64.b64decode(reversed_url).decode('utf-8')
|
|
||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
url = "{}/{}/{}/{}".format(
|
url = "{}/{}/{}/{}".format(
|
||||||
self.root, self.creator, self.type, self.id)
|
self.root, self.creator, self.type, self.id)
|
||||||
@ -106,7 +107,7 @@ class HotleakPostExtractor(HotleakExtractor):
|
|||||||
text.nameext_from_url(data["url"], data)
|
text.nameext_from_url(data["url"], data)
|
||||||
|
|
||||||
elif self.type == "video":
|
elif self.type == "video":
|
||||||
data["url"] = "ytdl:" + self.decode_video_url(text.extr(
|
data["url"] = "ytdl:" + decode_video_url(text.extr(
|
||||||
text.unescape(page), '"src":"', '"'))
|
text.unescape(page), '"src":"', '"'))
|
||||||
text.nameext_from_url(data["url"], data)
|
text.nameext_from_url(data["url"], data)
|
||||||
data["extension"] = "mp4"
|
data["extension"] = "mp4"
|
||||||
@ -139,11 +140,6 @@ class HotleakCreatorExtractor(HotleakExtractor):
|
|||||||
url = "{}/{}".format(self.root, self.creator)
|
url = "{}/{}".format(self.root, self.creator)
|
||||||
return self._pagination(url)
|
return self._pagination(url)
|
||||||
|
|
||||||
def decode_video_url(self, encoded_url):
|
|
||||||
sliced_url = encoded_url[16:-16]
|
|
||||||
reversed_url = sliced_url[::-1]
|
|
||||||
return base64.b64decode(reversed_url).decode('utf-8')
|
|
||||||
|
|
||||||
def _pagination(self, url):
|
def _pagination(self, url):
|
||||||
headers = {"X-Requested-With": "XMLHttpRequest"}
|
headers = {"X-Requested-With": "XMLHttpRequest"}
|
||||||
params = {"page": 1}
|
params = {"page": 1}
|
||||||
@ -174,7 +170,7 @@ class HotleakCreatorExtractor(HotleakExtractor):
|
|||||||
|
|
||||||
elif post["type"] == 1:
|
elif post["type"] == 1:
|
||||||
data["type"] = "video"
|
data["type"] = "video"
|
||||||
data["url"] = "ytdl:" + self.decode_video_url(
|
data["url"] = "ytdl:" + decode_video_url(
|
||||||
post["stream_url_play"])
|
post["stream_url_play"])
|
||||||
text.nameext_from_url(data["url"], data)
|
text.nameext_from_url(data["url"], data)
|
||||||
data["extension"] = "mp4"
|
data["extension"] = "mp4"
|
||||||
|
Loading…
Reference in New Issue
Block a user