【问题标题】:VLC Lua scripting https requestVLC Lua 脚本 https 请求
【发布时间】:2017-05-31 23:40:54
【问题描述】:

我正在为 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 请求? 谢谢。

【问题讨论】:

    标签: https lua vlc


    【解决方案1】:

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

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

    【讨论】:

    • 你说得对,这是我在旧 vlc git github.com/videolan/vlc/blob/master/contrib/src/lua/… 中找到的,但新版本使用相同的代码(补丁),所以现在我需要使用该标志编译 vlc,这绝非易事开源。感谢您的帮助。
    • @Dmitriy,如果它对您有用,您可能希望接受答案。
    • 还是无法编译,提示找不到Lua,但是我安装了Lua5.2和dev-lua,编译后接受。我尝试过早期版本的 VLC,2.0.9 是最后一个没有该补丁的版本,我也收到“未启用动态库”错误
    • 您需要查看编译时使用的设置或找到使用所需设置进行编译的方法。如果没有编译支持,您将无法使动态库正常工作。
    • 我明白,但我什至无法从源代码编译 vlc,不知道出了什么问题。所以我不能告诉你你的答案是否对我有帮助。我认为这是正确的方法,但无法检查。
    猜你喜欢
    • 1970-01-01
    • 2020-05-18
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 2021-01-29
    • 2017-07-09
    • 1970-01-01
    相关资源
    最近更新 更多