Skip to content

Commit

Permalink
use cdn for files
Browse files Browse the repository at this point in the history
  • Loading branch information
diceroll123 committed Jul 18, 2024
1 parent 56c1374 commit 63041e5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions automation/grab_rounds.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import time
from pathlib import Path

import requests

# grab the current round from the API
current_round = int(requests.get("https://foodclub.neocities.org/next_round.txt").text)
current_round = int(requests.get("https://cdn.neofood.club/current_round.txt").text)

# grab rounds that we don't have
limit = 90
previous_round = current_round - 1
while not Path(f"./raw_json/{previous_round}.json").exists():
print(f"Grabbing round {previous_round}...")
r = requests.get(f"https://foodclub.neocities.org/rounds/{previous_round}.json")
r = requests.get(f"https://cdn.neofood.club/rounds/{previous_round}.json")
if r.status_code == 200:
print(f"Saving round {previous_round}...")
Path(f"./raw_json/{previous_round}.json").write_text(r.text)
else:
print(f"Round {previous_round} not found")

time.sleep(0.5)

# don't go too far back
# shouldn't happen but it's a good idea to have a limit
if previous_round < current_round - limit:
Expand Down

0 comments on commit 63041e5

Please sign in to comment.