diff options
Diffstat (limited to 'node_modules/genius-lyrics')
23 files changed, 854 insertions, 854 deletions
diff --git a/node_modules/genius-lyrics/LICENSE b/node_modules/genius-lyrics/LICENSE index 0112089..d1e80db 100644 --- a/node_modules/genius-lyrics/LICENSE +++ b/node_modules/genius-lyrics/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2021 ZYROUGE - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License
+
+Copyright (c) 2021 ZYROUGE
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/genius-lyrics/README.md b/node_modules/genius-lyrics/README.md index 949eee0..664a4e9 100644 --- a/node_modules/genius-lyrics/README.md +++ b/node_modules/genius-lyrics/README.md @@ -1,71 +1,71 @@ -<h1 align="center">Genius Lyrics 🎵</h1> - -[![npm](https://img.shields.io/npm/v/genius-lyrics)](https://npmjs.com/package/genius-lyrics) -[![npm](https://img.shields.io/npm/dw/genius-lyrics)](https://npmjs.com/package/genius-lyrics) -[![npm](https://img.shields.io/npm/l/genius-lyrics)](https://npmjs.com/package/genius-lyrics) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fzyrouge%2Fgenius-lyrics.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzyrouge%2Fgenius-lyrics?ref=badge_shield) -[![Documentation](https://github.com/zyrouge/genius-lyrics/actions/workflows/docs.yml/badge.svg?branch=master)](https://github.com/zyrouge/genius-lyrics/actions/workflows/docs.yml) - -## 🤔 Whats is this? - -Just a simple lyrics fetcher that uses [Genius](https://genius.com). This also has official API implementations. - -## 💻 Installation - -``` -npm install genius-lyrics -``` - -## ⚙️ Usage - -```js -const Genius = require("genius-lyrics"); -const Client = new Genius.Client("top-secret-optional-key"); -``` - -## 📎 Links - -- [Documentation](https://genius-lyrics.js.org/) -- [NPM](https://npmjs.com/genius-lyrics) -- [GitHub](https://github.com/zyrouge/genius-lyrics) - -## ✏️ Examples - -### Requiring - -**JavaScript** - -```js -const Genius = require("genius-lyrics"); -const Client = new Genius.Client("top-secret-optional-key"); // Scrapes if no key is provided -``` - -**TypeScript** - -```ts -import Genius from "genius-lyrics"; -const Client = new Genius.Client("top-secret-optional-key"); // Scrapes if no key is provided -``` - -### Fetching a Song and Lyrics - -```js -const searches = await Client.songs.search("faded"); - -// Pick first one -const firstSong = searches[0]; -console.log("About the Song:\n", firstSong, "\n"); - -// Ok lets get the lyrics -const lyrics = await firstSong.lyrics(); -console.log("Lyrics of the Song:\n", lyrics, "\n"); -``` - -### Fetching an Artist - -```js -const artist = await Client.artists.get(456537); -console.log("About the Artist:\n", artist, "\n"); -``` - -<br> +<h1 align="center">Genius Lyrics 🎵</h1>
+
+[![npm](https://img.shields.io/npm/v/genius-lyrics)](https://npmjs.com/package/genius-lyrics)
+[![npm](https://img.shields.io/npm/dw/genius-lyrics)](https://npmjs.com/package/genius-lyrics)
+[![npm](https://img.shields.io/npm/l/genius-lyrics)](https://npmjs.com/package/genius-lyrics)
+[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fzyrouge%2Fgenius-lyrics.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzyrouge%2Fgenius-lyrics?ref=badge_shield)
+[![Documentation](https://github.com/zyrouge/genius-lyrics/actions/workflows/docs.yml/badge.svg?branch=master)](https://github.com/zyrouge/genius-lyrics/actions/workflows/docs.yml)
+
+## 🤔 Whats is this?
+
+Just a simple lyrics fetcher that uses [Genius](https://genius.com). This also has official API implementations.
+
+## 💻 Installation
+
+```
+npm install genius-lyrics
+```
+
+## ⚙️ Usage
+
+```js
+const Genius = require("genius-lyrics");
+const Client = new Genius.Client("top-secret-optional-key");
+```
+
+## 📎 Links
+
+- [Documentation](https://genius-lyrics.js.org/)
+- [NPM](https://npmjs.com/genius-lyrics)
+- [GitHub](https://github.com/zyrouge/genius-lyrics)
+
+## ✏️ Examples
+
+### Requiring
+
+**JavaScript**
+
+```js
+const Genius = require("genius-lyrics");
+const Client = new Genius.Client("top-secret-optional-key"); // Scrapes if no key is provided
+```
+
+**TypeScript**
+
+```ts
+import Genius from "genius-lyrics";
+const Client = new Genius.Client("top-secret-optional-key"); // Scrapes if no key is provided
+```
+
+### Fetching a Song and Lyrics
+
+```js
+const searches = await Client.songs.search("faded");
+
+// Pick first one
+const firstSong = searches[0];
+console.log("About the Song:\n", firstSong, "\n");
+
+// Ok lets get the lyrics
+const lyrics = await firstSong.lyrics();
+console.log("Lyrics of the Song:\n", lyrics, "\n");
+```
+
+### Fetching an Artist
+
+```js
+const artist = await Client.artists.get(456537);
+console.log("About the Artist:\n", artist, "\n");
+```
+
+<br>
diff --git a/node_modules/genius-lyrics/dist/Albums/Album.d.ts b/node_modules/genius-lyrics/dist/Albums/Album.d.ts index 36d5ec7..c159db1 100644 --- a/node_modules/genius-lyrics/dist/Albums/Album.d.ts +++ b/node_modules/genius-lyrics/dist/Albums/Album.d.ts @@ -1,13 +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); -} +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 index 4978f88..94cc732 100644 --- a/node_modules/genius-lyrics/dist/Albums/Album.js +++ b/node_modules/genius-lyrics/dist/Albums/Album.js @@ -1,27 +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; +"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 index 34928e7..5d6593a 100644 --- a/node_modules/genius-lyrics/dist/Artists/Artist.d.ts +++ b/node_modules/genius-lyrics/dist/Artists/Artist.d.ts @@ -1,35 +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>; -} +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 index 112f45d..998c3d0 100644 --- a/node_modules/genius-lyrics/dist/Artists/Artist.js +++ b/node_modules/genius-lyrics/dist/Artists/Artist.js @@ -1,78 +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; +"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 index 86d6a7c..1131898 100644 --- a/node_modules/genius-lyrics/dist/Artists/Client.d.ts +++ b/node_modules/genius-lyrics/dist/Artists/Client.d.ts @@ -1,14 +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>; -} +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 index 530aa0e..a0e1ce6 100644 --- a/node_modules/genius-lyrics/dist/Artists/Client.js +++ b/node_modules/genius-lyrics/dist/Artists/Client.js @@ -1,40 +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; +"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 index c22064a..c9b42a9 100644 --- a/node_modules/genius-lyrics/dist/Client.d.ts +++ b/node_modules/genius-lyrics/dist/Client.d.ts @@ -1,12 +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); -} +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 index 4e01ebb..ea6be82 100644 --- a/node_modules/genius-lyrics/dist/Client.js +++ b/node_modules/genius-lyrics/dist/Client.js @@ -1,30 +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; +"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 index b43012d..fc3cfb6 100644 --- a/node_modules/genius-lyrics/dist/Constants.d.ts +++ b/node_modules/genius-lyrics/dist/Constants.d.ts @@ -1,20 +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; -}; +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 index 6951e4d..362a4dd 100644 --- a/node_modules/genius-lyrics/dist/Constants.js +++ b/node_modules/genius-lyrics/dist/Constants.js @@ -1,15 +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}`, -}; +"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 index 81f059e..a2b864e 100644 --- a/node_modules/genius-lyrics/dist/Requester.d.ts +++ b/node_modules/genius-lyrics/dist/Requester.d.ts @@ -1,11 +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; -} +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 index 08711bf..f2137f5 100644 --- a/node_modules/genius-lyrics/dist/Requester.js +++ b/node_modules/genius-lyrics/dist/Requester.js @@ -1,71 +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; +"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 index 00b54ae..cc8c499 100644 --- a/node_modules/genius-lyrics/dist/Songs/Client.d.ts +++ b/node_modules/genius-lyrics/dist/Songs/Client.d.ts @@ -1,23 +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; -} +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 index be25629..139e2d7 100644 --- a/node_modules/genius-lyrics/dist/Songs/Client.js +++ b/node_modules/genius-lyrics/dist/Songs/Client.js @@ -1,89 +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; +"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 index 8e51887..54cef31 100644 --- a/node_modules/genius-lyrics/dist/Songs/Song.d.ts +++ b/node_modules/genius-lyrics/dist/Songs/Song.d.ts @@ -1,31 +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; -} +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 index 6b577c8..0dff6dd 100644 --- a/node_modules/genius-lyrics/dist/Songs/Song.js +++ b/node_modules/genius-lyrics/dist/Songs/Song.js @@ -1,103 +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; +"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 index 3c4ed85..345c236 100644 --- a/node_modules/genius-lyrics/dist/Utils.d.ts +++ b/node_modules/genius-lyrics/dist/Utils.d.ts @@ -1,2 +1,2 @@ -import { Config } from "./Constants"; -export declare const checkConfig: (config: any) => config is Config; +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 index 3d6b785..ad92b88 100644 --- a/node_modules/genius-lyrics/dist/Utils.js +++ b/node_modules/genius-lyrics/dist/Utils.js @@ -1,20 +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; +"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 index f750b8a..f762f2b 100644 --- a/node_modules/genius-lyrics/dist/index.d.ts +++ b/node_modules/genius-lyrics/dist/index.d.ts @@ -1,33 +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; +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 index e230919..a970f08 100644 --- a/node_modules/genius-lyrics/dist/index.js +++ b/node_modules/genius-lyrics/dist/index.js @@ -1,51 +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, -}; +"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,
+};
diff --git a/node_modules/genius-lyrics/package.json b/node_modules/genius-lyrics/package.json index 842c336..350ee84 100644 --- a/node_modules/genius-lyrics/package.json +++ b/node_modules/genius-lyrics/package.json @@ -1,44 +1,44 @@ -{ - "name": "genius-lyrics", - "version": "4.3.5", - "description": "Fetches Lyrics from Genius at Ease.", - "main": "./dist/index.js", - "files": [ - "dist" - ], - "scripts": { - "build": "node ./scripts/build && tsc", - "docs": "typedoc && node ./scripts/docs", - "test": "ava --verbose" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/zyrouge/genius-lyrics.git" - }, - "author": "ZYROUGE", - "license": "MIT", - "bugs": { - "url": "https://github.com/zyrouge/genius-lyrics/issues" - }, - "homepage": "https://genius-lyrics.js.org", - "dependencies": { - "cheerio": "^1.0.0-rc.9", - "got": "^11.8.2" - }, - "devDependencies": { - "ava": "^3.15.0", - "ts-node": "^9.1.1", - "typedoc": "^0.22.5", - "typedoc-plugin-missing-exports": "^0.22.3", - "typescript": "^4.4.4" - }, - "keywords": [ - "lyrics", - "genius", - "genius-lyrics", - "lyrics-api", - "discord-lyrics", - "lyrics-genius", - "genius-parser" - ] -} +{
+ "name": "genius-lyrics",
+ "version": "4.3.5",
+ "description": "Fetches Lyrics from Genius at Ease.",
+ "main": "./dist/index.js",
+ "files": [
+ "dist"
+ ],
+ "scripts": {
+ "build": "node ./scripts/build && tsc",
+ "docs": "typedoc && node ./scripts/docs",
+ "test": "ava --verbose"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/zyrouge/genius-lyrics.git"
+ },
+ "author": "ZYROUGE",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/zyrouge/genius-lyrics/issues"
+ },
+ "homepage": "https://genius-lyrics.js.org",
+ "dependencies": {
+ "cheerio": "^1.0.0-rc.9",
+ "got": "^11.8.2"
+ },
+ "devDependencies": {
+ "ava": "^3.15.0",
+ "ts-node": "^9.1.1",
+ "typedoc": "^0.22.5",
+ "typedoc-plugin-missing-exports": "^0.22.3",
+ "typescript": "^4.4.4"
+ },
+ "keywords": [
+ "lyrics",
+ "genius",
+ "genius-lyrics",
+ "lyrics-api",
+ "discord-lyrics",
+ "lyrics-genius",
+ "genius-parser"
+ ]
+}
|