Skip to content

Commit

Permalink
Further fixes for issue Nandaka#1181
Browse files Browse the repository at this point in the history
Address issue that arises when cover is a type other than "cover_image"
  • Loading branch information
KamenReader authored Oct 27, 2022
1 parent 17d1b29 commit 83f50c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions PixivModelFanbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def parsePost(self, jsPost):
if jsPost.get("coverImageUrl"):
coverUrl = jsPost["coverImageUrl"]
else:
if jsPost.get("cover") and jsPost["cover"] is not None:
if jsPost.get("cover") and jsPost["cover"] is not None and jsPost["cover"]["type"] == "cover_image":
coverUrl = jsPost["cover"]["url"]
else:
coverUrl = None
Expand Down Expand Up @@ -341,7 +341,8 @@ def get_embed_url_data(self, embedData, jsPost) -> str:
js_keys = key.split(".")
root = embedData
for js_key in js_keys:
if js_key == "url" and root is None:
if js_key == "cover" and (root["cover"] is None or root["cover"]["type"] != "cover_image"):
root = None
break
else:
root = root[js_key]
Expand Down

0 comments on commit 83f50c3

Please sign in to comment.