[cyberdrop] extract direct download URLs (#1943)
do not rely on redirects from f.cyberdrop.cc
This commit is contained in:
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from .. import text
|
from .. import text
|
||||||
import binascii
|
|
||||||
|
|
||||||
|
|
||||||
class CyberdropAlbumExtractor(Extractor):
|
class CyberdropAlbumExtractor(Extractor):
|
||||||
@@ -19,7 +18,7 @@ class CyberdropAlbumExtractor(Extractor):
|
|||||||
archive_fmt = "{album_id}_{id}"
|
archive_fmt = "{album_id}_{id}"
|
||||||
pattern = r"(?:https?://)?(?:www\.)?cyberdrop\.me/a/([^/?#]+)"
|
pattern = r"(?:https?://)?(?:www\.)?cyberdrop\.me/a/([^/?#]+)"
|
||||||
test = ("https://cyberdrop.me/a/keKRjm4t", {
|
test = ("https://cyberdrop.me/a/keKRjm4t", {
|
||||||
"pattern": r"https://f\.cyberdrop\.cc/.*\.[a-z]+$",
|
"pattern": r"https://fs-\d+\.cyberdrop\.to/.*\.[a-z]+$",
|
||||||
"keyword": {
|
"keyword": {
|
||||||
"album_id": "keKRjm4t",
|
"album_id": "keKRjm4t",
|
||||||
"album_name": "Fate (SFW)",
|
"album_name": "Fate (SFW)",
|
||||||
@@ -38,7 +37,14 @@ class CyberdropAlbumExtractor(Extractor):
|
|||||||
def items(self):
|
def items(self):
|
||||||
url = self.root + "/a/" + self.album_id
|
url = self.root + "/a/" + self.album_id
|
||||||
extr = text.extract_from(self.request(url).text)
|
extr = text.extract_from(self.request(url).text)
|
||||||
extr("const albumData = {", "")
|
|
||||||
|
files = []
|
||||||
|
append = files.append
|
||||||
|
while True:
|
||||||
|
url = extr('downloadUrl: "', '"')
|
||||||
|
if not url:
|
||||||
|
break
|
||||||
|
append(text.unescape(url))
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"album_id" : self.album_id,
|
"album_id" : self.album_id,
|
||||||
@@ -46,13 +52,11 @@ class CyberdropAlbumExtractor(Extractor):
|
|||||||
"date" : text.parse_timestamp(extr("timestamp: ", ",")),
|
"date" : text.parse_timestamp(extr("timestamp: ", ",")),
|
||||||
"album_size" : text.parse_int(extr("totalSize: ", ",")),
|
"album_size" : text.parse_int(extr("totalSize: ", ",")),
|
||||||
"description": extr("description: `", "`"),
|
"description": extr("description: `", "`"),
|
||||||
|
"count" : len(files),
|
||||||
}
|
}
|
||||||
files = extr("fl: '", "'").split(",")
|
|
||||||
data["count"] = len(files)
|
|
||||||
|
|
||||||
yield Message.Directory, data
|
yield Message.Directory, data
|
||||||
for file_b64 in files:
|
for url in files:
|
||||||
file = binascii.a2b_base64(file_b64).decode()
|
text.nameext_from_url(url, data)
|
||||||
text.nameext_from_url(file, data)
|
|
||||||
data["filename"], _, data["id"] = data["filename"].rpartition("-")
|
data["filename"], _, data["id"] = data["filename"].rpartition("-")
|
||||||
yield Message.Url, "https://f.cyberdrop.cc/" + file, data
|
yield Message.Url, url, data
|
||||||
|
|||||||
Reference in New Issue
Block a user