From d171f46dfe681931db1b6aef3083d80ad7487f92 Mon Sep 17 00:00:00 2001 From: Xmader Date: Sun, 29 Nov 2020 17:00:29 -0500 Subject: [PATCH] feat: cli UA --- src/scoreinfo.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scoreinfo.ts b/src/scoreinfo.ts index 3133b87..423ee5c 100644 --- a/src/scoreinfo.ts +++ b/src/scoreinfo.ts @@ -64,7 +64,13 @@ export class ScoreInfoHtml extends ScoreInfo { } static async request (url: string, _fetch = getFetch()): Promise { - const r = await _fetch(url) + const r = await _fetch(url, { + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0', + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', + 'Accept-Language': 'en-US,en;q=0.8', + }, + }) if (!r.ok) return new ScoreInfoHtml('') const html = await r.text()