[cyberdrop] fix extraction
This commit is contained in:
@@ -14,6 +14,7 @@ from .. import text
|
|||||||
class CyberdropAlbumExtractor(lolisafe.LolisafeAlbumExtractor):
|
class CyberdropAlbumExtractor(lolisafe.LolisafeAlbumExtractor):
|
||||||
category = "cyberdrop"
|
category = "cyberdrop"
|
||||||
root = "https://cyberdrop.me"
|
root = "https://cyberdrop.me"
|
||||||
|
root_api = "https://api.cyberdrop.me"
|
||||||
pattern = r"(?:https?://)?(?:www\.)?cyberdrop\.(?:me|to)/a/([^/?#]+)"
|
pattern = r"(?:https?://)?(?:www\.)?cyberdrop\.(?:me|to)/a/([^/?#]+)"
|
||||||
example = "https://cyberdrop.me/a/ID"
|
example = "https://cyberdrop.me/a/ID"
|
||||||
|
|
||||||
@@ -55,5 +56,14 @@ class CyberdropAlbumExtractor(lolisafe.LolisafeAlbumExtractor):
|
|||||||
|
|
||||||
def _extract_files(self, file_ids):
|
def _extract_files(self, file_ids):
|
||||||
for file_id in file_ids:
|
for file_id in file_ids:
|
||||||
url = "{}/api/f/{}".format(self.root, file_id)
|
try:
|
||||||
yield self.request(url).json()
|
url = "{}/api/file/info/{}".format(self.root_api, file_id)
|
||||||
|
file = self.request(url).json()
|
||||||
|
auth = self.request(file["auth_url"]).json()
|
||||||
|
file["url"] = auth["url"]
|
||||||
|
except Exception as exc:
|
||||||
|
self.log.warning("%s (%s: %s)",
|
||||||
|
file_id, exc.__class__.__name__, exc)
|
||||||
|
continue
|
||||||
|
|
||||||
|
yield file
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ __tests__ = (
|
|||||||
"#url" : "https://cyberdrop.me/a/8uE0wQiK",
|
"#url" : "https://cyberdrop.me/a/8uE0wQiK",
|
||||||
"#category": ("lolisafe", "cyberdrop", "album"),
|
"#category": ("lolisafe", "cyberdrop", "album"),
|
||||||
"#class" : cyberdrop.CyberdropAlbumExtractor,
|
"#class" : cyberdrop.CyberdropAlbumExtractor,
|
||||||
"#pattern" : r"https://sun\.cyberdrop\.ch/api/fc/yyK9y8xpQK5dP\?.+",
|
"#pattern" : r"https://\w+\.cyberdrop\.ch/api/file/d/yyK9y8xpQK5dP\?token=ey.+",
|
||||||
"#sha1_content": "0c8768055e4e20e7c7259608b67799171b691140",
|
"#sha1_content": "0c8768055e4e20e7c7259608b67799171b691140",
|
||||||
|
|
||||||
"album_id" : "8uE0wQiK",
|
"album_id" : "8uE0wQiK",
|
||||||
@@ -28,7 +28,7 @@ __tests__ = (
|
|||||||
"num" : 1,
|
"num" : 1,
|
||||||
"size" : 182,
|
"size" : 182,
|
||||||
"slug" : "yyK9y8xpQK5dP",
|
"slug" : "yyK9y8xpQK5dP",
|
||||||
"thumbnailUrl": str,
|
"thumbnail_url": str,
|
||||||
"type" : "image/png",
|
"type" : "image/png",
|
||||||
"url" : str,
|
"url" : str,
|
||||||
},
|
},
|
||||||
@@ -37,7 +37,7 @@ __tests__ = (
|
|||||||
"#url" : "https://cyberdrop.me/a/HriMgbuf",
|
"#url" : "https://cyberdrop.me/a/HriMgbuf",
|
||||||
"#category": ("lolisafe", "cyberdrop", "album"),
|
"#category": ("lolisafe", "cyberdrop", "album"),
|
||||||
"#class" : cyberdrop.CyberdropAlbumExtractor,
|
"#class" : cyberdrop.CyberdropAlbumExtractor,
|
||||||
"#pattern" : r"https://sun\.cyberdrop\.ch/api/fc/\w+\?.+",
|
"#pattern" : r"https://\w+\.cyberdrop\.ch/api/file/d/\w+\?token=ey.+",
|
||||||
"#count" : 3,
|
"#count" : 3,
|
||||||
|
|
||||||
"album_id" : "HriMgbuf",
|
"album_id" : "HriMgbuf",
|
||||||
@@ -53,7 +53,7 @@ __tests__ = (
|
|||||||
"num" : range(1, 3),
|
"num" : range(1, 3),
|
||||||
"size" : int,
|
"size" : int,
|
||||||
"slug" : str,
|
"slug" : str,
|
||||||
"thumbnailUrl": str,
|
"thumbnail_url": str,
|
||||||
"type" : r"re:image/gif|video/webm",
|
"type" : r"re:image/gif|video/webm",
|
||||||
"url" : str,
|
"url" : str,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user