diff options
| author | 2022-12-04 23:25:06 -0500 | |
|---|---|---|
| committer | 2022-12-04 23:25:06 -0500 | |
| commit | 3338dfce719c999467ffe08fd45663be8190057a (patch) | |
| tree | fd3235a1379c19508bbb47b8e8b95d5d9164b0d3 /gallery_dl/extractor/bcy.py | |
| parent | 7af5cc29d1c02d20a6890b7b7ba78ab41532a763 (diff) | |
New upstream version 1.24.1.upstream/1.24.1
Diffstat (limited to 'gallery_dl/extractor/bcy.py')
| -rw-r--r-- | gallery_dl/extractor/bcy.py | 16 |
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): |
