Skip to content

Commit

Permalink
[archivedmoe] fix thebarchive webm URLs (#5116)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jan 26, 2024
1 parent 34a4ddc commit 1f7101d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gallery_dl/extractor/foolfuuka.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def __init__(self, match):
BaseExtractor.__init__(self, match)
if self.category == "b4k":
self.remote = self._remote_direct
elif self.category == "archivedmoe":
self.referer = False

def items(self):
yield Message.Directory, self.metadata()
Expand Down Expand Up @@ -53,9 +55,12 @@ def posts(self):

def remote(self, media):
"""Resolve a remote media link"""
needle = '<meta http-equiv="Refresh" content="0; url='
page = self.request(media["remote_media_link"]).text
return text.extr(page, needle, '"')
url = text.extr(page, 'http-equiv="Refresh" content="0; url=', '"')
if url.endswith(".webm") and \
url.startswith("https://thebarchive.com/"):
return url[:-1]
return url

@staticmethod
def _remote_direct(media):
Expand Down
12 changes: 12 additions & 0 deletions test/results/archivedmoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
"#sha1_url": "ffec05a1a1b906b5ca85992513671c9155ee9e87",
},

{
"#url" : "https://archived.moe/b/thread/912594917/",
"#comment" : "broken thebarchive .webm URLs (#5116)",
"#category": ("foolfuuka", "archivedmoe", "thread"),
"#class" : foolfuuka.FoolfuukaThreadExtractor,
"#urls" : (
"https://thebarchive.com/b/full_image/1705625299234839.gif",
"https://thebarchive.com/b/full_image/1705625431133806.web",
"https://thebarchive.com/b/full_image/1705626190307840.web",
),
},

{
"#url" : "https://archived.moe/gd/",
"#category": ("foolfuuka", "archivedmoe", "board"),
Expand Down

0 comments on commit 1f7101d

Please sign in to comment.