discord-player-deezer 2.3.1-dev.2 → 2.5.0-beta.0
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/.yarnrc.yml +1 -1
- package/LICENSE +121 -121
- package/dist/index.d.ts +23 -1
- package/dist/index.js +86 -15
- package/package.json +36 -35
- package/readme.md +34 -34
- package/src/Crypto/BaseDecryptor.ts +12 -0
- package/src/Crypto/JSDecryptor.ts +18 -0
- package/src/Crypto/NodeDecryptor.ts +17 -0
- package/src/Crypto/index.ts +3 -0
- package/src/DeezerExtractor.ts +198 -171
- package/src/index.ts +3 -2
- package/src/utils/util.ts +218 -215
- package/tsconfig.json +24 -24
- package/tslint.json +2 -2
- package/tsup.config.ts +8 -8
package/.yarnrc.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
|
1
|
+
nodeLinker: node-modules
|
package/LICENSE
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
Creative Commons Legal Code
|
|
2
|
-
|
|
3
|
-
CC0 1.0 Universal
|
|
4
|
-
|
|
5
|
-
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
-
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
-
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
-
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
-
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
-
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
-
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
-
HEREUNDER.
|
|
13
|
-
|
|
14
|
-
Statement of Purpose
|
|
15
|
-
|
|
16
|
-
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
-
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
-
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
-
authorship and/or a database (each, a "Work").
|
|
20
|
-
|
|
21
|
-
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
-
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
-
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
-
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
-
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
-
and for any purposes, including without limitation commercial purposes.
|
|
27
|
-
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
-
culture and the further production of creative, cultural and scientific
|
|
29
|
-
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
-
part through the use and efforts of others.
|
|
31
|
-
|
|
32
|
-
For these and/or other purposes and motivations, and without any
|
|
33
|
-
expectation of additional consideration or compensation, the person
|
|
34
|
-
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
-
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
-
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
-
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
-
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
-
|
|
40
|
-
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
-
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
-
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
-
limited to, the following:
|
|
44
|
-
|
|
45
|
-
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
-
communicate, and translate a Work;
|
|
47
|
-
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
-
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
-
likeness depicted in a Work;
|
|
50
|
-
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
-
subject to the limitations in paragraph 4(a), below;
|
|
52
|
-
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
-
in a Work;
|
|
54
|
-
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
-
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
-
protection of databases, and under any national implementation
|
|
57
|
-
thereof, including any amended or successor version of such
|
|
58
|
-
directive); and
|
|
59
|
-
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
-
world based on applicable law or treaty, and any national
|
|
61
|
-
implementations thereof.
|
|
62
|
-
|
|
63
|
-
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
-
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
-
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
-
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
-
of action, whether now known or unknown (including existing as well as
|
|
68
|
-
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
-
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
-
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
-
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
-
including without limitation commercial, advertising or promotional
|
|
73
|
-
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
-
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
-
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
-
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
-
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
-
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
-
|
|
80
|
-
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
-
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
-
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
-
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
-
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
-
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
-
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
-
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
-
maximum duration provided by applicable law or treaty (including future
|
|
89
|
-
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
-
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
-
limitation commercial, advertising or promotional purposes (the
|
|
92
|
-
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
-
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
-
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
-
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
-
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
-
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
-
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
-
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
-
express Statement of Purpose.
|
|
101
|
-
|
|
102
|
-
4. Limitations and Disclaimers.
|
|
103
|
-
|
|
104
|
-
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
-
surrendered, licensed or otherwise affected by this document.
|
|
106
|
-
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
-
warranties of any kind concerning the Work, express, implied,
|
|
108
|
-
statutory or otherwise, including without limitation warranties of
|
|
109
|
-
title, merchantability, fitness for a particular purpose, non
|
|
110
|
-
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
-
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
-
the greatest extent permissible under applicable law.
|
|
113
|
-
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
-
that may apply to the Work or any use thereof, including without
|
|
115
|
-
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
-
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
-
consents, permissions or other rights required for any use of the
|
|
118
|
-
Work.
|
|
119
|
-
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
-
party to this document and has no duty or obligation with respect to
|
|
121
|
-
this CC0 or use of the Work.
|
|
1
|
+
Creative Commons Legal Code
|
|
2
|
+
|
|
3
|
+
CC0 1.0 Universal
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ import { Track, ExtractorStreamable, BaseExtractor, SearchQueryType, ExtractorSe
|
|
|
2
2
|
import { Playlist, Track as Track$1 } from '@mithron/deezer-music-metadata';
|
|
3
3
|
import * as crypto from 'crypto';
|
|
4
4
|
import { PassThrough } from 'stream';
|
|
5
|
+
import Blowfish from 'blowfish-node';
|
|
6
|
+
|
|
7
|
+
declare class BaseDecryptor {
|
|
8
|
+
key: Buffer;
|
|
9
|
+
iv: Buffer;
|
|
10
|
+
constructor(decryptionKey: Buffer, iv: Buffer);
|
|
11
|
+
decrypt(chunk: Buffer): Promise<Buffer>;
|
|
12
|
+
}
|
|
5
13
|
|
|
6
14
|
/**
|
|
7
15
|
* -------------------------------NOTICE-------------------------------------
|
|
@@ -17,6 +25,8 @@ type DeezerExtractorOptions = {
|
|
|
17
25
|
searchLimit?: number;
|
|
18
26
|
reloadUserInterval?: number;
|
|
19
27
|
priority?: number;
|
|
28
|
+
arl: string;
|
|
29
|
+
decryptor?: typeof BaseDecryptor;
|
|
20
30
|
};
|
|
21
31
|
type DeezerUserInfo = {
|
|
22
32
|
cookie: string;
|
|
@@ -32,6 +42,7 @@ declare class DeezerExtractor extends BaseExtractor<DeezerExtractorOptions> {
|
|
|
32
42
|
static readonly identifier: string;
|
|
33
43
|
userInfo: DeezerUserInfo;
|
|
34
44
|
__interval?: ReturnType<typeof setInterval>;
|
|
45
|
+
fetch(input: Parameters<typeof fetch>[0], options?: Parameters<typeof fetch>[1]): Promise<Response>;
|
|
35
46
|
activate(): Promise<void>;
|
|
36
47
|
deactivate(): Promise<void>;
|
|
37
48
|
validate(query: string, type: SearchQueryType & "deezer"): Promise<boolean>;
|
|
@@ -74,4 +85,15 @@ declare const deezerRegex: {
|
|
|
74
85
|
};
|
|
75
86
|
declare function validate(query: string): boolean;
|
|
76
87
|
|
|
77
|
-
|
|
88
|
+
declare class JSDecryptor extends BaseDecryptor {
|
|
89
|
+
bfDecryptor: Blowfish;
|
|
90
|
+
constructor(...args: ConstructorParameters<typeof BaseDecryptor>);
|
|
91
|
+
decrypt(chunk: Buffer): Promise<Buffer>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class NodeDecryptor extends BaseDecryptor {
|
|
95
|
+
constructor(...args: ConstructorParameters<typeof BaseDecryptor>);
|
|
96
|
+
decrypt(chunk: Buffer): Promise<Buffer>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { type ArrayOrObject, BaseDecryptor, DeezerExtractor, type DeezerExtractorOptions, type DeezerSearchTrackResponse, type DeezerUserInfo, JSDecryptor, NodeDecryptor, Warnings, buildTrackFromSearch, deezerRegex, extractTrackId, getCrypto, isUrl, search, searchOneTrack, streamTrack, validate };
|
package/dist/index.js
CHANGED
|
@@ -28,9 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
BaseDecryptor: () => BaseDecryptor,
|
|
33
34
|
DeezerExtractor: () => DeezerExtractor,
|
|
35
|
+
JSDecryptor: () => JSDecryptor,
|
|
36
|
+
NodeDecryptor: () => NodeDecryptor,
|
|
34
37
|
Warnings: () => Warnings,
|
|
35
38
|
buildTrackFromSearch: () => buildTrackFromSearch,
|
|
36
39
|
deezerRegex: () => deezerRegex,
|
|
@@ -42,7 +45,7 @@ __export(index_exports, {
|
|
|
42
45
|
streamTrack: () => streamTrack,
|
|
43
46
|
validate: () => validate
|
|
44
47
|
});
|
|
45
|
-
module.exports = __toCommonJS(
|
|
48
|
+
module.exports = __toCommonJS(src_exports);
|
|
46
49
|
|
|
47
50
|
// src/DeezerExtractor.ts
|
|
48
51
|
var import_discord_player2 = require("discord-player");
|
|
@@ -51,7 +54,36 @@ var import_deezer_music_metadata = require("@mithron/deezer-music-metadata");
|
|
|
51
54
|
// src/utils/util.ts
|
|
52
55
|
var import_discord_player = require("discord-player");
|
|
53
56
|
var import_stream = require("stream");
|
|
57
|
+
|
|
58
|
+
// src/Crypto/JSDecryptor.ts
|
|
54
59
|
var import_blowfish_node = __toESM(require("blowfish-node"));
|
|
60
|
+
|
|
61
|
+
// src/Crypto/BaseDecryptor.ts
|
|
62
|
+
var BaseDecryptor = class {
|
|
63
|
+
constructor(decryptionKey, iv) {
|
|
64
|
+
this.key = decryptionKey;
|
|
65
|
+
this.iv = iv;
|
|
66
|
+
}
|
|
67
|
+
async decrypt(chunk) {
|
|
68
|
+
throw new Error("Not implemented");
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/Crypto/JSDecryptor.ts
|
|
73
|
+
var JSDecryptor = class extends BaseDecryptor {
|
|
74
|
+
constructor(...args) {
|
|
75
|
+
super(...args);
|
|
76
|
+
this.bfDecryptor = new import_blowfish_node.default(new Uint8Array(this.key), import_blowfish_node.MODE.CBC, import_blowfish_node.PADDING.NULL);
|
|
77
|
+
this.bfDecryptor.setIv(new Uint8Array(this.iv));
|
|
78
|
+
}
|
|
79
|
+
async decrypt(chunk) {
|
|
80
|
+
const chunkUint = new Uint8Array(chunk);
|
|
81
|
+
const decoded = this.bfDecryptor.decode(chunkUint, import_blowfish_node.TYPE.UINT8_ARRAY);
|
|
82
|
+
return Buffer.from(decoded);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/utils/util.ts
|
|
55
87
|
var IV = Buffer.from(Array.from({ length: 8 }, (_, x) => x));
|
|
56
88
|
var rawCrypto;
|
|
57
89
|
async function getCrypto() {
|
|
@@ -116,9 +148,10 @@ async function streamTrack(track, ext) {
|
|
|
116
148
|
const trackId = extractTrackId(track.url);
|
|
117
149
|
const trackHash = crypto.createHash("md5").update(trackId, "ascii").digest("hex");
|
|
118
150
|
const trackKey = Buffer.alloc(16);
|
|
151
|
+
const Decryptor = ext.options.decryptor || JSDecryptor;
|
|
119
152
|
for (let iter = 0; iter < 16; iter++)
|
|
120
153
|
trackKey.writeInt8(trackHash[iter].charCodeAt(0) ^ trackHash[iter + 16].charCodeAt(0) ^ decryptionKey[iter].charCodeAt(0), iter);
|
|
121
|
-
const trackInfoRes = await fetch(`https://www.deezer.com/ajax/gw-light.php?method=song.getListData&input=3&api_version=1.0&api_token=${ext.userInfo.csrfToken}`, {
|
|
154
|
+
const trackInfoRes = await ext.fetch(`https://www.deezer.com/ajax/gw-light.php?method=song.getListData&input=3&api_version=1.0&api_token=${ext.userInfo.csrfToken}`, {
|
|
122
155
|
method: "POST",
|
|
123
156
|
headers: {
|
|
124
157
|
Cookie: ext.userInfo.cookie,
|
|
@@ -156,15 +189,14 @@ async function streamTrack(track, ext) {
|
|
|
156
189
|
const streamInfo = await streamInfoRes.json();
|
|
157
190
|
const trackMediaUrl = streamInfo.data[0].media[0].sources[0].url;
|
|
158
191
|
ext.context.player.debug("DEEZER FOUND MEDIA URL " + trackMediaUrl);
|
|
159
|
-
const trackReq = await fetch(trackMediaUrl);
|
|
192
|
+
const trackReq = await ext.fetch(trackMediaUrl);
|
|
160
193
|
const readable = import_stream.Readable.fromWeb(trackReq.body);
|
|
161
194
|
let buffer = Buffer.alloc(0);
|
|
162
195
|
let i = 0;
|
|
163
196
|
const bufferSize = 2048;
|
|
164
|
-
const blowfishDecrypter = new import_blowfish_node.default(new Uint8Array(trackKey), import_blowfish_node.default.MODE.CBC, import_blowfish_node.default.PADDING.NULL);
|
|
165
|
-
blowfishDecrypter.setIv(new Uint8Array(IV));
|
|
166
197
|
const passThrough = new import_stream.PassThrough();
|
|
167
|
-
|
|
198
|
+
const decryptor = new Decryptor(trackKey, IV);
|
|
199
|
+
readable.on("readable", async () => {
|
|
168
200
|
let chunk = null;
|
|
169
201
|
while (true) {
|
|
170
202
|
chunk = readable.read(bufferSize);
|
|
@@ -180,7 +212,7 @@ async function streamTrack(track, ext) {
|
|
|
180
212
|
while (buffer.length >= bufferSize) {
|
|
181
213
|
const bufferSized = buffer.subarray(0, bufferSize);
|
|
182
214
|
if (i % 3 === 0) {
|
|
183
|
-
const decipher =
|
|
215
|
+
const decipher = await decryptor.decrypt(bufferSized);
|
|
184
216
|
passThrough.write(decipher);
|
|
185
217
|
} else {
|
|
186
218
|
passThrough.write(bufferSized);
|
|
@@ -206,11 +238,18 @@ var import_promises = require("timers/promises");
|
|
|
206
238
|
var Warnings = {
|
|
207
239
|
MissingDecryption: "Decryption Key missing! This is needed for extracting streams."
|
|
208
240
|
};
|
|
209
|
-
|
|
241
|
+
function parseCookie(obj) {
|
|
242
|
+
let str = "";
|
|
243
|
+
for (const key of Object.keys(obj)) {
|
|
244
|
+
str += ` ${key}=${obj[key]};`;
|
|
245
|
+
}
|
|
246
|
+
return str.trim();
|
|
247
|
+
}
|
|
248
|
+
async function fetchDeezerUser(ext) {
|
|
210
249
|
const crypto = await getCrypto();
|
|
211
250
|
const randomToken = crypto.randomBytes(16).toString("hex");
|
|
212
251
|
const deezerUsrDataUrl = `https://www.deezer.com/ajax/gw-light.php?method=deezer.getUserData&input=3&api_version=1.0&api_token=${randomToken}`;
|
|
213
|
-
const usrDataRes = await fetch(deezerUsrDataUrl);
|
|
252
|
+
const usrDataRes = await ext.fetch(deezerUsrDataUrl);
|
|
214
253
|
const usrData = await usrDataRes.json();
|
|
215
254
|
const licenseToken = usrData.results.USER.OPTIONS.license_token;
|
|
216
255
|
if (typeof licenseToken !== "string") throw new Error("Unable to get licenseToken");
|
|
@@ -224,11 +263,25 @@ async function fetchDeezerAnonUser() {
|
|
|
224
263
|
};
|
|
225
264
|
}
|
|
226
265
|
var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
|
|
266
|
+
async fetch(input, options) {
|
|
267
|
+
return fetch(input, {
|
|
268
|
+
...options,
|
|
269
|
+
headers: {
|
|
270
|
+
...options?.headers,
|
|
271
|
+
Cookie: parseCookie({ arl: this.options.arl }),
|
|
272
|
+
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0",
|
|
273
|
+
"DNT": "1",
|
|
274
|
+
"Origin": "https://www.deezer.com",
|
|
275
|
+
"Connection": "keep-alive",
|
|
276
|
+
"Referer": "https://www.deezer.com/login"
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
227
280
|
async activate() {
|
|
228
281
|
this.protocols = ["deezer"];
|
|
229
282
|
if (!this.options.decryptionKey) process.emitWarning(Warnings.MissingDecryption);
|
|
230
283
|
else {
|
|
231
|
-
this.userInfo = await
|
|
284
|
+
this.userInfo = await fetchDeezerUser(this);
|
|
232
285
|
this.context.player.debug("USER INFO EXT: " + JSON.stringify(this.userInfo));
|
|
233
286
|
}
|
|
234
287
|
if (this.options.priority) {
|
|
@@ -237,7 +290,7 @@ var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
|
|
|
237
290
|
this.__interval = setInterval(
|
|
238
291
|
async () => {
|
|
239
292
|
try {
|
|
240
|
-
this.userInfo = await
|
|
293
|
+
this.userInfo = await fetchDeezerUser(this);
|
|
241
294
|
} catch {
|
|
242
295
|
this.context.player.debug("[DEEZER_EXTRACTOR_ERR]: Unable to fetch user information from Deezer. Retrying in 3 seconds ...");
|
|
243
296
|
await (0, import_promises.setTimeout)(
|
|
@@ -245,7 +298,7 @@ var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
|
|
|
245
298
|
/* 3 seconds */
|
|
246
299
|
);
|
|
247
300
|
try {
|
|
248
|
-
this.userInfo = await
|
|
301
|
+
this.userInfo = await fetchDeezerUser(this);
|
|
249
302
|
} catch (err) {
|
|
250
303
|
this.context.player.debug("[DEEZER_EXTRACTOR_ERR]: Retry failed. Using old user ...");
|
|
251
304
|
}
|
|
@@ -287,7 +340,7 @@ var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
|
|
|
287
340
|
return this.createResponse(null, tracks);
|
|
288
341
|
}
|
|
289
342
|
if (deezerRegex.share.test(query)) {
|
|
290
|
-
const redirect = await fetch(query);
|
|
343
|
+
const redirect = await this.fetch(query);
|
|
291
344
|
query = redirect.url;
|
|
292
345
|
}
|
|
293
346
|
const metadata = await (0, import_deezer_music_metadata.getData)(query);
|
|
@@ -321,9 +374,27 @@ var DeezerExtractor = class extends import_discord_player2.BaseExtractor {
|
|
|
321
374
|
}
|
|
322
375
|
};
|
|
323
376
|
DeezerExtractor.identifier = "com.retrouser955.discord-player.deezr-ext";
|
|
377
|
+
|
|
378
|
+
// src/Crypto/NodeDecryptor.ts
|
|
379
|
+
var NodeDecryptor = class extends BaseDecryptor {
|
|
380
|
+
constructor(...args) {
|
|
381
|
+
super(...args);
|
|
382
|
+
(async () => {
|
|
383
|
+
if (!(await getCrypto()).getCiphers().includes("bf-cbc")) throw new Error("Cannot find bf-cbc");
|
|
384
|
+
})();
|
|
385
|
+
}
|
|
386
|
+
async decrypt(chunk) {
|
|
387
|
+
const crypto = await getCrypto();
|
|
388
|
+
const decipher = crypto.createDecipheriv("bf-cbc", this.key, this.iv).setAutoPadding(false);
|
|
389
|
+
return Buffer.concat([decipher.update(chunk), decipher.final()]);
|
|
390
|
+
}
|
|
391
|
+
};
|
|
324
392
|
// Annotate the CommonJS export names for ESM import in node:
|
|
325
393
|
0 && (module.exports = {
|
|
394
|
+
BaseDecryptor,
|
|
326
395
|
DeezerExtractor,
|
|
396
|
+
JSDecryptor,
|
|
397
|
+
NodeDecryptor,
|
|
327
398
|
Warnings,
|
|
328
399
|
buildTrackFromSearch,
|
|
329
400
|
deezerRegex,
|
package/package.json
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "discord-player-deezer",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "A custom extractor made for discord-player that enables you to extract from Deezer.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"author": "retro_ig",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@mithron/deezer-music-metadata": "^1.0.3",
|
|
10
|
-
"blowfish-node": "^1.1.4"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@discord-player/extractor": "^7.1.0",
|
|
14
|
-
"@types/node": "^22.10.10",
|
|
15
|
-
"discord-player": "^7.1.0",
|
|
16
|
-
"prettier": "^3.4.2",
|
|
17
|
-
"tslint": "^6.1.3",
|
|
18
|
-
"tslint-config-prettier": "^1.18.0",
|
|
19
|
-
"tsup": "^8.3.5",
|
|
20
|
-
"typescript": "^5.7.2"
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "yarn lint && tsup",
|
|
24
|
-
"lint": "tslint -p tsconfig.json",
|
|
25
|
-
"npm:publish": "yarn build && npm publish --access public",
|
|
26
|
-
"prepare": "tsup"
|
|
27
|
-
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+https://github.com/retrouser955/discord-player-deezer.git"
|
|
31
|
-
},
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "https://github.com/retrouser955/discord-player-deezer/issues"
|
|
34
|
-
}
|
|
35
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "discord-player-deezer",
|
|
3
|
+
"version": "2.5.0-beta.0",
|
|
4
|
+
"description": "A custom extractor made for discord-player that enables you to extract from Deezer.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"author": "retro_ig",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@mithron/deezer-music-metadata": "^1.0.3",
|
|
10
|
+
"blowfish-node": "^1.1.4"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@discord-player/extractor": "^7.1.0",
|
|
14
|
+
"@types/node": "^22.10.10",
|
|
15
|
+
"discord-player": "^7.1.0",
|
|
16
|
+
"prettier": "^3.4.2",
|
|
17
|
+
"tslint": "^6.1.3",
|
|
18
|
+
"tslint-config-prettier": "^1.18.0",
|
|
19
|
+
"tsup": "^8.3.5",
|
|
20
|
+
"typescript": "^5.7.2"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "yarn lint && tsup",
|
|
24
|
+
"lint": "tslint -p tsconfig.json",
|
|
25
|
+
"npm:publish": "yarn build && npm publish --access public",
|
|
26
|
+
"prepare": "tsup"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/retrouser955/discord-player-deezer.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/retrouser955/discord-player-deezer/issues"
|
|
34
|
+
},
|
|
35
|
+
"packageManager": "yarn@4.5.1+sha512.341db9396b6e289fecc30cd7ab3af65060e05ebff4b3b47547b278b9e67b08f485ecd8c79006b405446262142c7a38154445ef7f17c1d5d1de7d90bf9ce7054d"
|
|
36
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
# Discord Player Deezer
|
|
2
|
-
|
|
3
|
-
Discord Player Deezer is a Deezer platform plugin for discord-player
|
|
4
|
-
|
|
5
|
-
# Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
$ npm install discord-player-deezer
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
# Register the extractor
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { DeezerExtractor } from "discord-player-deezer"
|
|
15
|
-
import { Player } from "discord-player"
|
|
16
|
-
|
|
17
|
-
const player = new Player(...)
|
|
18
|
-
|
|
19
|
-
await player.extractors.register(DeezerExtractor, {})
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
# Extracting Streams
|
|
23
|
-
|
|
24
|
-
As Deezer sends DMCA to repositories containing the hard-coded decryption key, it is not provided. You can find this key in the code of related projects (deezer downloaders) and your client-side JavaScript code.
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { DeezerExtractor } from "discord-player-deezer"
|
|
28
|
-
import { Player } from "discord-player"
|
|
29
|
-
|
|
30
|
-
const player = new Player(...)
|
|
31
|
-
|
|
32
|
-
await player.extractors.register(DeezerExtractor, {
|
|
33
|
-
decryptionKey: "master-decryption-key"
|
|
34
|
-
})
|
|
1
|
+
# Discord Player Deezer
|
|
2
|
+
|
|
3
|
+
Discord Player Deezer is a Deezer platform plugin for discord-player
|
|
4
|
+
|
|
5
|
+
# Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
$ npm install discord-player-deezer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# Register the extractor
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { DeezerExtractor } from "discord-player-deezer"
|
|
15
|
+
import { Player } from "discord-player"
|
|
16
|
+
|
|
17
|
+
const player = new Player(...)
|
|
18
|
+
|
|
19
|
+
await player.extractors.register(DeezerExtractor, {})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
# Extracting Streams
|
|
23
|
+
|
|
24
|
+
As Deezer sends DMCA to repositories containing the hard-coded decryption key, it is not provided. You can find this key in the code of related projects (deezer downloaders) and your client-side JavaScript code.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { DeezerExtractor } from "discord-player-deezer"
|
|
28
|
+
import { Player } from "discord-player"
|
|
29
|
+
|
|
30
|
+
const player = new Player(...)
|
|
31
|
+
|
|
32
|
+
await player.extractors.register(DeezerExtractor, {
|
|
33
|
+
decryptionKey: "master-decryption-key"
|
|
34
|
+
})
|
|
35
35
|
```
|