diff --git a/package.json b/package.json index 63c8eea..53da6e1 100644 --- a/package.json +++ b/package.json @@ -41,13 +41,13 @@ "@apollo/server": "^4.9.3", "@discordjs/opus": "0.8.0", "@discordjs/voice": "^0.16.0", + "@distube/ytdl-core": "^4.13.5", "@sentry/node": "^5.15.5", "async": "^3.2.4", "body-parser": "^1.20.2", "bufferutil": "^4.0.7", "cors": "^2.8.5", "discord-akairo": "https://github.com/discord-akairo/discord-akairo", - "discord-ytdl-core": "^5.0.4", "discord.js": "^14.11.0", "dotenv": "^16.0.3", "express": "^4.18.2", @@ -72,7 +72,6 @@ "utf-8-validate": "^6.0.3", "uuid": "^9.0.0", "winston": "^3.8.2", - "ytdl-core": "4.10.0", "ytpl": "^2.3.0", "ytsr": "^3.8.4" }, diff --git a/src/libs/Youtube.ts b/src/libs/Youtube.ts index 7cc1db1..cd7cfe4 100644 --- a/src/libs/Youtube.ts +++ b/src/libs/Youtube.ts @@ -1,7 +1,7 @@ import _ from "lodash" import { Readable } from "stream" import search from "ytsr" -import ytdl from "ytdl-core" +import ytdl from "@distube/ytdl-core" import ytpl from "ytpl" import { trackError } from "../utils/trackError" import { SpotifyHelper } from "../shared/utils/helpers" @@ -88,7 +88,7 @@ export class Youtube { if (info.thumbnail_url) { return { medium: info.thumbnail_url } } else { - const thumbnails = info.player_response?.videoDetails?.thumbnail?.thumbnails + const thumbnails = info.player_response?.videoDetails?.thumbnails if (thumbnails) { return { small: thumbnails[0]?.url, diff --git a/src/libs/video-download.ts b/src/libs/video-download.ts index 1392013..ab1a3cd 100644 --- a/src/libs/video-download.ts +++ b/src/libs/video-download.ts @@ -1,4 +1,4 @@ -import ytdl from "ytdl-core" +import ytdl from "@distube/ytdl-core" import { HttpsProxyAgent } from "https-proxy-agent"; import _ from "lodash" diff --git a/web/package.json b/web/package.json index 9c20bc7..4ec71d6 100644 --- a/web/package.json +++ b/web/package.json @@ -32,7 +32,6 @@ "socket.io": "^4.6.1", "socket.io-client": "^4.6.1", "surge": "^0.23.1", - "ytdl-core": "^4.10.0", "ytsr": "^3.8.4" }, "devDependencies": { diff --git a/web/src/shared/utils/helpers.ts b/web/src/shared/utils/helpers.ts index f99f51a..8d4f327 100644 --- a/web/src/shared/utils/helpers.ts +++ b/web/src/shared/utils/helpers.ts @@ -1,4 +1,4 @@ -import ytdl from "ytdl-core" +// import ytdl from "@distube/ytdl-core" function describesYoutubePlaylist(term: string): boolean { const regex = /(^|\s)(https?:\/\/)?(www\.)?youtube\.com\/(playlist)\?(list)=([^\s&]+)[^\s]*($|\s)/g @@ -7,7 +7,8 @@ function describesYoutubePlaylist(term: string): boolean { } function isYoutubeVideo(url: string): boolean { - return ytdl.validateURL(url) + // return ytdl.validateURL(url) + return true } function isYoutubePlaylist(playlist: Playlist): playlist is YoutubePlaylist { diff --git a/web/yarn.lock b/web/yarn.lock index 0683b47..a08980e 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -7366,7 +7366,6 @@ __metadata: typescript: ^5.0.4 url: ^0.11.0 vm-browserify: ^1.1.2 - ytdl-core: ^4.10.0 ytsr: ^3.8.4 languageName: unknown linkType: soft @@ -11932,16 +11931,6 @@ __metadata: languageName: node linkType: hard -"m3u8stream@npm:^0.8.6": - version: 0.8.6 - resolution: "m3u8stream@npm:0.8.6" - dependencies: - miniget: "npm:^4.2.2" - sax: "npm:^1.2.4" - checksum: b8f61c1101dd3ad873ff2f3d0e9e6a5139ad17e20990b89ae67f2585043bc2b727151ed85f3e58aabc8a1a95af28e1ee26f69af6ac9e8841ff68129eae2f5ac5 - languageName: node - linkType: hard - "magic-string@npm:^0.25.0, magic-string@npm:^0.25.7": version: 0.25.9 resolution: "magic-string@npm:0.25.9" @@ -15251,7 +15240,7 @@ __metadata: languageName: node linkType: hard -"sax@npm:^1.1.3, sax@npm:^1.2.4, sax@npm:~1.2.4": +"sax@npm:~1.2.4": version: 1.2.4 resolution: "sax@npm:1.2.4" checksum: d3df7d32b897a2c2f28e941f732c71ba90e27c24f62ee918bd4d9a8cfb3553f2f81e5493c7f0be94a11c1911b643a9108f231dd6f60df3fa9586b5d2e3e9e1fe @@ -18060,17 +18049,6 @@ __metadata: languageName: node linkType: hard -"ytdl-core@npm:^4.10.0": - version: 4.11.5 - resolution: "ytdl-core@npm:4.11.5" - dependencies: - m3u8stream: "npm:^0.8.6" - miniget: "npm:^4.2.2" - sax: "npm:^1.1.3" - checksum: f81ae907780747c4522198003967da1730af33fb6c8632ed2ba7a3dfb67a3fd1bf73807a68506a5926d209ee2f3305bfb6a633f6829b39ed60694c033c300fa9 - languageName: node - linkType: hard - "ytsr@npm:^3.8.4": version: 3.8.4 resolution: "ytsr@npm:3.8.4" diff --git a/yarn.lock b/yarn.lock index 7d88955..9cef690 100644 --- a/yarn.lock +++ b/yarn.lock @@ -772,6 +772,20 @@ __metadata: languageName: node linkType: hard +"@distube/ytdl-core@npm:^4.13.5": + version: 4.13.5 + resolution: "@distube/ytdl-core@npm:4.13.5" + dependencies: + http-cookie-agent: ^6.0.5 + m3u8stream: ^0.8.6 + miniget: ^4.2.3 + sax: ^1.4.1 + tough-cookie: ^4.1.4 + undici: ^6.19.2 + checksum: 6f90215b3d7c681b5ad64f90adf9a5ec29165d8be13525801650da74a735453b794390ea51df3fb9eb9d519622491bcc712904df95c3cbeca0ffdd253f046bab + languageName: node + linkType: hard + "@graphql-tools/merge@npm:^8.4.1": version: 8.4.2 resolution: "@graphql-tools/merge@npm:8.4.2" @@ -1938,6 +1952,15 @@ __metadata: languageName: node linkType: hard +"agent-base@npm:^7.1.1": + version: 7.1.1 + resolution: "agent-base@npm:7.1.1" + dependencies: + debug: ^4.3.4 + checksum: 51c158769c5c051482f9ca2e6e1ec085ac72b5a418a9b31b4e82fe6c0a6699adb94c1c42d246699a587b3335215037091c79e0de512c516f73b6ea844202f037 + languageName: node + linkType: hard + "agentkeepalive@npm:^4.2.1": version: 4.5.0 resolution: "agentkeepalive@npm:4.5.0" @@ -2890,6 +2913,7 @@ __metadata: "@apollo/server": ^4.9.3 "@discordjs/opus": 0.8.0 "@discordjs/voice": ^0.16.0 + "@distube/ytdl-core": ^4.13.5 "@sentry/node": ^5.15.5 "@types/async": ^3.0.1 "@types/body-parser": ^1 @@ -2913,7 +2937,6 @@ __metadata: concurrently: ^8.0.1 cors: ^2.8.5 discord-akairo: "https://github.com/discord-akairo/discord-akairo" - discord-ytdl-core: ^5.0.4 discord.js: ^14.11.0 dotenv: ^16.0.3 express: ^4.18.2 @@ -2948,7 +2971,6 @@ __metadata: utf-8-validate: ^6.0.3 uuid: ^9.0.0 winston: ^3.8.2 - ytdl-core: 4.10.0 ytpl: ^2.3.0 ytsr: ^3.8.4 languageName: unknown @@ -3087,15 +3109,6 @@ __metadata: languageName: node linkType: hard -"discord-ytdl-core@npm:^5.0.4": - version: 5.0.4 - resolution: "discord-ytdl-core@npm:5.0.4" - dependencies: - prism-media: ^1.2.9 - checksum: d68ba8fc0a0311032a5ed9894685b96d5177d93ce11aa218c497d88801961ff0eff40c24ae25d12d4c4665860842c8da014edb211a132bb40b5a1060db83cfed - languageName: node - linkType: hard - "discord.js@npm:^14.11.0": version: 14.13.0 resolution: "discord.js@npm:14.13.0" @@ -3924,6 +3937,21 @@ __metadata: languageName: node linkType: hard +"http-cookie-agent@npm:^6.0.5": + version: 6.0.5 + resolution: "http-cookie-agent@npm:6.0.5" + dependencies: + agent-base: ^7.1.1 + peerDependencies: + tough-cookie: ^4.0.0 + undici: ^5.11.0 || ^6.0.0 + peerDependenciesMeta: + undici: + optional: true + checksum: b6611b57dd7c3cd58f83b7cfbad1285b9e386e64ae99ae11784f80a26b870d20a7616c609bfecde590b4565d8c5e418fe789448b8edbadb1cc59deb754198e05 + languageName: node + linkType: hard + "http-errors@npm:2.0.0": version: 2.0.0 resolution: "http-errors@npm:2.0.0" @@ -5161,7 +5189,7 @@ __metadata: languageName: node linkType: hard -"m3u8stream@npm:^0.8.4": +"m3u8stream@npm:^0.8.6": version: 0.8.6 resolution: "m3u8stream@npm:0.8.6" dependencies: @@ -5328,7 +5356,7 @@ __metadata: languageName: node linkType: hard -"miniget@npm:^4.0.0, miniget@npm:^4.2.2": +"miniget@npm:^4.2.2, miniget@npm:^4.2.3": version: 4.2.3 resolution: "miniget@npm:4.2.3" checksum: c2db18570b4dc6771a6824993f9a33360b02ef92173bf38a5d772f27640f4f493153f73da1b28700c2b55cb7526321446ce2f326c667ad671fb78c8998c1402f @@ -6029,7 +6057,7 @@ __metadata: languageName: node linkType: hard -"prism-media@npm:^1.2.9, prism-media@npm:^1.3.5": +"prism-media@npm:^1.3.5": version: 1.3.5 resolution: "prism-media@npm:1.3.5" peerDependencies: @@ -6087,7 +6115,7 @@ __metadata: languageName: node linkType: hard -"psl@npm:^1.1.28": +"psl@npm:^1.1.28, psl@npm:^1.1.33": version: 1.9.0 resolution: "psl@npm:1.9.0" checksum: 20c4277f640c93d393130673f392618e9a8044c6c7bf61c53917a0fddb4952790f5f362c6c730a9c32b124813e173733f9895add8d26f566ed0ea0654b2e711d @@ -6140,6 +6168,13 @@ __metadata: languageName: node linkType: hard +"querystringify@npm:^2.1.1": + version: 2.2.0 + resolution: "querystringify@npm:2.2.0" + checksum: 5641ea231bad7ef6d64d9998faca95611ed4b11c2591a8cae741e178a974f6a8e0ebde008475259abe1621cb15e692404e6b6626e927f7b849d5c09392604b15 + languageName: node + linkType: hard + "range-parser@npm:~1.2.1": version: 1.2.1 resolution: "range-parser@npm:1.2.1" @@ -6272,6 +6307,13 @@ __metadata: languageName: node linkType: hard +"requires-port@npm:^1.0.0": + version: 1.0.0 + resolution: "requires-port@npm:1.0.0" + checksum: eee0e303adffb69be55d1a214e415cf42b7441ae858c76dfc5353148644f6fd6e698926fc4643f510d5c126d12a705e7c8ed7e38061113bdf37547ab356797ff + languageName: node + linkType: hard + "resolve-cwd@npm:^3.0.0": version: 3.0.0 resolution: "resolve-cwd@npm:3.0.0" @@ -6393,13 +6435,20 @@ __metadata: languageName: node linkType: hard -"sax@npm:^1.1.3, sax@npm:^1.2.4": +"sax@npm:^1.2.4": version: 1.2.4 resolution: "sax@npm:1.2.4" checksum: d3df7d32b897a2c2f28e941f732c71ba90e27c24f62ee918bd4d9a8cfb3553f2f81e5493c7f0be94a11c1911b643a9108f231dd6f60df3fa9586b5d2e3e9e1fe languageName: node linkType: hard +"sax@npm:^1.4.1": + version: 1.4.1 + resolution: "sax@npm:1.4.1" + checksum: 3ad64df16b743f0f2eb7c38ced9692a6d924f1cd07bbe45c39576c2cf50de8290d9d04e7b2228f924c7d05fecc4ec5cf651423278e0c7b63d260c387ef3af84a + languageName: node + linkType: hard + "semver@npm:^5.3.0, semver@npm:^5.6.0, semver@npm:^5.7.1": version: 5.7.2 resolution: "semver@npm:5.7.2" @@ -7012,6 +7061,18 @@ __metadata: languageName: node linkType: hard +"tough-cookie@npm:^4.1.4": + version: 4.1.4 + resolution: "tough-cookie@npm:4.1.4" + dependencies: + psl: ^1.1.33 + punycode: ^2.1.1 + universalify: ^0.2.0 + url-parse: ^1.5.3 + checksum: 5815059f014c31179a303c673f753f7899a6fce94ac93712c88ea5f3c26e0c042b5f0c7a599a00f8e0feeca4615dba75c3dffc54f3c1a489978aa8205e09307c + languageName: node + linkType: hard + "tr46@npm:^3.0.0": version: 3.0.0 resolution: "tr46@npm:3.0.0" @@ -7271,6 +7332,13 @@ __metadata: languageName: node linkType: hard +"undici@npm:^6.19.2": + version: 6.19.4 + resolution: "undici@npm:6.19.4" + checksum: 15cfdc84c5cae7df5c1199dd72d51074e1f86d22ed7dbf54252606aacb826fc532503fa6bb1d365e99acd31fe67eecd955ce856c7d5a8deee590e52e3b1f2802 + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0" @@ -7289,6 +7357,13 @@ __metadata: languageName: node linkType: hard +"universalify@npm:^0.2.0": + version: 0.2.0 + resolution: "universalify@npm:0.2.0" + checksum: e86134cb12919d177c2353196a4cc09981524ee87abf621f7bc8d249dbbbebaec5e7d1314b96061497981350df786e4c5128dbf442eba104d6e765bc260678b5 + languageName: node + linkType: hard + "unpipe@npm:1.0.0, unpipe@npm:~1.0.0": version: 1.0.0 resolution: "unpipe@npm:1.0.0" @@ -7319,6 +7394,16 @@ __metadata: languageName: node linkType: hard +"url-parse@npm:^1.5.3": + version: 1.5.10 + resolution: "url-parse@npm:1.5.10" + dependencies: + querystringify: ^2.1.1 + requires-port: ^1.0.0 + checksum: fbdba6b1d83336aca2216bbdc38ba658d9cfb8fc7f665eb8b17852de638ff7d1a162c198a8e4ed66001ddbf6c9888d41e4798912c62b4fd777a31657989f7bdf + languageName: node + linkType: hard + "utf-8-validate@npm:^6.0.3": version: 6.0.3 resolution: "utf-8-validate@npm:6.0.3" @@ -7646,17 +7731,6 @@ __metadata: languageName: node linkType: hard -"ytdl-core@npm:4.10.0": - version: 4.10.0 - resolution: "ytdl-core@npm:4.10.0" - dependencies: - m3u8stream: ^0.8.4 - miniget: ^4.0.0 - sax: ^1.1.3 - checksum: dc76964811768d13acff0a1191b6911403fb2a0ea53202eed2737fbe1e0fa024963316103d3e082f325fb85380c7bac1500c9ea38ea00c63479e456130e75487 - languageName: node - linkType: hard - "ytpl@npm:^2.3.0": version: 2.3.0 resolution: "ytpl@npm:2.3.0"