fix: use net.fetch instead of node native fetch

This commit is contained in:
JellyBrick
2023-09-01 21:22:21 +09:00
parent b67a4ed9bb
commit 3e3fdb3c3f
4 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
const { join } = require('node:path');
const { ipcMain } = require('electron');
const { ipcMain, net } = require('electron');
const is = require('electron-is');
const { convert } = require('html-to-text');
@ -59,7 +59,7 @@ const fetchFromGenius = async (metadata) => {
* @returns The lyrics of the first song found using the Genius-Lyrics API
*/
const getLyricsList = async (queryString) => {
const response = await fetch(
const response = await net.fetch(
`https://genius.com/api/search/multi?per_page=5&q=${encodeURIComponent(queryString)}`,
);
if (!response.ok) {
@ -88,7 +88,7 @@ const getLyricsList = async (queryString) => {
* @returns The lyrics of the song URL provided, null if none
*/
const getLyrics = async (url) => {
const response = await fetch(url);
const response = await net.fetch(url);
if (!response.ok) {
return null;
}