fix: misc style / variable consistency changes

This commit is contained in:
2026-01-23 14:03:02 -03:00
parent 7cbb5f3a9f
commit 11539d149b
2 changed files with 9 additions and 12 deletions
+7 -9
View File
@@ -5,8 +5,8 @@ import * as https from 'https';
import * as zlib from 'zlib';
import TIKTOK_TTS_VOICES from './tiktok_voices.json';
const TIKTOK_TTS_ENDPOINT =
'https://api16-normal-v6.tiktokv.com/media/api/text/speech/invoke';
const TIKTOK_API_ENDPOINT =
'api16-normal-v6.tiktokv.com';
class TikTokTTS implements TTSModule {
public name: string = 'TikTok';
@@ -18,18 +18,16 @@ class TikTokTTS implements TTSModule {
async generate(voice: string, text: string): Promise<TTSResponse> {
const reqText = encodeURIComponent(text);
const path = `/?text_speaker=${voice}&req_text=${reqText}&speaker_map_type=0&aid=1233`;
const endpoint = new URL(TIKTOK_TTS_ENDPOINT);
const path = `/media/api/text/speech/invoke/?text_speaker=${voice}&req_text=${reqText}&speaker_map_type=0&aid=1233`;
const options: https.RequestOptions = {
hostname: endpoint.hostname,
path: endpoint.pathname + path,
hostname: TIKTOK_API_ENDPOINT,
path: path,
method: 'POST',
headers: {
'User-Agent':
'com.zhiliaoapp.musically/2022600030 (Linux; U; Android 7.1.2; es_ES; SM-G988N; Build/NRD90M;tt-ok/3.12.13.1)',
Cookie: `sessionid=${config.tiktok_session_id}`,
Cookie: `sessionid=${config.tts_tiktok_sessionid}`,
'Accept-Encoding': 'gzip,deflate,compress',
'Content-Type': 'application/x-www-form-urlencoded'
}
@@ -97,7 +95,7 @@ class TikTokTTS implements TTSModule {
}
canBeUsed(): boolean {
return config.tiktok_session_id != undefined;
return config.tts_tiktok_sessionid != undefined;
}
handleStatusError(code: number): string {
+2 -3
View File
@@ -8,13 +8,12 @@ export interface Config {
tts_azure_key: string | undefined;
tts_elevenlabs_key: string | undefined;
tts_tiktok_sessionid: string | undefined;
steam_webapi_key: string | undefined;
aws_access_id: string | undefined;
aws_access_key: string | undefined;
tiktok_session_id: string | undefined;
}
function loadConfig(): Config {
@@ -36,7 +35,7 @@ function loadConfig(): Config {
steam_webapi_key: process.env.STEAM_WEBAPI_KEY,
aws_access_id: process.env.AWS_ACCESS_ID,
aws_access_key: process.env.AWS_ACCESS_KEY,
tiktok_session_id: process.env.TIKTOK_SESSION_ID
tts_tiktok_sessionid: process.env.TTS_TIKTOK_SESSIONID
};
}