Repos / pytaku / c8bbd8c9e3
commit c8bbd8c9e3aa48cda9fed0638b8f6053794a033f
Author: Liem Ly Quan <liemlyquan@gmail.com>
Date:   Sat Aug 8 20:04:52 2020 +0700

    gracefully handle empty chapter list
    
    closes #1

diff --git a/src/mangoapi/__init__.py b/src/mangoapi/__init__.py
index fbf49bd..cbbc5d1 100644
--- a/src/mangoapi/__init__.py
+++ b/src/mangoapi/__init__.py
@@ -55,7 +55,7 @@ def get_title(title_id):
                 "groups": _extract_groups(chap),
                 **_parse_chapter_number(chap["chapter"]),
             }
-            for chap_id, chap in md_json["chapter"].items()
+            for chap_id, chap in md_json.get("chapter", {}).items()
             if chap["lang_code"] == "gb" and chap["group_name"] != "MangaPlus"
         ],
     }