Skip to content

Commit

Permalink
lower scrape delay
Browse files Browse the repository at this point in the history
  • Loading branch information
meesvandongen committed Apr 14, 2024
1 parent 1a6af2a commit 0a2df12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Binary file modified bun.lockb
Binary file not shown.
9 changes: 5 additions & 4 deletions src/scrape.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { AnimeService, ApiError, OpenAPI } from "./api/index";
import { delay } from "./utils";

const yearsToScrape = 20;
const limit = 400;
const scrapeDelay = 1_000;

const clientId = process.env.CLIENT_ID;

if (!clientId) {
Expand All @@ -19,9 +23,6 @@ interface Metadata {

let metadata: Metadata = await Bun.file("state.json").json();

const yearsToScrape = 20;
const limit = 400;

let hasReachedEnd = false;
let lastYearToScrape = metadata.current_year + yearsToScrape;
let year = metadata.current_year;
Expand Down Expand Up @@ -78,7 +79,7 @@ yearLoop: while (year < lastYearToScrape) {
offset += limit;

console.debug("Waiting 3 seconds...");
await delay(3_000);
await delay(scrapeDelay);
}

season += 1;
Expand Down

0 comments on commit 0a2df12

Please sign in to comment.