@andresaya/edge-tts 1.4.3 → 1.5.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/dist/cli/edge-tts.js
CHANGED
|
@@ -6,7 +6,7 @@ const VoiceListCommand_1 = require("../commands/VoiceListCommand");
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const program = new commander_1.Command();
|
|
8
8
|
program
|
|
9
|
-
.version('1.
|
|
9
|
+
.version('1.5.0')
|
|
10
10
|
.addCommand(SynthesizeCommand_1.SynthesizeCommand)
|
|
11
11
|
.addCommand(VoiceListCommand_1.VoiceListCommand);
|
|
12
12
|
try {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export declare const Constants: {
|
|
2
2
|
TRUSTED_CLIENT_TOKEN: string;
|
|
3
|
+
BASE_URL: string;
|
|
3
4
|
WSS_URL: string;
|
|
4
5
|
VOICES_URL: string;
|
|
5
|
-
USER_AGENT: string;
|
|
6
|
-
DEFAULT_VOICE: string;
|
|
7
|
-
VERSION_MS_GEC: string;
|
|
8
6
|
CHROMIUM_FULL_VERSION: string;
|
|
9
7
|
CHROMIUM_MAJOR_VERSION: string;
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
VERSION_MS_GEC: string;
|
|
9
|
+
token32(): string;
|
|
10
|
+
getBaseHeaders(): {
|
|
12
11
|
'User-Agent': string;
|
|
13
12
|
'Accept-Encoding': string;
|
|
14
13
|
'Accept-Language': string;
|
|
14
|
+
Cookie: string;
|
|
15
15
|
};
|
|
16
16
|
WSS_HEADERS: {
|
|
17
17
|
Pragma: string;
|
|
@@ -22,13 +22,11 @@ export declare const Constants: {
|
|
|
22
22
|
'User-Agent': string;
|
|
23
23
|
};
|
|
24
24
|
VOICE_HEADERS: {
|
|
25
|
-
Authority: string;
|
|
26
25
|
'Sec-CH-UA': string;
|
|
27
26
|
'Sec-CH-UA-Mobile': string;
|
|
28
27
|
Accept: string;
|
|
29
28
|
'Sec-Fetch-Site': string;
|
|
30
29
|
'Sec-Fetch-Mode': string;
|
|
31
30
|
'Sec-Fetch-Dest': string;
|
|
32
|
-
'User-Agent': string;
|
|
33
31
|
};
|
|
34
32
|
};
|
package/dist/config/constants.js
CHANGED
|
@@ -3,18 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Constants = void 0;
|
|
4
4
|
exports.Constants = {
|
|
5
5
|
TRUSTED_CLIENT_TOKEN: '6A5AA1D4EAFF4E9FB37E23D68491D6F4',
|
|
6
|
+
BASE_URL: 'https://api.msedgeservices.com/tts/cognitiveservices',
|
|
6
7
|
WSS_URL: 'wss://api.msedgeservices.com/tts/cognitiveservices/websocket/v1',
|
|
7
8
|
VOICES_URL: 'https://api.msedgeservices.com/tts/cognitiveservices/voices/list',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
VERSION_MS_GEC: '1-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
CHROMIUM_FULL_VERSION: '142.0.3595.0',
|
|
10
|
+
CHROMIUM_MAJOR_VERSION: '142',
|
|
11
|
+
VERSION_MS_GEC: '1-142.0.3595',
|
|
12
|
+
token32() {
|
|
13
|
+
const bytes = new Uint8Array(16);
|
|
14
|
+
crypto.getRandomValues(bytes);
|
|
15
|
+
return Array.from(bytes)
|
|
16
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
17
|
+
.join('')
|
|
18
|
+
.toUpperCase();
|
|
19
|
+
},
|
|
20
|
+
getBaseHeaders() {
|
|
21
|
+
return {
|
|
22
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0',
|
|
23
|
+
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
24
|
+
'Accept-Language': 'es,es-ES;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,es-CO;q=0.5,es-MX;q=0.4',
|
|
25
|
+
'Cookie': 'MUID=' + this.token32()
|
|
26
|
+
};
|
|
18
27
|
},
|
|
19
28
|
WSS_HEADERS: {
|
|
20
29
|
'Pragma': 'no-cache',
|
|
@@ -22,16 +31,14 @@ exports.Constants = {
|
|
|
22
31
|
'Origin': 'chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold',
|
|
23
32
|
'Sec-WebSocket-Protocol': 'synthesize',
|
|
24
33
|
'Sec-WebSocket-Version': '13',
|
|
25
|
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
34
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0'
|
|
26
35
|
},
|
|
27
36
|
VOICE_HEADERS: {
|
|
28
|
-
'Authority': 'speech.platform.bing.com',
|
|
29
37
|
'Sec-CH-UA': '" Not;A Brand";v="99", "Microsoft Edge";v="140", "Chromium";v="140"',
|
|
30
38
|
'Sec-CH-UA-Mobile': '?0',
|
|
31
39
|
'Accept': '*/*',
|
|
32
40
|
'Sec-Fetch-Site': 'none',
|
|
33
41
|
'Sec-Fetch-Mode': 'cors',
|
|
34
|
-
'Sec-Fetch-Dest': 'empty'
|
|
35
|
-
|
|
36
|
-
},
|
|
42
|
+
'Sec-Fetch-Dest': 'empty'
|
|
43
|
+
}
|
|
37
44
|
};
|
package/dist/services/EdgeTTS.js
CHANGED
|
@@ -36,9 +36,7 @@ class EdgeTTS {
|
|
|
36
36
|
});
|
|
37
37
|
const response = await new Promise((resolve, reject) => {
|
|
38
38
|
const req = https_1.default.request(`${constants_1.Constants.VOICES_URL}?Ocp-Apim-Subscription-Key=${constants_1.Constants.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${secMsGEC}&Sec-MS-GEC-Version=${constants_1.Constants.VERSION_MS_GEC}`, {
|
|
39
|
-
headers:
|
|
40
|
-
"User-Agent": constants_1.Constants.USER_AGENT
|
|
41
|
-
},
|
|
39
|
+
headers: constants_1.Constants.getBaseHeaders(),
|
|
42
40
|
agent: httpsAgent
|
|
43
41
|
}, (res) => {
|
|
44
42
|
let data = '';
|
|
@@ -117,9 +115,7 @@ class EdgeTTS {
|
|
|
117
115
|
const reqId = this.generateUUID();
|
|
118
116
|
const url = `${constants_1.Constants.WSS_URL}?Ocp-Apim-Subscription-Key=${constants_1.Constants.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${secMsGEC}&Sec-MS-GEC-Version=${constants_1.Constants.VERSION_MS_GEC}&ConnectionId=${reqId}`;
|
|
119
117
|
this.ws = new ws_1.default(url, {
|
|
120
|
-
headers:
|
|
121
|
-
"User-Agent": constants_1.Constants.USER_AGENT
|
|
122
|
-
},
|
|
118
|
+
headers: constants_1.Constants.getBaseHeaders(),
|
|
123
119
|
rejectUnauthorized: false
|
|
124
120
|
});
|
|
125
121
|
const SSML_text = this.getSSML(text, voice, options);
|
|
@@ -259,9 +255,7 @@ class EdgeTTS {
|
|
|
259
255
|
const secMsGEC = await this.generateSecMsGec(constants_1.Constants.TRUSTED_CLIENT_TOKEN);
|
|
260
256
|
const url = `${constants_1.Constants.WSS_URL}?Ocp-Apim-Subscription-Key=${constants_1.Constants.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${secMsGEC}&Sec-MS-GEC-Version=${constants_1.Constants.VERSION_MS_GEC}&ConnectionId=${reqId}`;
|
|
261
257
|
this.ws = new ws_1.default(url, {
|
|
262
|
-
headers:
|
|
263
|
-
"User-Agent": constants_1.Constants.USER_AGENT
|
|
264
|
-
},
|
|
258
|
+
headers: constants_1.Constants.getBaseHeaders(),
|
|
265
259
|
rejectUnauthorized: false
|
|
266
260
|
});
|
|
267
261
|
const SSML_text = this.getSSML(text, voice, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andresaya/edge-tts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Edge TTS is a package that allows access to the online text-to-speech service used by Microsoft Edge without the need for Microsoft Edge, Windows, or an API key.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"commander": "^12.1.0",
|
|
33
33
|
"events": "^3.3.0",
|
|
34
34
|
"fs": "^0.0.1-security",
|
|
35
|
-
"ws": "^8.18.
|
|
35
|
+
"ws": "^8.18.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"typescript": "^5.0.0"
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"bin": {
|
|
44
|
-
"edge-tts": "dist/cli/edge-tts.js"
|
|
44
|
+
"edge-tts": "./dist/cli/edge-tts.js"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"bun": ">=0.5.0"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|