Python script for checking IPTV streams (UDP)

My fiber optic internet provider supports IPTV over UDP. However, they do not list channels anywhere.

I found most of them manually, but would like to have a script that can check if the channel is active / available.

Any ideas on how to do this in Python?

+3
source share
1 answer

I think python code should look like this. Please note that do not run it in Python IDLE, as ipRange () will hang.

def ipRange(start_ip, end_ip):
  start = list(map(int, start_ip.split(".")))
  end = list(map(int, end_ip.split(".")))
  temp = start
  ip_range = []

  ip_range.append(start_ip)
  while temp != end:
    start[3] += 1
    for i in (3, 2, 1):
      if temp[i] == 256:
        temp[i] = 0
        temp[i-1] += 1
    ip_range.append(".".join(map(str, temp)))    
  return ip_range

def IPTVSignalTest(ip):
  # do your test here, return true if IPTV signal, false otherwise
  return TRUE

ip_range = ipRange("192.168.1.0", "192.171.3.25")
save_ip = []
for ip in ip_range:
  if IPTVSignalTest(ip):
    save_ip.append(ip)
+1
source

Source: https://habr.com/ru/post/1783100/


All Articles