从url lua ubuntu保存文件

时间:2018-03-28 10:10:22

标签: linux ubuntu url lua

我想从UTL下载mp3文件并将其保存到文件夹中。

这是我的代码:

local sound =  HTTPS.request('https://hozory.com/translate/?target='..matches[1]..'&text='..text)

local voice = json:decode(sound)

if voice.result.Voice_link ~= "false" then
local f = assert(io.open('test.mp3', 'w'))
f:write(voice.result.Voice_link)
f:close()

但是这会创建一个空的mp3文件。

0 个答案:

没有答案