Fix Archived.moe redirection issue

Unless the board is /b/ (in which case redirection works fine),
remove the characters of the filename portion of the url until
filename portion of the url is 13 characters long (epoch millis).
This commit is contained in:
NecRaul
2025-06-11 04:06:16 +04:00
parent b4aed5e2c9
commit 96bb2b1630

View File

@@ -36,6 +36,13 @@ class FoolfuukaExtractor(BaseExtractor):
url = media["media_link"]
if not url and "remote_media_link" in media:
if "/b/" not in media["remote_media_link"] and \
media["remote_media_link"].startswith("https://archived.moe/"):
filename = media["media"].rpartition(".")[0]
if len(filename) > 13:
filename_remainder = len(filename) - 13
remote_media_link = media["remote_media_link"].replace(filename, filename[:-filename_remainder])
media["remote_media_link"] = remote_media_link
url = self.remote(media)
if url and url[0] == "/":
url = self.root + url