Page 1 of 1

HTTPS request in VLC

Posted: 15 Jan 2017 16:37
by RedStone
Hi, i'm writing a small vlc extension for nba league pass, actually i rewrite kodi addon for vlc, and i'm stuck at very beginning with LogIn function, i write working lua script in ZeroBrain Studio

Code: Select all

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-coockie"])
Problem is that it uses "https". I've tried do that but get this error

Code: Select all

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
So, my question is how to https request in vlc?
Thanks.

Re: HTTPS request in VLC

Posted: 18 Jan 2017 12:11
by roland1
Try to wrap your code into a function called activate, i.e:
function activate() --[[ your code ]] end
To print a message, You can use e.g:
vlc.msg.info("Hello World!")
IIRC vlc uses Lua5.2, but it should be possible to just print _VERSION. Modules not compatible to _VERSION cannot be loaded (quite obvious).
package.path and package.cpath are pathes, where Lua searches for Modules, just in case "Your" modules were not in "Path".
regards

Re: HTTPS request in VLC

Posted: 19 Jan 2017 17:13
by RedStone
I've tried that, but get error "dynamic libraries not enabled" because vlc is compiled without LUA_DL_DLL flag, i've tried to compile vlc by myself, but i couldn't install "wine64-development-tools" so i couldn't compile vlc, and i give up.