-- Example: http://viks.tv/430-belarus-5.html -- Decode function packed javascript function DecodePackedJS(w, i, s, e) local n = 0 local str1 = "" local str2 = "" while true do if n < 5 then str2 = str2..string.char(w:byte(n+1)) str2 = str2..string.char(i:byte(n+1)) str2 = str2..string.char(s:byte(n+1)) else if n < w:len() then str1 = str1..string.char(w:byte(n+1)) end if n < i:len() then str1 = str1..string.char(i:byte(n+1)) end if n < s:len() then str1 = str1..string.char(s:byte(n+1)) end end if str1:len() + str2:len() + e:len() >= w:len() + i:len() + s:len() + e:len() then break end n = n + 1 end local count = 1 local result = "" for n = 1, str1:len(), 2 do local nShift = -1 if (str2:byte(count) % 2) > 0 then nShift = 1 end result = result..string.char(tonumber(str1:sub(n, n+1), 36)-nShift) count = count + 1 if count > str2:len() then count = 1 end end return result end -- Probe function. function probe() if vlc.access ~= "http" and vlc.access ~= "https" then return false end return vlc.path:match("viks.tv") end -- Parse function. function parse() local html = vlc.read(200000) -- get all contents of html page -- search packed javascript and decode data = html while data:find("function%(w,i,s,e%)") do w,i,s,e = data:match(".+function%(w,i,s,e%).-%('(%w+)','(%w+)','(%w+)','(%w+)'") data = DecodePackedJS(w,i,s,e) end local url = data:match("http[^'\"]+%.m3u8[^'\"]+") if not url then vlc.msg.err("Couldn't find url to stream on the "..vlc.access.."://"..vlc.path) return {} end img = html:match("