mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-08-16 05:58:05 +00:00
Add User-Agent header to Stooq fetch to avoid server-side blocking
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
ac6ad0da60
commit
abf04aabbd
@@ -43,7 +43,10 @@ async function stooqMetal(symbol: string): Promise<FredResult> {
|
||||
const empty: FredResult = { value: null, delta: null, deltaPct: null };
|
||||
try {
|
||||
const url = `https://stooq.com/q/l/?s=${symbol}&f=sd2t2ohlcv&h&e=csv`;
|
||||
const res = await fetch(url, { next: { revalidate: 300 } }); // cache 5 min
|
||||
const res = await fetch(url, {
|
||||
next: { revalidate: 300 }, // cache 5 min
|
||||
headers: { "User-Agent": "Mozilla/5.0 (compatible; ForexDashboard/1.0)" },
|
||||
});
|
||||
if (!res.ok) return empty;
|
||||
const text = await res.text();
|
||||
const lines = text.trim().split("\n");
|
||||
|
||||
Reference in New Issue
Block a user