aboutsummaryrefslogtreecommitdiff
path: root/node_modules/genius-lyrics/dist
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/genius-lyrics/dist')
-rw-r--r--node_modules/genius-lyrics/dist/Albums/Album.d.ts13
-rw-r--r--node_modules/genius-lyrics/dist/Albums/Album.js27
-rw-r--r--node_modules/genius-lyrics/dist/Artists/Artist.d.ts35
-rw-r--r--node_modules/genius-lyrics/dist/Artists/Artist.js78
-rw-r--r--node_modules/genius-lyrics/dist/Artists/Client.d.ts14
-rw-r--r--node_modules/genius-lyrics/dist/Artists/Client.js40
-rw-r--r--node_modules/genius-lyrics/dist/Client.d.ts12
-rw-r--r--node_modules/genius-lyrics/dist/Client.js30
-rw-r--r--node_modules/genius-lyrics/dist/Constants.d.ts20
-rw-r--r--node_modules/genius-lyrics/dist/Constants.js15
-rw-r--r--node_modules/genius-lyrics/dist/Requester.d.ts11
-rw-r--r--node_modules/genius-lyrics/dist/Requester.js71
-rw-r--r--node_modules/genius-lyrics/dist/Songs/Client.d.ts23
-rw-r--r--node_modules/genius-lyrics/dist/Songs/Client.js89
-rw-r--r--node_modules/genius-lyrics/dist/Songs/Song.d.ts31
-rw-r--r--node_modules/genius-lyrics/dist/Songs/Song.js103
-rw-r--r--node_modules/genius-lyrics/dist/Utils.d.ts2
-rw-r--r--node_modules/genius-lyrics/dist/Utils.js20
-rw-r--r--node_modules/genius-lyrics/dist/index.d.ts33
-rw-r--r--node_modules/genius-lyrics/dist/index.js51
20 files changed, 718 insertions, 0 deletions
diff --git a/node_modules/genius-lyrics/dist/Albums/Album.d.ts b/node_modules/genius-lyrics/dist/Albums/Album.d.ts
new file mode 100644
index 0000000..36d5ec7
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Albums/Album.d.ts
@@ -0,0 +1,13 @@
+import { Artist } from "../Artists/Artist";
+export declare class Album {
+ name: string;
+ title: string;
+ id: number;
+ image: string;
+ url: string;
+ endpoint: string;
+ artist: Artist;
+ partial: boolean;
+ raw: any;
+ constructor(res: any, artist: Artist);
+}
diff --git a/node_modules/genius-lyrics/dist/Albums/Album.js b/node_modules/genius-lyrics/dist/Albums/Album.js
new file mode 100644
index 0000000..4978f88
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Albums/Album.js
@@ -0,0 +1,27 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Album = void 0;
+const Artist_1 = require("../Artists/Artist");
+const Constants_1 = require("../Constants");
+class Album {
+ constructor(res, artist) {
+ if (!res || typeof res !== "object") {
+ throw new Error(Constants_1.Constants.INV_RES_OBJ);
+ }
+ if (!artist ||
+ typeof artist !== "object" ||
+ !(artist instanceof Artist_1.Artist)) {
+ throw new Error(Constants_1.Constants.INV_RES_OBJ);
+ }
+ this.name = res.name;
+ this.title = res.title;
+ this.id = +res.id;
+ this.image = res.cover_art_url;
+ this.url = res.url;
+ this.endpoint = res.api_path;
+ this.artist = artist;
+ this.partial = true;
+ this.raw = res;
+ }
+}
+exports.Album = Album;
diff --git a/node_modules/genius-lyrics/dist/Artists/Artist.d.ts b/node_modules/genius-lyrics/dist/Artists/Artist.d.ts
new file mode 100644
index 0000000..34928e7
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Artists/Artist.d.ts
@@ -0,0 +1,35 @@
+import { Client } from "../Client";
+export declare class Artist {
+ readonly client: Client;
+ partial: boolean;
+ name: string;
+ id: number;
+ url: string;
+ thumbnail: string;
+ image: string;
+ iq: number;
+ verified: {
+ normal: boolean;
+ meme: boolean;
+ };
+ socialmedia: {
+ facebook?: string;
+ twitter?: string;
+ };
+ raw: any;
+ constructor(client: Client, res: any, partial?: boolean);
+ /**
+ * Fetches the songs of the Artist (Requires Key)
+ * @example const Songs = await Artist.songs();
+ */
+ songs(options?: {
+ sort?: string;
+ page?: number;
+ per_page?: number;
+ }): Promise<any>;
+ /**
+ * Fetches All Information about the Artist and updates all the existing Properties (Requires Key)
+ * @example const NewArtist = await Artist.fetch();
+ */
+ fetch(): Promise<Artist>;
+}
diff --git a/node_modules/genius-lyrics/dist/Artists/Artist.js b/node_modules/genius-lyrics/dist/Artists/Artist.js
new file mode 100644
index 0000000..112f45d
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Artists/Artist.js
@@ -0,0 +1,78 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Artist = void 0;
+const Song_1 = require("../Songs/Song");
+const Constants_1 = require("../Constants");
+class Artist {
+ constructor(client, res, partial = false) {
+ var _a;
+ this.client = client;
+ this.partial = partial;
+ this.name = res.name;
+ this.id = +res.id;
+ this.url = res.url;
+ this.thumbnail = res.image_url;
+ this.image = res.header_image_url;
+ this.iq = (_a = +res.iq) !== null && _a !== void 0 ? _a : 0;
+ this.verified = {
+ normal: res.is_verified,
+ meme: res.is_meme_verified,
+ };
+ this.socialmedia = {
+ facebook: res.facebook_name || undefined,
+ twitter: res.twitter_name || undefined,
+ };
+ this.raw = res;
+ }
+ /**
+ * Fetches the songs of the Artist (Requires Key)
+ * @example const Songs = await Artist.songs();
+ */
+ songs(options = {}) {
+ var _a, _b;
+ return __awaiter(this, void 0, void 0, function* () {
+ if (!this.client.key) {
+ throw new Error(Constants_1.Constants.REQUIRES_KEY);
+ }
+ if (typeof options !== "object") {
+ throw new Error("'options' must be a type of 'object'");
+ }
+ const per_page = (_a = options.per_page) !== null && _a !== void 0 ? _a : 20;
+ const sort = options.sort && Constants_1.Constants.ARTIST_SORTS.includes(options.sort)
+ ? options.sort
+ : "title";
+ const page = (_b = options.page) !== null && _b !== void 0 ? _b : 1;
+ const data = yield this.client.api.get(`/songs?page=${page}&per_page=${per_page}&sort=${sort}`);
+ const parsed = JSON.parse(data);
+ return parsed.songs.map((s) => new Song_1.Song(this.client, s, true));
+ });
+ }
+ /**
+ * Fetches All Information about the Artist and updates all the existing Properties (Requires Key)
+ * @example const NewArtist = await Artist.fetch();
+ */
+ fetch() {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (!this.client.key) {
+ throw new Error(Constants_1.Constants.REQUIRES_KEY);
+ }
+ const data = yield this.client.api.get(`/artists/${this.id}`);
+ const parsed = JSON.parse(data);
+ this.socialmedia.facebook = parsed.artist.facebook_name;
+ this.socialmedia.twitter = parsed.artist.twitter_name;
+ this.raw = parsed.artist;
+ this.partial = false;
+ return new Artist(this.client, parsed.artist, false);
+ });
+ }
+}
+exports.Artist = Artist;
diff --git a/node_modules/genius-lyrics/dist/Artists/Client.d.ts b/node_modules/genius-lyrics/dist/Artists/Client.d.ts
new file mode 100644
index 0000000..86d6a7c
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Artists/Client.d.ts
@@ -0,0 +1,14 @@
+import { Client } from "../Client";
+import { Artist } from "./Artist";
+export declare class ArtistsClient {
+ readonly client: Client;
+ /**
+ * @example const ArtistsClient = await Genius.Artist.Client(key);
+ */
+ constructor(client: Client);
+ /**
+ * Fetches the Artist using the provided ID (Requires Key)
+ * @example const Artist = await ArtistsClient.get(456537);
+ */
+ get(id: number): Promise<Artist>;
+}
diff --git a/node_modules/genius-lyrics/dist/Artists/Client.js b/node_modules/genius-lyrics/dist/Artists/Client.js
new file mode 100644
index 0000000..530aa0e
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Artists/Client.js
@@ -0,0 +1,40 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ArtistsClient = void 0;
+const Artist_1 = require("./Artist");
+const Constants_1 = require("../Constants");
+class ArtistsClient {
+ /**
+ * @example const ArtistsClient = await Genius.Artist.Client(key);
+ */
+ constructor(client) {
+ this.client = client;
+ }
+ /**
+ * Fetches the Artist using the provided ID (Requires Key)
+ * @example const Artist = await ArtistsClient.get(456537);
+ */
+ get(id) {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (typeof id !== "number") {
+ throw new Error("'id' must be a type of 'number'");
+ }
+ if (!this.client.key) {
+ throw new Error(Constants_1.Constants.REQUIRES_KEY);
+ }
+ const data = yield this.client.api.get(`/artists/${id}`);
+ const parsed = JSON.parse(data);
+ return new Artist_1.Artist(this.client, parsed.response.artist, false);
+ });
+ }
+}
+exports.ArtistsClient = ArtistsClient;
diff --git a/node_modules/genius-lyrics/dist/Client.d.ts b/node_modules/genius-lyrics/dist/Client.d.ts
new file mode 100644
index 0000000..c22064a
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Client.d.ts
@@ -0,0 +1,12 @@
+import { Config } from "./Constants";
+import { Requester } from "./Requester";
+import { ArtistsClient } from "./Artists/Client";
+import { SongsClient } from "./Songs/Client";
+export declare class Client {
+ readonly key?: string | undefined;
+ readonly config: Config;
+ songs: SongsClient;
+ artists: ArtistsClient;
+ api: Requester;
+ constructor(key?: string | undefined, config?: Config);
+}
diff --git a/node_modules/genius-lyrics/dist/Client.js b/node_modules/genius-lyrics/dist/Client.js
new file mode 100644
index 0000000..4e01ebb
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Client.js
@@ -0,0 +1,30 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Client = void 0;
+const Constants_1 = require("./Constants");
+const Utils_1 = require("./Utils");
+const Requester_1 = require("./Requester");
+const Client_1 = require("./Artists/Client");
+const Client_2 = require("./Songs/Client");
+class Client {
+ constructor(key, config = {}) {
+ var _a;
+ this.key = key;
+ this.config = config;
+ if (!["string", "undefined"].includes(typeof key)) {
+ throw new Error(Constants_1.Constants.INV_TOKEN);
+ }
+ if (!(0, Utils_1.checkConfig)(config)) {
+ throw new Error(Constants_1.Constants.INV_CONFIG_OBJ);
+ }
+ this.songs = new Client_2.SongsClient(this);
+ this.artists = new Client_1.ArtistsClient(this);
+ this.api = new Requester_1.Requester(((_a = this.config.origin) === null || _a === void 0 ? void 0 : _a.api) || Constants_1.Constants.BASE_URL, {
+ headers: {
+ "User-Agent": Constants_1.Constants.DEF_USER_AGENT,
+ Authorization: `Bearer ${this.key}`,
+ },
+ });
+ }
+}
+exports.Client = Client;
diff --git a/node_modules/genius-lyrics/dist/Constants.d.ts b/node_modules/genius-lyrics/dist/Constants.d.ts
new file mode 100644
index 0000000..b43012d
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Constants.d.ts
@@ -0,0 +1,20 @@
+import { OptionsOfTextResponseBody } from "got";
+export interface Config {
+ requestOptions?: Omit<OptionsOfTextResponseBody, "responseType">;
+ origin?: {
+ api?: string;
+ url?: string;
+ };
+}
+export declare const Constants: {
+ BASE_URL: string;
+ UN_BASE_URL: string;
+ ARTIST_SORTS: string[];
+ DEF_USER_AGENT: string;
+ REQUIRES_KEY: string;
+ INV_RES_OBJ: string;
+ INV_CONFIG_OBJ: string;
+ INV_TOKEN: string;
+ NO_RESULT: string;
+ ERR_W_MSG: (err: any, msg: any) => string;
+};
diff --git a/node_modules/genius-lyrics/dist/Constants.js b/node_modules/genius-lyrics/dist/Constants.js
new file mode 100644
index 0000000..6951e4d
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Constants.js
@@ -0,0 +1,15 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Constants = void 0;
+exports.Constants = {
+ BASE_URL: "https://api.genius.com",
+ UN_BASE_URL: "https://genius.com/api",
+ ARTIST_SORTS: ["title", "popularity"],
+ DEF_USER_AGENT: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
+ REQUIRES_KEY: "This action requires a valid Genius Token",
+ INV_RES_OBJ: "Invalid response object",
+ INV_CONFIG_OBJ: "Invalid config",
+ INV_TOKEN: "Invalid Genius Token",
+ NO_RESULT: "No result was found",
+ ERR_W_MSG: (err, msg) => `Returned ${err} with message: ${msg}`,
+};
diff --git a/node_modules/genius-lyrics/dist/Requester.d.ts b/node_modules/genius-lyrics/dist/Requester.d.ts
new file mode 100644
index 0000000..81f059e
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Requester.d.ts
@@ -0,0 +1,11 @@
+import { OptionsOfTextResponseBody } from "got";
+/**
+ * Refer [got.Options](https://www.npmjs.com/package/got) for documentation of `OptionsOfTextResponseBody`
+ */
+export declare class Requester {
+ readonly url: string;
+ readonly options: OptionsOfTextResponseBody;
+ constructor(url: string, options: OptionsOfTextResponseBody);
+ get(route: string, headers?: Record<string, string>): Promise<string>;
+ _handleError(err: unknown): unknown;
+}
diff --git a/node_modules/genius-lyrics/dist/Requester.js b/node_modules/genius-lyrics/dist/Requester.js
new file mode 100644
index 0000000..08711bf
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Requester.js
@@ -0,0 +1,71 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Requester = void 0;
+const got_1 = __importStar(require("got"));
+const Constants_1 = require("./Constants");
+/**
+ * Refer [got.Options](https://www.npmjs.com/package/got) for documentation of `OptionsOfTextResponseBody`
+ */
+class Requester {
+ constructor(url, options) {
+ this.url = url;
+ this.options = options;
+ }
+ get(route, headers) {
+ var _a;
+ return __awaiter(this, void 0, void 0, function* () {
+ try {
+ const { body } = yield got_1.default.get(`${this.url}${route}`, Object.assign(Object.assign({}, this.options), { headers: Object.assign(Object.assign({}, headers), (_a = this.options) === null || _a === void 0 ? void 0 : _a.headers) }));
+ return body;
+ }
+ catch (err) {
+ throw this._handleError(err);
+ }
+ });
+ }
+ _handleError(err) {
+ var _a;
+ if (err instanceof got_1.RequestError) {
+ if (err.response) {
+ switch (err.response.statusCode) {
+ case 401:
+ return new Error(Constants_1.Constants.INV_TOKEN);
+ case 404:
+ return new Error(Constants_1.Constants.NO_RESULT);
+ default:
+ return new Error(Constants_1.Constants.ERR_W_MSG(err.response.statusCode, (_a = err.response.statusMessage) !== null && _a !== void 0 ? _a : "-"));
+ }
+ }
+ }
+ return err;
+ }
+}
+exports.Requester = Requester;
diff --git a/node_modules/genius-lyrics/dist/Songs/Client.d.ts b/node_modules/genius-lyrics/dist/Songs/Client.d.ts
new file mode 100644
index 0000000..00b54ae
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Songs/Client.d.ts
@@ -0,0 +1,23 @@
+import { Client } from "../";
+import { Song } from "./Song";
+export interface SongSearchOptions {
+ sanitizeQuery: boolean;
+}
+export declare class SongsClient {
+ readonly client: Client;
+ /**
+ * @example const SongsClient = new Genius.Songs.Client(key);
+ */
+ constructor(client: Client);
+ /**
+ * Searches for songs for the provided query (Key is optional)
+ * @example const SearchResults = await SongsClient.search("faded");
+ */
+ search(query: string, options?: Partial<SongSearchOptions>): Promise<Song[]>;
+ /**
+ * Fetches the Song using the provided ID (Requires Key)
+ * @example const Song = await SongsClient.get(3276244);
+ */
+ get(id: number): Promise<Song>;
+ sanitizeQuery(query: string): string;
+}
diff --git a/node_modules/genius-lyrics/dist/Songs/Client.js b/node_modules/genius-lyrics/dist/Songs/Client.js
new file mode 100644
index 0000000..be25629
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Songs/Client.js
@@ -0,0 +1,89 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.SongsClient = void 0;
+const got_1 = __importDefault(require("got"));
+const Song_1 = require("./Song");
+const Constants_1 = require("../Constants");
+class SongsClient {
+ /**
+ * @example const SongsClient = new Genius.Songs.Client(key);
+ */
+ constructor(client) {
+ this.client = client;
+ }
+ /**
+ * Searches for songs for the provided query (Key is optional)
+ * @example const SearchResults = await SongsClient.search("faded");
+ */
+ search(query, options) {
+ var _a, _b, _c, _d;
+ return __awaiter(this, void 0, void 0, function* () {
+ const { sanitizeQuery } = Object.assign({ sanitizeQuery: true }, options);
+ if (typeof query !== "string") {
+ throw new Error("'query' must be a type of 'string'");
+ }
+ const term = encodeURIComponent(sanitizeQuery ? this.sanitizeQuery(query) : query);
+ let result = [];
+ if (this.client.key) {
+ const data = yield this.client.api.get(`/search?q=${term}`);
+ const parsed = JSON.parse(data);
+ result = parsed.response.hits;
+ }
+ else {
+ const res = yield got_1.default.get(`${((_a = this.client.config.origin) === null || _a === void 0 ? void 0 : _a.url) || Constants_1.Constants.UN_BASE_URL}/search/multi?per_page=5&q=${term}`, Object.assign(Object.assign({}, this.client.config.requestOptions), { headers: Object.assign({ "User-Agent": Constants_1.Constants.DEF_USER_AGENT }, (_b = this.client.config.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
+ const parsed = JSON.parse(res.body);
+ if (!((_c = parsed === null || parsed === void 0 ? void 0 : parsed.response) === null || _c === void 0 ? void 0 : _c.sections)) {
+ throw new Error(Constants_1.Constants.NO_RESULT);
+ }
+ const __hits = parsed.response.sections.find((s) => s.type === "song");
+ if (!((_d = __hits === null || __hits === void 0 ? void 0 : __hits.hits) === null || _d === void 0 ? void 0 : _d.length)) {
+ throw new Error(Constants_1.Constants.NO_RESULT);
+ }
+ result = __hits.hits;
+ }
+ return result
+ .filter((s) => s.type === "song")
+ .map((s) => new Song_1.Song(this.client, s.result, true));
+ });
+ }
+ /**
+ * Fetches the Song using the provided ID (Requires Key)
+ * @example const Song = await SongsClient.get(3276244);
+ */
+ get(id) {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (typeof id !== "number") {
+ throw new Error("'id' must be a type of 'number'");
+ }
+ if (!this.client.key) {
+ throw new Error(Constants_1.Constants.REQUIRES_KEY);
+ }
+ const data = yield this.client.api.get(`/songs/${id}`);
+ const parsed = JSON.parse(data);
+ return new Song_1.Song(this.client, parsed.response.song, false);
+ });
+ }
+ // Source: https://github.com/farshed/genius-lyrics-api/blob/110397a9f05fe20c4ded92418430f665f074c4e4/lib/utils/index.js#L15
+ sanitizeQuery(query) {
+ return query
+ .toLowerCase()
+ .replace(/ *\([^)]*\) */g, "")
+ .replace(/ *\[[^\]]*]/, "")
+ .replace(/feat.|ft./g, "")
+ .replace(/\s+/g, " ")
+ .trim();
+ }
+}
+exports.SongsClient = SongsClient;
diff --git a/node_modules/genius-lyrics/dist/Songs/Song.d.ts b/node_modules/genius-lyrics/dist/Songs/Song.d.ts
new file mode 100644
index 0000000..8e51887
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Songs/Song.d.ts
@@ -0,0 +1,31 @@
+import { Client } from "../Client";
+import { Album } from "../Albums/Album";
+import { Artist } from "../Artists/Artist";
+export declare class Song {
+ readonly client: Client;
+ partial: boolean;
+ title: string;
+ fullTitle: string;
+ featuredTitle: string;
+ id: number;
+ thumbnail: string;
+ image: string;
+ url: string;
+ endpoint: string;
+ artist: Artist;
+ album?: Album;
+ releasedAt?: Date;
+ raw: any;
+ constructor(client: Client, res: any, partial?: boolean);
+ /**
+ * Fetches Lyrics of the Track
+ * @example const Lyrics = await Song.lyrics(true);
+ */
+ lyrics(removeChorus?: boolean): Promise<string>;
+ /**
+ * Fetches All Information about the Track and updates all the existing Properties (Requires Key)
+ * @example const NewSong = await Song.fetch();
+ */
+ fetch(): Promise<this>;
+ removeChorus(lyrics: string): string;
+}
diff --git a/node_modules/genius-lyrics/dist/Songs/Song.js b/node_modules/genius-lyrics/dist/Songs/Song.js
new file mode 100644
index 0000000..6b577c8
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Songs/Song.js
@@ -0,0 +1,103 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.Song = void 0;
+const got_1 = __importDefault(require("got"));
+const cheerio_1 = __importDefault(require("cheerio"));
+const Album_1 = require("../Albums/Album");
+const Artist_1 = require("../Artists/Artist");
+const Constants_1 = require("../Constants");
+class Song {
+ constructor(client, res, partial = false) {
+ this.client = client;
+ this.partial = partial;
+ this.title = res.title;
+ this.fullTitle = res.full_title;
+ this.featuredTitle = res.title_with_featured;
+ this.id = +res.id;
+ this.thumbnail = res.header_image_thumbnail_url;
+ this.image = res.header_image_url;
+ this.url = res.url;
+ this.endpoint = res.api_path;
+ this.artist = new Artist_1.Artist(this.client, res.primary_artist, true);
+ this.partial = partial;
+ this.album =
+ !this.partial && res.album
+ ? new Album_1.Album(res.album, this.artist)
+ : undefined;
+ this.releasedAt =
+ !this.partial && res.release_date
+ ? new Date(res.release_date)
+ : undefined;
+ this.raw = res;
+ }
+ /**
+ * Fetches Lyrics of the Track
+ * @example const Lyrics = await Song.lyrics(true);
+ */
+ lyrics(removeChorus = false) {
+ var _a;
+ return __awaiter(this, void 0, void 0, function* () {
+ if (typeof removeChorus !== "boolean") {
+ throw new Error("'removeChorus' must be a type of 'boolean'");
+ }
+ const { body } = yield got_1.default.get(this.url, Object.assign(Object.assign({}, this.client.config.requestOptions), { headers: Object.assign({ "User-Agent": Constants_1.Constants.DEF_USER_AGENT }, (_a = this.client.config.requestOptions) === null || _a === void 0 ? void 0 : _a.headers) }));
+ const $ = cheerio_1.default.load(body);
+ const selectors = [
+ () => $(".lyrics").text().trim(),
+ () => $("div[class*='Lyrics__Container']")
+ .toArray()
+ .map((x) => {
+ const ele = $(x);
+ ele.find("br").replaceWith("\n");
+ return ele.text().trim();
+ })
+ .join("\n\n")
+ .trim(),
+ ];
+ for (const x of selectors) {
+ const lyrics = x();
+ if (lyrics === null || lyrics === void 0 ? void 0 : lyrics.length) {
+ return removeChorus ? this.removeChorus(lyrics) : lyrics;
+ }
+ }
+ throw new Error(Constants_1.Constants.NO_RESULT);
+ });
+ }
+ /**
+ * Fetches All Information about the Track and updates all the existing Properties (Requires Key)
+ * @example const NewSong = await Song.fetch();
+ */
+ fetch() {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (!this.client.key) {
+ throw new Error(Constants_1.Constants.REQUIRES_KEY);
+ }
+ const data = yield this.client.api.get(`/songs/${this.id}`);
+ const parsed = JSON.parse(data);
+ this.album = parsed.response.song.album
+ ? new Album_1.Album(parsed.response.song.album, this.artist)
+ : undefined;
+ this.releasedAt = parsed.response.song.release_date
+ ? new Date(parsed.response.song.release_date)
+ : undefined;
+ this.partial = false;
+ return this;
+ });
+ }
+ removeChorus(lyrics) {
+ return lyrics.replace(/^\[[^\]]+\]$/g, "");
+ }
+}
+exports.Song = Song;
diff --git a/node_modules/genius-lyrics/dist/Utils.d.ts b/node_modules/genius-lyrics/dist/Utils.d.ts
new file mode 100644
index 0000000..3c4ed85
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Utils.d.ts
@@ -0,0 +1,2 @@
+import { Config } from "./Constants";
+export declare const checkConfig: (config: any) => config is Config;
diff --git a/node_modules/genius-lyrics/dist/Utils.js b/node_modules/genius-lyrics/dist/Utils.js
new file mode 100644
index 0000000..3d6b785
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/Utils.js
@@ -0,0 +1,20 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.checkConfig = void 0;
+const checkConfig = (config) => {
+ if (!config || typeof config !== "object") {
+ return false;
+ }
+ if (config.requestOptions && typeof config.requestOptions !== "object") {
+ return false;
+ }
+ if (config.origin) {
+ if (typeof config.origin !== "object" ||
+ (config.origin.api && typeof config.origin.api !== "string") ||
+ (config.origin.url && typeof config.origin.url !== "string")) {
+ return false;
+ }
+ }
+ return true;
+};
+exports.checkConfig = checkConfig;
diff --git a/node_modules/genius-lyrics/dist/index.d.ts b/node_modules/genius-lyrics/dist/index.d.ts
new file mode 100644
index 0000000..f750b8a
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/index.d.ts
@@ -0,0 +1,33 @@
+import { Client } from "./Client";
+import { SongsClient } from "./Songs/Client";
+import { ArtistsClient } from "./Artists/Client";
+import { Song } from "./Songs/Song";
+import { Artist } from "./Artists/Artist";
+import { Album } from "./Albums/Album";
+import { Constants, Config } from "./Constants";
+import * as Utils from "./Utils";
+declare const version: string;
+export { Client, SongsClient, ArtistsClient, Song, Artist, Album, Constants, Config, Utils, version, };
+declare const _default: {
+ Client: typeof Client;
+ SongsClient: typeof SongsClient;
+ ArtistsClient: typeof ArtistsClient;
+ Song: typeof Song;
+ Artist: typeof Artist;
+ Album: typeof Album;
+ Constants: {
+ BASE_URL: string;
+ UN_BASE_URL: string;
+ ARTIST_SORTS: string[];
+ DEF_USER_AGENT: string;
+ REQUIRES_KEY: string;
+ INV_RES_OBJ: string;
+ INV_CONFIG_OBJ: string;
+ INV_TOKEN: string;
+ NO_RESULT: string;
+ ERR_W_MSG: (err: any, msg: any) => string;
+ };
+ Utils: typeof Utils;
+ version: string;
+};
+export default _default;
diff --git a/node_modules/genius-lyrics/dist/index.js b/node_modules/genius-lyrics/dist/index.js
new file mode 100644
index 0000000..e230919
--- /dev/null
+++ b/node_modules/genius-lyrics/dist/index.js
@@ -0,0 +1,51 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.version = exports.Utils = exports.Constants = exports.Album = exports.Artist = exports.Song = exports.ArtistsClient = exports.SongsClient = exports.Client = void 0;
+const Client_1 = require("./Client");
+Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.Client; } });
+const Client_2 = require("./Songs/Client");
+Object.defineProperty(exports, "SongsClient", { enumerable: true, get: function () { return Client_2.SongsClient; } });
+const Client_3 = require("./Artists/Client");
+Object.defineProperty(exports, "ArtistsClient", { enumerable: true, get: function () { return Client_3.ArtistsClient; } });
+const Song_1 = require("./Songs/Song");
+Object.defineProperty(exports, "Song", { enumerable: true, get: function () { return Song_1.Song; } });
+const Artist_1 = require("./Artists/Artist");
+Object.defineProperty(exports, "Artist", { enumerable: true, get: function () { return Artist_1.Artist; } });
+const Album_1 = require("./Albums/Album");
+Object.defineProperty(exports, "Album", { enumerable: true, get: function () { return Album_1.Album; } });
+const Constants_1 = require("./Constants");
+Object.defineProperty(exports, "Constants", { enumerable: true, get: function () { return Constants_1.Constants; } });
+const Utils = __importStar(require("./Utils"));
+exports.Utils = Utils;
+const version = require("../package.json").version;
+exports.version = version;
+exports.default = {
+ Client: Client_1.Client,
+ SongsClient: Client_2.SongsClient,
+ ArtistsClient: Client_3.ArtistsClient,
+ Song: Song_1.Song,
+ Artist: Artist_1.Artist,
+ Album: Album_1.Album,
+ Constants: Constants_1.Constants,
+ Utils,
+ version,
+};