Alexyz21
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору local GetPage = function(x) local s if x then s=io.popen("curl.exe -k "..x,"rb"):read("*all") end return s end local GetIp = function(x) local s if x then s=io.popen("nslookup.exe "..x,"rb"):read("*all") if s then x=string.gsub(x,'[%.%-]','%%%1') s=string.match(s,'Name:%s-'..x..'%c%c-Address:%s-(%d%d-%.%d%d-%.%d%d-%.%d+)') or string.match(s,'Address:%s-(%d%d-%.%d%d-%.%d%d-%.%d+)%c%c-Aliases:%s-'..x) end end return s end local urls={ "https://iptvm3u.ru/iptvhd.m3u", "https://iptvm3u.ru/one.m3u", "https://smarttvnews.ru/apps/iptvchannels.m3u", "https://smarttvnews.ru/apps/AutoIPTV.m3u", "https://webarmen.com/my/iptv/auto.nogrp.q.m3u" } _G.pgm=nil _G.pgm={} local ipUrl = function(url) local p,d,s = string.match(url,'^([hu][^:]-://)([^:/]-)([:/].+)$') if string.find(d,'[a-zA-Z]') then d=GetIp(d) or d end return p..d..s end for k,v in pairs(urls) do for h,u in string.gmatch(GetPage(v).."\n","(#EXTINF:%C-)%c%c-([uUhH]%C-)%c%c-") do if h and u then table.insert(pgm,{h,string.lower(ipUrl(u) or u),u}) end end end table.sort(pgm,function(a,b) return a[2]<b[2] end) for i=#pgm,2,-1 do if pgm[i][2]==pgm[i-1][2] then table.remove(pgm,i) end end local fname=win.GetEnv('TEMP')..'\\My.m3u' local h=io.open(fname,"ab") h:write('#EXTM3U\n') for k,v in pairs(pgm) do h:write(v[1]..'\n'..v[2]..'\n') end h:close() |