mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: change onlinefixScraper to fetch
This commit is contained in:
parent
f6072eeb5c
commit
d454d0c00b
6 changed files with 103 additions and 305 deletions
|
@ -20,3 +20,19 @@ export const requestWebPage = async (url: string) => {
|
|||
},
|
||||
}).then((response) => response.text());
|
||||
};
|
||||
|
||||
export const decodeNonUtf8Response = async (res: Response) => {
|
||||
const contentType = res.headers.get("content-type");
|
||||
if (!contentType) return res.text();
|
||||
|
||||
const charset = contentType.substring(contentType.indexOf("charset=") + 8);
|
||||
|
||||
const text = await res.arrayBuffer().then((ab) => {
|
||||
const dataView = new DataView(ab);
|
||||
const decoder = new TextDecoder(charset);
|
||||
|
||||
return decoder.decode(dataView);
|
||||
});
|
||||
|
||||
return text;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue