Skip to content

Commit

Permalink
[plurk] fix 'user' data extraction and make it non-fatal (#6742)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jan 6, 2025
1 parent b1ffb62 commit d18f311
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gallery_dl/extractor/plurk.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ class PlurkPostExtractor(PlurkExtractor):
pattern = r"(?:https?://)?(?:www\.)?plurk\.com/p/(\w+)"
example = "https://www.plurk.com/p/12345"

def __init__(self, match):
PlurkExtractor.__init__(self, match)
self.plurk_id = match.group(1)

def plurks(self):
url = "{}/p/{}".format(self.root, self.plurk_id)
url = "{}/p/{}".format(self.root, self.groups[0])
page = self.request(url).text
user, pos = text.extract(page, " GLOBAL = ", "\n")
data, pos = text.extract(page, "plurk = ", ";\n", pos)
user, pos = text.extract(page, " GLOBAL=", "\n")
data, pos = text.extract(page, "plurk =", ";\n", pos)

data = self._load(data)
data["user"] = self._load(user)["page_user"]
try:
data["user"] = self._load(user)["page_user"]
except Exception:
self.log.warning("%s: Failed to extract 'user' data",
self.groups[0])
return (data,)

0 comments on commit d18f311

Please sign in to comment.