该软件包提供了一种简单的方法,可以从node.js中的tiktok的文本到语音(TTS)API生成文本到语音音频文件。
npm i tiktok-tts
const {config,createaudiofromtext} = require('tiktok-tts')config('your tiktok session in there there''); createAudiiofromtext('要说的文本toke toke toke there the eke there'');
const {config,createaudiofromtext} = require('tiktok-tts')config('your tiktok session in there there'); createaudiiofromtext(要说的'text tock to to to to to to to to to tome there there there''myaudio''myaudio');
生成的音频文件将保存为myAudio.mp3
const {config,createaudiofromtext} = require('tiktok-tts')config('your tiktok sessionid there there''''''''); createAudiiofromtext('要说的文本to to to to there oker there there'','./mydirectory/myaudio');
生成的音频文件将在myDirectory
目录中保存为myAudio.mp3
。
myDirectory
需要成为现有目录。const {config,createaudiofromtext} = require('tiktok-tts')config('your tiktok session in there there'); createAudiiofromText(要说的'text tock tock toke toke toke there there','myaudio','myaudio','en_us_us_stormtorper'');
createAudioFromText()
函数一起await
const {config,createAudiofromText} = require('tiktok-tts')config('your tiktok session in there there on there'); async函数yourfunction yourfunction yourfunction()生成!”);} yourfunction();
为浏览器安装Cookie编辑器扩展程序。
登录到Tiktok Web
在Tiktok Web上,打开扩展名并查找sessionid
复制sessionid
值。 (应该是字母数值)
config(tiktoksessionid,custombaseurl)
范围 | 描述 | 默认 | 类型 |
---|---|---|---|
tiktoksessionid | 您的tiktok sessionid | null | 细绳 |
CustomBaseurl | 自定义Tiktok API URL optional | - | 细绳 |
默认情况下,如果未指定customBaseUrl
,将使用https://api16-normal-c-useast1a.tiktokv.com/media/api/text/speech/invoke
使用。
https://api16-normal-c-useast1a.tiktokv.com/media/api/paix/text/speech/invoke
https://api16-core-c-useast1a.tiktokv.com/media/api/pai/text/speech/invoke
https://api16-normal-useast5.us.tiktokv.com/media/api/api/text/speech/invoke
https://api16-core.tiktokv.com/media/api/text/speech/invoke
https://api16-core-useast5.us.tiktokv.com/media/api/text/speech/invoke
https://api19-core-c-useast1a.tiktokv.com/media/api/api/text/speech/invoke
https://api-core.tiktokv.com/media/api/text/speech/invoke
https://api-normal.tiktokv.com/media/api/text/speech/invoke
https://api19-normal-c-useast1a.tiktokv.com/media/api/paix/text/speech/invoke
https://api16-core-core-c-yasg.tiktokv.com/media/api/text/speech/invoke
https://api16-normal-c-alisg.tiktokv.com/media/api/text/speech/invoke
https://api22-core-core-cy-alisg.tiktokv.com/media/api/text/speech/invoke
https://api16-normal-c-useast2a.tiktokv.com/media/api/pai/text/speech/invoke
CreateAudioFromText(文本,文件名,扬声器)
范围 | 描述 | 默认 | 类型 |
---|---|---|---|
文本 | 要转换为音频的文字 | null | 细绳 |
文件名 | 生成的音频文件的文件名/路径optional | audio | 细绳 |
扬声器 | tiktok扬声器代码optional | en_us_001 | 细绳 |
支持以下扬声器代码:
语言 | 扬声器 | 扬声器代码 |
---|---|---|
英语 | 游戏开启 | en_male_jomboy |
杰西 | en_us_002 | |
温暖的 | ES_MX_002 | |
古怪 | en_male_funny | |
尖叫 | en_us_ghostface | |
善解人意 | en_female_samc | |
严肃的 | en_male_cody | |
美容大师 | en_female_makeup | |
好朋友 | en_female_richgirl | |
骗子 | en_male_grinch | |
乔伊 | en_us_006 | |
故事柜员 | en_male_narration | |
古德先生 | en_male_deadpool | |
叙述者 | en_uk_001 | |
英国男性英国 | en_uk_003 | |
地铁 | en_au_001 | |
阿尔弗雷德 | en_male_jarvis | |
Ashmagic | en_male_ashmagic | |
Olantekkers | en_male_olantekkers | |
勋爵克林格 | en_male_ukneighbor | |
细致先生 | en_male_ukbutler | |
处女座 | en_female_shenna | |
大学 | en_female_pansino | |
马蒂 | en_male_trevor | |
流行催眠曲 | en_female_f08_twinkle | |
经典电气 | en_male_m03_classical | |
贝 | en_female_betty | |
丘比特 | en_male_cupid | |
奶奶 | en_female_grandma | |
舒适 | en_male_m2_xhxs_m03_christmas | |
作者 | en_male_santa_narration | |
颂歌 | en_male_sing_deep_jingle | |
圣诞老人 | en_male_santa_effect | |
NYE 2023 | en_female_ht_f08_newyear | |
魔术师 | en_male_wizard | |
歌剧 | EN_FEMALE_HT_F08_HALLOEN | |
欣快 | en_female_ht_f08_glorious | |
高度 | en_male_sing_funny_it_goes_up | |
情节剧 | en_female_ht_f08_wonderful_world | |
古怪的时间 | en_male_m2_xhxs_m03_silly | |
和平 | en_female_emotional | |
Toon Beat | en_male_m03_sunshine_soon | |
打开麦克风 | en_female_f08_warmy_breeze | |
叮当声 | en_male_m03_lobby | |
感恩 | en_male_sing_funny_thanksgiving | |
Cottagecore | en_female_f08_salut_damour | |
教授 | en_us_007 | |
科学家 | en_us_009 | |
信心 | en_us_010 | |
光滑的 | en_au_002 | |
迪士尼 | 鬼脸 | en_us_ghostface |
Chewbacca | en_us_chewbacca | |
C3PO | en_us_c3po | |
缝 | en_us_stitch | |
突击队员 | EN_US_STORMTROOPER | |
火箭 | en_us_rocket | |
leota夫人 | en_female_madam_leota | |
幽灵主持人 | en_male_ghosthost | |
海盗 | en_male_pirate | |
法语 | 法语 - 男性1 | FR_001 |
法语 - 男性2 | FR_002 | |
西班牙语 | 西班牙(西班牙) - 男性 | ES_002 |
西班牙MX-男性 | ES_MX_002 | |
葡萄牙语 | 葡萄牙BR-女1 | BR_001 |
葡萄牙BR-女性2 | BR_003 | |
葡萄牙BR-女性3 | BR_004 | |
葡萄牙BR-男性 | BR_005 | |
Ivete Sangalo | bp_female_ivete | |
卢德米拉 | bp_female_ludmilla | |
LHAYS MACEDO | pt_female_lhays | |
laizza | pt_female_laizza | |
GalvãoBueno | pt_male_bueno | |
德语 | 德语 - 女 | de_001 |
德语 - 男性 | de_002 | |
印度尼西亚 | 印尼 - 女性 | ID_001 |
日本人 | 日语 - 女1 | JP_001 |
日语 - 女2 | JP_003 | |
日语 - 女性3 | JP_005 | |
日语 - 男性 | JP_006 | |
りーさ | jp_female_fujicochan | |
世罗铃 | jp_female_hasegawariona | |
莫里奥的厨房 | jp_male_keiichinakano | |
夏絵ココ | JP_FEMALE_OOMAEAIKA | |
低音ボイス | jp_male_yujinchigusa | |
四郎 | jp_female_shirou | |
玉川寿纪 | jp_male_tamawakazuki | |
庄司果织 | jp_female_kaorishoji | |
八木沙季 | jp_female_yagishaki | |
ヒカキン | jp_male_hikakin | |
丸山礼 | jp_female_rei | |
修一朗 | jp_male_shuichiro | |
マツダ家の日常 | jp_male_matsudake | |
まちこりーた | jp_female_machikoriiita | |
モジャオ | jp_male_matsuo | |
モリスケ | jp_male_osada | |
韩国人 | 韩文 - 男性1 | KR_002 |
韩语 - 女性 | KR_003 | |
韩语 - 男性2 | KR_004 | |
越南人 | 女性 | bv074_streaming |
男性 | bv075_streaming | |
其他 | 阿尔托 | en_female_f08_salut_damour |
男高音 | en_male_m03_lobby | |
阳光很快 | en_male_m03_sunshine_soon | |
温暖的微风 | en_female_f08_warmy_breeze | |
辉煌 | en_female_ht_f08_glorious | |
它上升了 | en_male_sing_funny_it_goes_up | |
花栗鼠 | en_male_m2_xhxs_m03_silly | |
戏剧性 | en_female_ht_f08_wonderful_world |