From 828e29e2554edcf9998712479a6dbb8cd18214a1 Mon Sep 17 00:00:00 2001 From: sqzw-x Date: Wed, 21 Feb 2024 23:52:51 +0800 Subject: [PATCH] fix(kin8): use list as str (#97) --- src/models/crawlers/kin8.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/models/crawlers/kin8.py b/src/models/crawlers/kin8.py index 193842f..4f51bba 100644 --- a/src/models/crawlers/kin8.py +++ b/src/models/crawlers/kin8.py @@ -96,10 +96,13 @@ def main(number, appoint_url='', log_info='', req_web='', language='jp'): debug_info = '' if real_url: key = re.findall(r'\d{3,}', real_url) - number = f'KIN8-{key[0]}' if key else number + key = key[0] if key else "" + assert isinstance(key, str) + number = f'KIN8-{key}' if key else number else: key = re.findall(r'KIN8(TENGOKU)?-?(\d{3,})', number.upper()) key = key[0][1] if key else '' + assert isinstance(key, str) if not key: debug_info = f'番号中未识别到 KIN8 番号: {number} ' log_info += web_info + debug_info @@ -201,4 +204,5 @@ def main(number, appoint_url='', log_info='', req_web='', language='jp'): if __name__ == '__main__': # yapf: disable - print(main('kin8-3681')) + # print(main('kin8-3681')) + print(main(number="", appoint_url="https://www.kin8tengoku.com/moviepages/1232/index.html"))