接口地址
http://gmapi.liulikeji.top:15842/dfpwm
请求格式:httpGet / httpPost
输入:json
参数:url (音频文件下载链接)
返回:类型:字符串(dfpwm文件下载链接)
http://fserver.liulikeji.top:15848/WAVFILE/{ID}.dfpwm
例1:
播放:http://fserver.liulikeji.top:15848/云数据中心/2460671937.mp3
musicURL = "http://fserver.liulikeji.top:15848/%E4%BA%91%E6%95%B0%E6%8D%AE%E4%B8%AD%E5%BF%83/2460671937.mp3"
local json = textutils.serialiseJSON({ ["url"] = musicURL } ) --json转换
local dfpwmURL = http.post("http://gmapi.liulikeji.top:15842/dfpwm",json).readAll() --输出:dfwpm文件下载链接
shell.run("speaker","play",dfpwmURL) --播放dfpwm
例2:
使用搜狗翻译文本朗读接口播放: hello world!
txt = "hello world!"
musicURL="https://fanyi.sogou.com/reventondc/synthesis?speed=1&lang=zh-CHS&from=translateweb&speaker=3.&text="..txt
local json = textutils.serialiseJSON( { ["url"] = musicURL } ) --json转换
local dfpwmURL = http.post("http://gmapi.liulikeji.top:15842/dfpwm",json).readAll() --输出:dfwpm文件下载链接
shell.run("speaker","play",dfpwmURL) --播放dfpwm
中文:
使用UrlEncode编码
%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%B8%96%E7%95%8C%EF%BC%81
txt = "%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%B8%96%E7%95%8C%EF%BC%81"
musicURL="https://fanyi.sogou.com/reventondc/synthesis?speed=1&lang=zh-CHS&from=translateweb&speaker=3.&text="..txt
local json = textutils.serialiseJSON( { ["url"] = musicURL } ) --json转换
local dfpwmURL = http.post("http://gmapi.liulikeji.top:15842/dfpwm",json).readAll() --输出:dfwpm文件下载链接
shell.run("speaker","play",dfpwmURL) --播放dfpwm
附:
在线文件存储:琉璃科技数据库 (liulikeji.top)