aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/bcy.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-12-04 23:25:11 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2022-12-04 23:25:11 -0500
commitb79007bb57b43b0bb5eff4aa8e5e77a782896e10 (patch)
tree42a4b6168cc46f818465a3c25788253b2aa1b1a5 /gallery_dl/extractor/bcy.py
parent9f3eb7898190a9f1e131a523f37e2e53cc6c6d68 (diff)
parent3338dfce719c999467ffe08fd45663be8190057a (diff)
Update upstream source from tag 'upstream/1.24.1'
Update to upstream version '1.24.1' with Debian dir 327715c78291415f1ede99ba69c817d2264b3693
Diffstat (limited to 'gallery_dl/extractor/bcy.py')
-rw-r--r--gallery_dl/extractor/bcy.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/gallery_dl/extractor/bcy.py b/gallery_dl/extractor/bcy.py
index 4eb446d..44d6065 100644
--- a/gallery_dl/extractor/bcy.py
+++ b/gallery_dl/extractor/bcy.py
@@ -96,11 +96,13 @@ class BcyExtractor(Extractor):
def _data_from_post(self, post_id):
url = "{}/item/detail/{}".format(self.root, post_id)
page = self.request(url, notfound="post").text
- return json.loads(
- text.extr(page, 'JSON.parse("', '");')
- .replace('\\\\u002F', '/')
- .replace('\\"', '"')
- )["detail"]
+ data = (text.extr(page, 'JSON.parse("', '");')
+ .replace('\\\\u002F', '/')
+ .replace('\\"', '"'))
+ try:
+ return json.loads(data)["detail"]
+ except ValueError:
+ return json.loads(data.replace('\\"', '"'))["detail"]
class BcyUserExtractor(BcyExtractor):
@@ -187,6 +189,10 @@ class BcyPostExtractor(BcyExtractor):
("https://bcy.net/item/detail/6747523535150783495", {
"count": 0,
}),
+ # JSON decode error (#3321)
+ ("https://bcy.net/item/detail/7166939271872388110", {
+ "count": 0,
+ }),
)
def posts(self):