From dabe1f2da62aaea4f17956b8b0006da3b7838e84 Mon Sep 17 00:00:00 2001 From: jnozsc Date: Sun, 16 Feb 2020 15:00:29 -0800 Subject: [PATCH] add edge case --- fanza.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fanza.py b/fanza.py index 9457c27..7edf6d9 100644 --- a/fanza.py +++ b/fanza.py @@ -82,6 +82,9 @@ def main(number): if '404 Not Found' in htmlcode: htmlcode=get_html('https://www.dmm.co.jp/mono/dvd/-/detail/=/cid='+number) url = 'https://www.dmm.co.jp/mono/dvd/-/detail/=/cid='+number + if '404 Not Found' in htmlcode: + # neither digital nor mono is available + return json.dumps({'title': '',}) try: # for some old page, the input number does not match the page # for example, the url will be cid=test012