def find_package_id(package_name): logger.info("pyload_client.find_package_id package_name="+package_name) api_url = urlparse.urljoin(config.get_setting("pyload"),"/api/getQueue") logger.info("pyload_client.find_package_id api_url="+api_url) data = scrapertools.cache_page( api_url ) logger.info("pyload_client.find_package_id data="+data) try: package_id = scrapertools.get_match(data,'"name"\s*:\s*"'+package_name+'".*?"pid"\s*\:\s*(\d+)') except: package_id = None return package_id
def parse_categories_from_m3u_list(data): logger.info("simpletv.parse_categories_from_m3u_list") entries = [] encontradas = set() # Busca el bloque con los canales lines = data.split("\n") i = 0 # Recorre la lista while i < len(lines): # Cada entrada empieza por #EXTINF ''' #EXTINF:-1 $ExtFilter="DIGITAL",DOCUMENTALES:NATIONAL GEOGRAPHIC rtmp://$OPT:rtmp-raw=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live ''' if lines[i].startswith("#EXTINF"): title = lines[i] logger.info("title=" + title) try: entry_category = scrapertools.get_match( title, '\$ExtFilter\="([^"]+)"') except: entry_category = "" if entry_category == "": entry_category = NO_CATEGORY if entry_category not in encontradas: encontradas.add(entry_category) entries.append(Item(title=entry_category)) i = i + 1 return entries
def parse_categories_from_m3u_list(data): logger.info("simpletv.parse_categories_from_m3u_list") entries = [] encontradas = set() # Busca el bloque con los canales lines = data.split("\n") i=0 # Recorre la lista while i<len(lines): # Cada entrada empieza por #EXTINF ''' #EXTINF:-1 $ExtFilter="DIGITAL",DOCUMENTALES:NATIONAL GEOGRAPHIC rtmp://$OPT:rtmp-raw=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live ''' if lines[i].startswith("#EXTINF"): title = lines[i] logger.info("title="+title) try: entry_category = scrapertools.get_match(title,'\$ExtFilter\="([^"]+)"') except: entry_category = "" if entry_category == "": entry_category = NO_CATEGORY if entry_category not in encontradas: encontradas.add(entry_category) entries.append( Item(title=entry_category) ) i = i + 1 return entries
def streaminto(params): plugintools.log('[%s %s] streaminto %s' % (addonName, addonVersion, repr(params))) page_url = params.get("url") if page_url.startswith("http://streamin.to/embed-") == False: videoid = plugintools.find_single_match(page_url,"streamin.to/([a-z0-9A-Z]+)") page_url = "http://streamin.to/embed-"+videoid+".html" plugintools.log("page_url= "+page_url) # Leemos el código web headers = {'user-agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'} r = requests.get(page_url, headers=headers) data = r.text plugintools.log("data= "+data) if data == "File was deleted": xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % ('PalcoTV', "Archivo borrado!", 3 , art+'icon.png')) else: # TODO: Si "video not found" en data, mostrar mensaje "Archivo borrado!" patron_flv = 'file: "([^"]+)"' patron_jpg = 'image: "(http://[^/]+/)' try: host = scrapertools.get_match(data, patron_jpg) plugintools.log("[streaminto.py] host="+host) flv_url = scrapertools.get_match(data, patron_flv) plugintools.log("[streaminto.py] flv_url="+flv_url) flv = host+flv_url.split("=")[1]+"/v.flv" plugintools.log("[streaminto.py] flv="+flv) page_url = flv except: plugintools.log("[streaminto] opcion 2") op = plugintools.find_single_match(data,'<input type="hidden" name="op" value="([^"]+)"') plugintools.log("[streaminto] op="+op) usr_login = "" id = plugintools.find_single_match(data,'<input type="hidden" name="id" value="([^"]+)"') plugintools.log("[streaminto] id="+id) fname = plugintools.find_single_match(data,'<input type="hidden" name="fname" value="([^"]+)"') plugintools.log("[streaminto] fname="+fname) referer = plugintools.find_single_match(data,'<input type="hidden" name="referer" value="([^"]*)"') plugintools.log("[streaminto] referer="+referer) hashstring = plugintools.find_single_match(data,'<input type="hidden" name="hash" value="([^"]*)"') plugintools.log("[streaminto] hashstring="+hashstring) imhuman = plugintools.find_single_match(data,'<input type="submit" name="imhuman".*?value="([^"]+)"').replace(" ","+") plugintools.log("[streaminto] imhuman="+imhuman) import time time.sleep(10) # Lo pide una segunda vez, como si hubieras hecho click en el banner #op=download1&usr_login=&id=z3nnqbspjyne&fname=Coriolanus_DVDrip_Castellano_by_ARKONADA.avi&referer=&hash=nmnt74bh4dihf4zzkxfmw3ztykyfxb24&imhuman=Continue+to+Video post = "op="+op+"&usr_login="******"&id="+id+"&fname="+fname+"&referer="+referer+"&hash="+hashstring+"&imhuman="+imhuman request_headers.append(["Referer",page_url]) data_video = plugintools.read_body_and_headers( page_url , post=post, headers=request_headers ) data_video = data_video[0] rtmp = plugintools.find_single_match(data_video, 'streamer: "([^"]+)"') print 'rtmp',rtmp video_id = plugintools.find_single_match(data_video, 'file: "([^"]+)"') print 'video_id',video_id swf = plugintools.find_single_match(data_video, 'src: "(.*?)"') print 'swf',swf page_url = rtmp+' swfUrl='+swf + ' playpath='+video_id+"/v.flv" plugintools.play_resolved_url(page_url)
def parse_items_from_m3u_list(data,category=NO_CATEGORY): logger.info("simpletv.parse_items_from_m3u_list category="+str(category)) entries = [] # Busca el bloque con los canales lines = data.split("\n") i=0 # Recorre la lista while i<len(lines): # Cada entrada empieza por #EXTINF ''' #EXTINF:-1 $ExtFilter="DIGITAL",DOCUMENTALES:NATIONAL GEOGRAPHIC rtmp://$OPT:rtmp-raw=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live ''' if lines[i].startswith("#EXTINF"): title = lines[i] try: entry_category = scrapertools.get_match(title,'\$ExtFilter\="([^"]+)"') except: entry_category = "" if entry_category == "": entry_category = NO_CATEGORY logger.info("title="+title+" category="+entry_category) if category == NO_CATEGORY or entry_category == category: title = re.compile('\$ExtFilter\="([^"]+)"',re.DOTALL).sub("",title) title = title.replace('#EXTINF:-1',"") title = title.strip() if title.startswith(","): title = title[1:].strip() url = lines[i+1].strip() logger.info("----------------------------------------------------") logger.info("title="+title) logger.info("url1="+url) #url1=rtmp://$OPT:rtmp-raw=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live #if url.startswith(("rtmp://", "rtmpt://", "rtmpe://", "rtmpte://", "rtmps://")): if url.startswith("rtmp"): url = url.replace("rtmp://$OPT:rtmp-raw=","") logger.info("url2="+url) #url2=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live url = url.replace("live=1", "live=true") logger.info("url3="+url) #url3=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=true pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live url = url.replace("--live","live=true") logger.info("url4="+url) #url4=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=true pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK live=true if not re.search(" timeout=", url): url = url + " timeout=300" logger.info("url5="+url) #url5=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=true pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:O timeout=300 entries.append( Item(title=title,url=url,category=entry_category) ) i = i + 1 return entries
def parse_items_from_m3u_list(data, category=NO_CATEGORY): logger.info("simpletv.parse_items_from_m3u_list category=" + str(category)) entries = [] # Busca el bloque con los canales lines = data.split("\n") i = 0 # Recorre la lista while i < len(lines): # Cada entrada empieza por #EXTINF ''' #EXTINF:-1 $ExtFilter="DIGITAL",DOCUMENTALES:NATIONAL GEOGRAPHIC rtmp://$OPT:rtmp-raw=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live ''' if lines[i].startswith("#EXTINF"): title = lines[i] try: entry_category = scrapertools.get_match( title, '\$ExtFilter\="([^"]+)"') except: entry_category = "" if entry_category == "": entry_category = NO_CATEGORY logger.info("title=" + title + " category=" + entry_category) if category == NO_CATEGORY or entry_category == category: title = re.compile('\$ExtFilter\="([^"]+)"', re.DOTALL).sub("", title) title = title.replace('#EXTINF:-1', "") title = title.strip() if title.startswith(","): title = title[1:].strip() url = lines[i + 1].strip() logger.info( "----------------------------------------------------") logger.info("title=" + title) logger.info("url1=" + url) #url1=rtmp://$OPT:rtmp-raw=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live #if url.startswith(("rtmp://", "rtmpt://", "rtmpe://", "rtmpte://", "rtmps://")): if url.startswith("rtmp"): url = url.replace("rtmp://$OPT:rtmp-raw=", "") logger.info("url2=" + url) #url2=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=1 pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live url = url.replace("live=1", "live=true") logger.info("url3=" + url) #url3=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=true pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK --live url = url.replace("--live", "live=true") logger.info("url4=" + url) #url4=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=true pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:OK live=true if not re.search(" timeout=", url): url = url + " timeout=300" logger.info("url5=" + url) #url5=rtmp://212.7.206.71/live playpath=showstreamintvtoros2222?id=40786 swfUrl=http://www.ucaster.eu/static/scripts/eplayer.swf live=true pageUrl=http://www.ucaster.eu/embedded/showstreamintvtoros2222/1/650/400 conn=S:O timeout=300 entries.append( Item(title=title, url=url, category=entry_category)) i = i + 1 return entries