Skip to content

Commit

Permalink
fix: unexpected exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sqzw-x committed Oct 3, 2024
1 parent 50a8eec commit b07bfa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/models/base/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ def get_amazon_data(req_url):
mid_url = 'https://www.amazon.co.jp/portal-migration/hz/glow/get-rendered-toaster' \
'?pageType=Search&aisTransitionState=in&rancorLocationSource=REALM_DEFAULT&_='
result, html = curl_html(mid_url, headers=headers)
anti_csrftoken_a2z = re.findall(r'csrfToken="([^"]+)', html)[0]
try:
anti_csrftoken_a2z = re.findall(r'csrfToken="([^"]+)', html)[0]
ubid_acbjp = re.findall(r'ubid-acbjp=([^ ]+)', str(result))[0]
except:
pass
Expand Down
8 changes: 6 additions & 2 deletions src/models/core/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ def get_yesjav_title(json_data, movie_number):


def google_translate(title, outline):
title, e1 = _google_translate(title)
outline, e2 = _google_translate(outline)
e1 = None
e2 = None
if title:
title, e1 = _google_translate(title)
if outline:
outline, e2 = _google_translate(outline)
return title, outline, e1 or e2


Expand Down

0 comments on commit b07bfa1

Please sign in to comment.