--script https://dzen.ru (14/09/2022) --https://zen.yandex.ru/video/watch/63015526eb85b8076be9354b --https://dzen.ru/video/watch/63015526eb85b8076be9354b if m_simpleTV.Control.ChangeAddress ~= 'No' then return end local inAdr = m_simpleTV.Control.CurrentAddress if inAdr==nil then return end if not string.match(inAdr, '^https://zen%.yandex%.ru/video/watch/' ) and not string.match(inAdr, '^https://dzen%.ru/video/watch/' ) then return end m_simpleTV.Control.ChangeAddress ='Yes' m_simpleTV.Control.CurrentAddress = 'error' local userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 OPR/89.0.4447.83" local session = m_simpleTV.Http.New(userAgent, nil, false) if session == nil then return end m_simpleTV.Http.SetTimeout(session, 3000) ------------------------------------------------------------------------------ local function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end ------------------------------------------------------ local rc, answer = m_simpleTV.Http.Request(session,{url = inAdr}) --m_simpleTV.Http.Close(session) if rc~=200 then return end --debug_in_file(answer .. '\n') answer = string.gsub(answer, '\\u002F', '/') local url = string.match(answer, '"host":"(.-)"') or '' local retpath = string.match(answer, '"retpath":"(.-)"') or '' local container = string.match(answer, "element2%.value.-'(.-)'") if container==nil then return end local body = 'retpath=' .. retpath .. '&container=' .. container rc, answer = m_simpleTV.Http.Request(session,{url = url, method='post', body = body}) if rc~=200 then return end rc, answer = m_simpleTV.Http.Request(session,{url = retpath}) m_simpleTV.Http.Close(session) if rc~=200 then return end --debug_in_file(answer .. '\n') local title = string.match(answer, '(.-)') or '' local id = string.match(answer, '"feed%#(.-)%#') if id == nil then return end id = string.gsub(id ,'-', '%%-') --debug_in_file(id .. '\n') local tmp = string.match(answer, '"__serverState(.-)') if tmp == nil then return end --debug_in_file(tmp .. '\n') local pattern = '"id":"' .. id .. '.-streams".-"(.-)"' local pattern_live = '"OutputStream":"(.-)"' local retAdr = string.match(tmp, pattern) or string.match(tmp, pattern_live) or '' --debug_in_file(retAdr .. '\n') m_simpleTV.Control.SetTitle(title) m_simpleTV.Control.CurrentAddress = retAdr