Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kin8): use list as str (#97) #9

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/models/crawlers/kin8.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))