Перепиши скрипт lua на python: local filter = { } local host = 'https://tvplusonline.ru'…
- User
Перепиши скрипт lua на python:
local filter = { } local host = 'https://tvplusonline.ru' local my_src_name = 'TV+' module('tvplusonline_pls', package.seeall) local function ProcessFilterTableLocal(t) if not type(t) == 'table' then return end for i = 1, #t do t[i].name = tvs_core.tvs_clear_double_space(t[i].name) for , ff in ipairs(filter) do if (type(ff) == 'table' and t[i].name == ff[1]) then t[i].name = ff[2] end end end return t end function GetSettings() return {name = my_src_name, sortname = '', scraper = '', m3u = 'out' .. my_src_name .. '.m3u', logo = '..\Channel\logo\Icons\TVplus.png', TypeSource = 1, TypeCoding = 1, DeleteM3U = 1, RefreshButton = 1, show_progress = 0, AutoBuild = 0, AutoBuildDay = {0, 0, 0, 0, 0, 0, 0}, LastStart = 0, TVS = {add = 1, FilterCH = 1, FilterGR = 1, GetGroup = 1, LogoTVG = 0}, STV = {add = 1, ExtFilter = 1, FilterCH = 1, FilterGR = 1, GetGroup = 1, HDGroup = 1, AutoSearch = 1, AutoNumber = 1, NumberM3U = 0, GetSettings = 1, NotDeleteCH = 0, TypeSkip = 1, TypeFind = 1, TypeMedia = 0, RemoveDupCH = 1}} end function GetVersion() return 2, 'UTF-8' end local function LoadFromSite() local session = m_simpleTV.Http.New('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0') if not session then return end m_simpleTV.Http.SetTimeout(session, 8000) local header = 'X-LHD-Agent: {"platform":"web","app":"tvplusonline.ru"}' local rc, answer = m_simpleTV.Http.Request(session, {url = decode64('aHR0cDovL3R2cGx1c29ubGluZS5ydS9hcGkvdjQvcGxheWxpc3Q'), headers = header}) if rc ~= 200 then return end answer = answer:gsub('\', '\\') answer = answer:gsub('\"', '\\"') answer = answer:gsub('\/', '/') answer = answer:gsub('%[%]', '""') require 'json' local err, tab = pcall(json.decode, answer) if not tab or not tab.channels then return end local t = {} for i = 1, #tab.channels do local slug = tab.channels[i].address local title = tab.channels[i].name_ru if slug and title then t[#t + 1] = {} t[#t].name = unescape3(title) t[#t].address = host .. '/' .. slug if tab.channels[i].with_archive then t[#t].RawM3UString = string.format('catchup="append" catchup-days="%s" catchup-source=""', (tab.channels[i].day_archive or 0)) end t[#t].logo = tab.channels[i].image or '' end end return t
- Assistant