discord-player-deezer 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/DeezerExtractor.ts +8 -10
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discord-player-deezer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A custom extractor made for discord-player that enables you to extract from Deezer.",
|
|
5
5
|
"main": "dist/DeezerExtractor.js",
|
|
6
6
|
"author": "retro_ig",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@discord-player/extractor": "^4.1.1",
|
|
11
10
|
"@mithron/deezer-music-metadata": "^1.0.3",
|
|
12
11
|
"discord-player": "^6.0.0",
|
|
13
12
|
"tslint-config-prettier": "^1.18.0",
|
|
14
|
-
"youtube-sr": "^4.3.4"
|
|
13
|
+
"youtube-sr": "^4.3.4",
|
|
14
|
+
"yt-stream": "^1.4.4"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"prettier": "^2.8.4",
|
package/src/DeezerExtractor.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BaseExtractor, ExtractorInfo, ExtractorSearchContext, Playlist, SearchQ
|
|
|
2
2
|
import { getData } from "@mithron/deezer-music-metadata"
|
|
3
3
|
import { YouTube } from "youtube-sr";
|
|
4
4
|
import { Readable } from "stream";
|
|
5
|
-
import {
|
|
5
|
+
import { stream } from "yt-stream";
|
|
6
6
|
|
|
7
7
|
interface DeezerRegex {
|
|
8
8
|
track: RegExp;
|
|
@@ -12,7 +12,7 @@ interface DeezerRegex {
|
|
|
12
12
|
|
|
13
13
|
export default class DeezerExtractor extends BaseExtractor {
|
|
14
14
|
public static identifier: string = "com.discord-player.deezerextractor" as const
|
|
15
|
-
private _stream
|
|
15
|
+
private _stream = stream
|
|
16
16
|
|
|
17
17
|
private deezerRegex: DeezerRegex = {
|
|
18
18
|
track: /(^https:)\/\/(www\.)?deezer.com\/([a-zA-Z]+\/)?track\/[0-9]+/,
|
|
@@ -20,12 +20,6 @@ export default class DeezerExtractor extends BaseExtractor {
|
|
|
20
20
|
share: /(^https:)\/\/deezer\.page\.link\/[A-Za-z0-9]+/
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
public async activate(): Promise<void> {
|
|
24
|
-
const { stream: ytdlStream } = await loadYtdl()
|
|
25
|
-
|
|
26
|
-
this._stream = ytdlStream
|
|
27
|
-
}
|
|
28
|
-
|
|
29
23
|
public async validate(query: string, _type?: SearchQueryType | null | undefined): Promise<boolean> {
|
|
30
24
|
if (typeof query !== "string") return false
|
|
31
25
|
|
|
@@ -113,9 +107,13 @@ export default class DeezerExtractor extends BaseExtractor {
|
|
|
113
107
|
type: "video"
|
|
114
108
|
})
|
|
115
109
|
|
|
116
|
-
const stream = await this._stream(serachResults[0].url
|
|
110
|
+
const stream = await this._stream(serachResults[0].url, {
|
|
111
|
+
quality: 'high',
|
|
112
|
+
type: 'audio',
|
|
113
|
+
highWaterMark: 1048576 * 32
|
|
114
|
+
})
|
|
117
115
|
|
|
118
|
-
return stream
|
|
116
|
+
return stream.url
|
|
119
117
|
} catch (error) {
|
|
120
118
|
throw(error)
|
|
121
119
|
}
|