From 262dbe23e7a744734f0ad27648cda543f66fb90f Mon Sep 17 00:00:00 2001 From: Snowflake107 Date: Tue, 11 May 2021 19:48:11 +0545 Subject: [PATCH] bump extractors --- package.json | 2 +- src/Player.ts | 2 +- src/index.ts | 1 + src/utils/env.ts | 19 ++++++++++++++ yarn.lock | 64 ++++++++++-------------------------------------- 5 files changed, 35 insertions(+), 53 deletions(-) create mode 100644 src/utils/env.ts diff --git a/package.json b/package.json index 35a7a3f..e4d3251 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@babel/core": "^7.13.16", "@babel/preset-env": "^7.13.15", "@babel/preset-typescript": "^7.13.0", - "@discord-player/extractor": "^2.0.0", + "@discord-player/extractor": "^3.0.0", "@discordjs/opus": "^0.5.0", "@types/node": "^14.14.41", "@types/ws": "^7.4.1", diff --git a/src/Player.ts b/src/Player.ts index 54f8a3c..ae57ed2 100644 --- a/src/Player.ts +++ b/src/Player.ts @@ -959,7 +959,7 @@ export class Player extends EventEmitter { const extractor = Util.require('@discord-player/extractor'); if (!extractor) throw new PlayerError("Cannot call 'Player.lyrics()' without '@discord-player/extractor'"); - const data = await extractor.Lyrics(query); + const data = await extractor.Lyrics.init().search(query); if (Array.isArray(data)) return null; return data; diff --git a/src/index.ts b/src/index.ts index 4dd3a82..704ea54 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ export { AudioFilters } from './utils/AudioFilters'; export * as Constants from './utils/Constants'; +export { Env as env } from './utils/env'; export { ExtractorModel } from './Structures/ExtractorModel'; export { Player } from './Player'; export { Util } from './utils/Util'; diff --git a/src/utils/env.ts b/src/utils/env.ts new file mode 100644 index 0000000..dba993d --- /dev/null +++ b/src/utils/env.ts @@ -0,0 +1,19 @@ +// @ts-ignore +import { Store, Client } from 'soundcloud-scraper'; +import { YouTube } from 'youtube-sr'; + +export class Env { + static get SoundcloudClient() { + return Client; + } + + static get SoundcloudStore() { + const store = Store as Map; + const setAPIkey = (newKey: string) => store.set('SOUNDCLOUD_API_KEY', newKey); + return { setAPIkey }; + } + + static get youtube() { + return YouTube; + } +} diff --git a/yarn.lock b/yarn.lock index 85b3e7f..24d141b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -871,13 +871,13 @@ "@babel/helper-validator-identifier" "^7.12.11" to-fast-properties "^2.0.0" -"@discord-player/extractor@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@discord-player/extractor/-/extractor-2.0.0.tgz#3879e51d64b72d4dcee9338bdece5251d006c746" - integrity sha512-qNyF0dkLNRYvtVtLLO022RV8DzToCPJqbuAOqSWCSdkXiKSGoqTdKcZI9I/Lb87mchYuuakOXyPRvRwkAruX6w== +"@discord-player/extractor@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@discord-player/extractor/-/extractor-3.0.0.tgz#2baa733da054b991f83417054cad1575cf57c4ab" + integrity sha512-6A2QmrbQXTpv1oequiAYQMnWzvv1fu9Yg0GJwAMoLUXZjvb5Yoak2lnohsDI1Hc14LW//Z5xyLGtmFivTWTXDQ== dependencies: - genius-lyrics "^4.2.7" - jsdom "^16.5.2" + genius-lyrics "^4.2.9" + jsdom "^16.5.3" node-fetch "^2.6.1" reverbnation-scraper "^2.0.0" @@ -1656,17 +1656,6 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -css-select@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/css-select/-/css-select-3.1.2.tgz#d52cbdc6fee379fba97fb0d3925abbd18af2d9d8" - integrity sha512-qmss1EihSuBNWNNhHjxzxSfJoFBM/lERB/Q4EnsJQQC62R2evJDW481091oAdOr9uh46/0n4nrg0It5cAnj1RA== - dependencies: - boolbase "^1.0.0" - css-what "^4.0.0" - domhandler "^4.0.0" - domutils "^2.4.3" - nth-check "^2.0.0" - css-select@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/css-select/-/css-select-4.1.2.tgz#8b52b6714ed3a80d8221ec971c543f3b12653286" @@ -1678,11 +1667,6 @@ css-select@^4.1.2: domutils "^2.6.0" nth-check "^2.0.0" -css-what@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/css-what/-/css-what-4.0.0.tgz#35e73761cab2eeb3d3661126b23d7aa0e8432233" - integrity sha512-teijzG7kwYfNVsUh2H/YN62xW3KK9YhXEgSlbxMlcyjPNvdKJqFx5lrwlJgoFP1ZHlB89iGDlo/JyshKeRhv5A== - css-what@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.0.0.tgz#f0bf4f8bac07582722346ab243f6a35b512cfc47" @@ -1895,7 +1879,7 @@ domexception@^2.0.1: dependencies: webidl-conversions "^5.0.0" -domhandler@^4.0.0, domhandler@^4.1.0: +domhandler@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.1.0.tgz#c1d8d494d5ec6db22de99e46a149c2a4d23ddd43" integrity sha512-/6/kmsGlMY4Tup/nGVutdrK9yQi4YjWVcVeoQmixpzjOUK1U7pQkvAPHBJeUxOgxF0J8f8lwCJSlCfD0V4CMGQ== @@ -1909,15 +1893,6 @@ domhandler@^4.2.0: dependencies: domelementtype "^2.2.0" -domutils@^2.4.3: - version "2.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.5.1.tgz#9b8e84b5d9f788499ae77506ea832e9b4f9aa1c0" - integrity sha512-hO1XwHMGAthA/1KL7c83oip/6UWo3FlUNIuWiWKltoiQ5oCOiqths8KknvY2jpOohUoUgnwa/+Rm7UpwpSbY/Q== - dependencies: - dom-serializer "^1.0.1" - domelementtype "^2.2.0" - domhandler "^4.1.0" - domutils@^2.5.2, domutils@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.6.0.tgz#2e15c04185d43fb16ae7057cb76433c6edb938b7" @@ -2345,13 +2320,13 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -genius-lyrics@^4.2.7: - version "4.2.7" - resolved "https://registry.yarnpkg.com/genius-lyrics/-/genius-lyrics-4.2.7.tgz#e85f65eb2de4ea2c0af1e11b13dda11e0c9744a9" - integrity sha512-laoeF2/P+Ed4uewuG6OeqymKTNdfGuymkCohMHIgr3g2DwziW49USXcEGCog1vnEDCpf2LhznNi3WOeLeSmAww== +genius-lyrics@^4.2.9: + version "4.2.9" + resolved "https://registry.yarnpkg.com/genius-lyrics/-/genius-lyrics-4.2.9.tgz#87d12946589d3e96df4e100c51805aa5046de2c7" + integrity sha512-BQm/gmaXEckLAc/Z9ZsGNWxh4CHudx0G1Key8Rnv0xFcqmrxIvssJIDBgDPJLqB6dpVas3uj6LQng1yMFtxfNA== dependencies: axios "^0.21.1" - node-html-parser "^3.0.4" + cheerio "^1.0.0-rc.9" gensync@^1.0.0-beta.2: version "1.0.0-beta.2" @@ -2511,11 +2486,6 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" -he@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - himalaya@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/himalaya/-/himalaya-1.1.0.tgz#31724ae9d35714cd7c6f4be94888953f3604606a" @@ -2892,7 +2862,7 @@ jsdoc@^3.6.3: taffydb "2.6.2" underscore "~1.10.2" -jsdom@^16.5.2: +jsdom@^16.5.3: version "16.5.3" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.5.3.tgz#13a755b3950eb938b4482c407238ddf16f0d2136" integrity sha512-Qj1H+PEvUsOtdPJ056ewXM4UJPCi4hhLA8wpiz9F2YvsRBhuFsXxtrIFAgGBDynQA9isAMGE91PfUYbdMPXuTA== @@ -3278,14 +3248,6 @@ node-fetch@2.6.1, node-fetch@^2.6.0, node-fetch@^2.6.1: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== -node-html-parser@^3.0.4: - version "3.1.5" - resolved "https://registry.yarnpkg.com/node-html-parser/-/node-html-parser-3.1.5.tgz#ffb62f2a336b6b634f41f3315487fe446fb9d7b5" - integrity sha512-/XKKdWbSUymlXTjtNBcDlmM7Jp8S/BqGMzLx7r2bd2NMjTXz+ofuLcz0Bl3VT0vTvVzF+N511FNLrZt4HVitXA== - dependencies: - css-select "^3.1.2" - he "1.2.0" - node-releases@^1.1.71: version "1.1.71" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb"