fix: origin maybe list?

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
yihong0618
2023-11-11 16:29:55 +08:00
parent d41d999e28
commit 4a172836e0

View File

@@ -227,8 +227,12 @@ class NoKindle:
@staticmethod
def _is_ebook(book_info):
# https://github.com/yihong0618/Kindle_download_helper/issues/149#issuecomment-1805966855
# TODO maybe refactor
if not isinstance(book_info.get("origins"), dict):
return False
# https://github.com/yihong0618/Kindle_download_helper/issues/149#issuecomment-1806748160
if not isinstance(book_info.get("origins", {}).get("origin"), dict):
return False
return (
book_info.get("origins", {}).get("origin", {}).get("type", "") == "Purchase"
)