-- Example: http://ontivi.net/kinosemyatv.html -- Add parameter to url function string.addParam(url, param) if url:match("%?") then return url.."&"..param else return url.."?"..param end end -- Trimming spaces function string.trim(text) return text:gsub("^%s*(.-)%s*$", "%1") end -- Probe function. function probe() if vlc.access ~= "http" and vlc.access ~= "https" then return false end return vlc.path:match("ontivi%.net/%Z+%.html") or vlc.path:match("%?kes=%w+") end function string.base64_decode(data) local b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" data = string.gsub(data, '[^'..b..'=]', '') return (data:gsub('.', function(x) if x == '=' then return '' end local r,f='',(b:find(x)-1) for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end return r; end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x) if #x ~= 8 then return '' end local c=0 for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end return string.char(c) end)) end -- Parse function. function parse() local html = vlc.read(200000) local temp = string.rep("S", 8):gsub("S","%%S").."//" if vlc.path:match("%?kes=%w+") then html = html:match('glob%(\"(.-)\"'):sub(4) html = string.base64_decode(html) url = html:match("{file:'#2(.-)'") url = string.reverse(url) while url:match(temp) do url = url:gsub(temp, '',1) end url = string.reverse(url) url = string.base64_decode(url) if not url then vlc.msg.err("Couldn't find url to stream in the "..vlc.access.."://"..vlc.path) end title = vlc.path:match("title=([^&]+)" ) img = vlc.path:match("poster=([^&]+)") if title then title = vlc.strings.decode_uri(title) end if img then img = vlc.strings.decode_uri(img ) end else url = html:match("kes:'(.-)'") title = html:match('