HTTPS request in VLC

Discuss your Lua playlist, album art and interface scripts.
RedStone
New Cone
New Cone
Posts: 2
Joined: 15 Jan 2017 16:28

HTTPS request in VLC

Postby RedStone » 15 Jan 2017 16:37

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.

roland1
Blank Cone
Blank Cone
Posts: 44
Joined: 01 May 2014 16:49

Re: HTTPS request in VLC

Postby roland1 » 18 Jan 2017 12:11

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

RedStone
New Cone
New Cone
Posts: 2
Joined: 15 Jan 2017 16:28

Re: HTTPS request in VLC

Postby RedStone » 19 Jan 2017 17:13

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.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 27 guests