#!/usr/bin/lua5.1
--需要luacurl http://luacurl.luaforge.net/
--luajson https://github.com/mbalmer/luajson
require("luacurl")
require('json')
function get_html(url, c)
local result = { }
if c == nil then
c = curl.new()
end
c:setopt(curl.OPT_URL, url)
c:setopt(curl.OPT_WRITEDATA, result)
c:setopt(curl.OPT_WRITEFUNCTION, function(tab, buffer) --call back函数,必须有
table.insert(tab, buffer) --tab参数即为result,参考http://luacurl.luaforge.net/
return #buffer
end)
local ok = c:perform()
return ok, table.concat(result) --此table非上一个table,作用域不同
end
function downMp3(id)
local url="http://www.ximalaya.com/tracks/"..id..".json"
local mp3 = "http://fdfs.xmcdn.com/"
local ok,html = get_html(url)
if ok then
local result = json.decode(html)
print(mp3..result.play_path_64)
else
print("error")
end
end
if arg[1] and tonumber(arg[1]) then
downMp3(arg[1])
else
print("请输入编号")
end
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有