VLC Lua脚本https请求

时间:2017-01-17 02:27:40

标签: https lua vlc

我正在为nba联盟传递写一个小的vlc扩展,实际上我为vlc重写了kodi插件,而且我刚开始使用LogIn函数,我在ZeroBrain Studio中编写了工作lua脚本

http = require("socket.http")
json = require("dkjson")
ltn12 = require("ltn12")
https = require("ssl/https")

data = "username=user&password=pass"

res, code, response_headers, status = https.request {
    response_body = {} , 
    method = "POST",
    headers= {
      ["Content-Type"]="application/x-www-form-urlencoded",
      ["Content-Length"] = data:len()
      },
    url = 'https://watch.nba.com/nba/secure/login?',
    source = ltn12.source.string(data),
    sink = ltn12.sink.table(response_body)  
}

print (response_headers["set-cookie"])

问题是它使用" https"。我尝试过做this但收到错误

Error while running script C:\Program Files (x86)\VideoLAN\VLC\lua\extensions\nba_league_pass.lua, function (null)(): error loading module 'socket.core' from file '.\socket\core.dll': dynamic libraries not enabled; check your Lua installation

所以,我的问题是如何在vlc中发出https请求? 感谢。

1 个答案:

答案 0 :(得分:1)

  

从文件'。\ socket \ core.dll'加载模块'socket.core'时出错:未启用动态库;检查您的Lua安装

“未启用动态库”通常表示您的Lua解释器编译时没有LUA_DL_DLL编译标志(在Windows上);指定此编译标志可以加载动态库。 (Lua解释器将是与VLC打包或嵌入到VLC中的解释器,如果这就是您正在运行的那个。)