UNPKG

slyrics

Version:

Scrape Lyrics without API Key

21 lines 729 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HTTPRequester = void 0; const undici_1 = require("undici"); const SLyricsHTTPRequestError_1 = require("../errors/SLyricsHTTPRequestError"); class HTTPRequester { static async get(url) { const resp = await (0, undici_1.fetch)(url, { method: "GET" }); if (!resp.ok) { throw new SLyricsHTTPRequestError_1.SLyricsHTTPRequestError(resp.status, url, "GET"); } return resp; } static async getText(url) { const resp = await this.get(url); const text = await resp.text(); return text; } } exports.HTTPRequester = HTTPRequester; //# sourceMappingURL=HTTPRequester.js.map