Skip to content

Commit

Permalink
fix(crawler): return when categories is null
Browse files Browse the repository at this point in the history
  • Loading branch information
litingyes committed Dec 24, 2024
1 parent d81f082 commit 4fc7183
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crawler/bing_trending_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def pull_bing_trending_images():
headers={"Ocp-Apim-Subscription-Key": key},
params={"safeSearch": "Strict", "count": 8, "mkt": mkt},
)

data = r.json()
if "categories" not in data:
return

data = r.json()["categories"]
target_file = path.join(target_dir, mkt + ".json")
ensure_path_exists(target_file)
Expand Down

0 comments on commit 4fc7183

Please sign in to comment.