Skip to content

Commit

Permalink
feat(scraper): partial data fetching by default
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Apr 19, 2024
1 parent ccbce4a commit ccce1c7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/content/quoteRecords/_scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ import { currencyPair, isCurrency } from "../../utils/currency";
import { stringifyDate } from "../../utils/date";
import { roundTo, safeParseFloat } from "../../utils/number";

const SOURCE_URL = "https://www.mnb.hu/Root/ExchangeRate/arfolyam.xlsx";
const QUOTE_CURRENCY = "HUF";
const DEFAULT_FRACTION_DIGITS = 2;

const response = await fetch(
"https://www.mnb.hu/Root/ExchangeRate/arfolyam.xlsx",
process.argv.includes("--full", 1)
? SOURCE_URL
: SOURCE_URL +
"?" +
new URLSearchParams({
year: new Date().getUTCFullYear().toString(),
}),
{ dispatcher: new Agent({ connectTimeout: 300_000 }) },
);
if (!response.ok) {
Expand Down

0 comments on commit ccce1c7

Please sign in to comment.