SHARE
TWEET

Buscar Canales Imagenio

a guest Sep 17th, 2013 7,426 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket
  2. import struct
  3. import datetime
  4.  
  5.  
  6.  
  7. now = datetime.datetime.now()
  8. f = open('channels_' + str(now.strftime("%Y-%m-%d__%H_%M_%S")) + ".m3u",'a')
  9. f.write("#EXTM3U\n")
  10.  
  11.  
  12. for i in range(0,254):
  13.         for e in range(0,254):
  14.                 MCAST_GRP = '239.0.' + str(i) + '.' + str(e)
  15.                 MCAST_PORT = 8208
  16.                
  17.                 try:
  18.                         sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  19.                         sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  20.                         sock.settimeout(1)
  21.                         sock.bind(('', MCAST_PORT))
  22.                         mreq = struct.pack("4sl", socket.inet_aton(MCAST_GRP), socket.INADDR_ANY)
  23.  
  24.                         sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
  25.                
  26.                         print ("checking " + MCAST_GRP + ":" + str(MCAST_PORT) + "...")
  27.                        
  28.                         if sock.recv(128):
  29.                                 f.write("#EXTINF:0,rtp://" + MCAST_GRP + ":" + str(MCAST_PORT) + '\n')
  30.                                 f.write("rtp://@" + MCAST_GRP + ":" + str(MCAST_PORT) + '\n')
  31.                 except:
  32.                         pass
  33. f.close
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top