diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index b95df94..3e9d641 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -229,7 +229,16 @@ async def fetch_async(args): authors = db_row.pop('authors') tags = db_row.pop('tags') if FANZA_ID_REGEX.fullmatch(work_id): - thumbnail_url = f'https://doujin-assets.dmm.co.jp/digital/comic/{work_id}/{work_id}pl.jpg' + candidate_urls = [ + f'https://doujin-assets.dmm.co.jp/digital/{work_type}/{work_id}/{work_id}pl.jpg' + for work_type in ['comic', 'cg'] + ] + thumbnail_url = None + for url in candidate_urls: + h = requests.head(url, allow_redirects=False) + if h.status_code == 200: + thumbnail_url = url + break elif FAKKU_ID_REGEX.fullmatch(work_id): thumbnail_url = None else: