def read_body_and_headers(url, post=None, headers=[], follow_redirects=False, timeout=None): plugintools.log("movie4k.read_body_and_headers url=" + url) expiration = datetime.datetime.now() + datetime.timedelta(days=365) expiration_gmt = expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") if plugintools.get_setting("prefLanguage") == "0": headers.append([ "Cookie", "onlylanguage=de; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "1": headers.append([ "Cookie", "onlylanguage=en; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "2": headers.append([ "Cookie", "onlylanguage=fr; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "3": headers.append([ "Cookie", "onlylanguage=es; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "4": headers.append([ "Cookie", "onlylanguage=it; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "5": headers.append([ "Cookie", "onlylanguage=ru; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "6": headers.append([ "Cookie", "onlylanguage=jp; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) elif plugintools.get_setting("prefLanguage") == "7": headers.append([ "Cookie", "onlylanguage=tr; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) try: body, response_headers = plugintools.read_body_and_headers( url, post, headers, follow_redirects, timeout) except: xbmc.sleep(3) body, response_headers = plugintools.read_body_and_headers( url, post, headers, follow_redirects, timeout) return body, response_headers
def curl_frame(url, ref, body, bodyi, bodyy, urli): request_headers = [] request_headers.append(["User-Agent", "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) request_headers.append(["Referer", ref]) try: body, response_headers = plugintools.read_body_and_headers(url, headers=request_headers) # print "HEADERS:\n";print response_headers except: pass try: r = "'set-cookie',\s'([^;]+.)" jar = plugintools.find_single_match(str(response_headers), r) jar = getjad(jar) except: pass try: r = "'location',\s'([^']+)" loc = plugintools.find_single_match(str(response_headers), r) except: pass if loc: request_headers.append(["Referer", url]) if jar: request_headers.append(["Cookie", jar]) # print jar body, response_headers = plugintools.read_body_and_headers(loc, headers=request_headers) try: r = "'set-cookie',\s'([^;]+.)" jar = plugintools.find_single_match(str(response_headers), r) jar = getjad(jar) except: pass if body: bodyi += [body] return body
def read_body_and_headers(url, post=None, headers=[], follow_redirects=False, timeout=None): plugintools.log("movie4k.read_body_and_headers url="+url) expiration = datetime.datetime.now() + datetime.timedelta(days=365) expiration_gmt = expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") # The functionality "only movies in english" of the site is broken on the # movie's "Latest updates" page (no titles are displayed). If the option # "only_english" is enabled inthe addon preferences, the titles in other # languages are filtered out in the movies_updates() function. if plugintools.get_setting("only_english")=="true" and not url.endswith('/movies-updates.html'): plugintools.log("movie4k.read_body_and_headers only english") headers.append(["Cookie","onlylanguage=de; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) else: headers.append(["Cookie","xxx2=ok; expires="+expiration_gmt+";"]) body, response_headers = "", "" try: body,response_headers = plugintools.read_body_and_headers(url,post,headers,follow_redirects,timeout) except: xbmc.sleep(3000) try: body,response_headers = plugintools.read_body_and_headers(url,post,headers,follow_redirects,timeout) except: xbmcgui.Dialog().notification(MYNAME, "Connection to " + SITE_DOMAIN + " failed", xbmcgui.NOTIFICATION_ERROR) import traceback plugintools.log("movie4k.read_body_and_headers unexpected error: " + "".join(traceback.format_exception(*sys.exc_info()))) return body,response_headers
def pordede_getlink(params): link = params.get("url") plugintools.log("link= " + link) title = params.get("title") source = params.get("extra") body, response_headers = plugintools.read_body_and_headers( link) #, post=post) goto = plugintools.find_single_match( body, '<p class="nicetry links">(.*?)target="_blank"') link_redirect = plugintools.find_single_match(goto, '<a href="(.*?)"') link_redirect = web + link_redirect try: headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0", "Referer": link } body, response_headers = plugintools.read_body_and_headers( link_redirect) for i in response_headers: if i[0] == 'location': location = i[1] if location: print '$' * 30 + '- By PalcoTV Team -' + '$' * 30, location, '$' * 79 url_final = location params["url"] = url_final server_analyzer(params) except: xbmc.executebuiltin( "Notification(%s,%s,%i,%s)" % ('PalcoTV', "Error al extraer el Conector", 3, art + 'icon.png'))
def read_body_and_headers(url, post=None, headers=[], follow_redirects=False, timeout=None): plugintools.log("movie4k.read_body_and_headers url="+url) expiration = datetime.datetime.now() + datetime.timedelta(days=365) expiration_gmt = expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") if plugintools.get_setting("prefLanguage")=="0": headers.append(["Cookie","onlylanguage=de; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="1": headers.append(["Cookie","onlylanguage=en; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="2": headers.append(["Cookie","onlylanguage=fr; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="3": headers.append(["Cookie","onlylanguage=es; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="4": headers.append(["Cookie","onlylanguage=it; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="5": headers.append(["Cookie","onlylanguage=ru; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="6": headers.append(["Cookie","onlylanguage=jp; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) elif plugintools.get_setting("prefLanguage")=="7": headers.append(["Cookie","onlylanguage=tr; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) try: body,response_headers = plugintools.read_body_and_headers(url,post,headers,follow_redirects,timeout) except: xbmc.sleep(3) body,response_headers = plugintools.read_body_and_headers(url,post,headers,follow_redirects,timeout) return body,response_headers
def read_body_and_headers(url, post=None, headers=[], follow_redirects=False, timeout=None): plugintools.log("movie4k.read_body_and_headers url=" + url) expiration = datetime.datetime.now() + datetime.timedelta(days=365) expiration_gmt = expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") if plugintools.get_setting("only_english") == "true": plugintools.log("movie4k.read_body_and_headers only english") headers.append([ "Cookie", "onlylanguage=en; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) else: headers.append(["Cookie", "xxx2=ok; expires=" + expiration_gmt + ";"]) try: body, response_headers = plugintools.read_body_and_headers( url, post, headers, follow_redirects, timeout) except: xbmc.sleep(3) body, response_headers = plugintools.read_body_and_headers( url, post, headers, follow_redirects, timeout) return body, response_headers
def gethttp_referer_headers(url, referer): request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) request_headers.append(["Referer", referer]) body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) try: r = '\'set-cookie\',\s\'([^;]+.)' jar = plugintools.find_single_match(str(response_headers), r) jar = getjad(jar) except: pass try: r = '\'location\',\s\'([^\']+)' loc = plugintools.find_single_match(str(response_headers), r) except: pass if loc: request_headers.append(["Referer", url]) if jar: request_headers.append(["Cookie", jar]) #print jar body, response_headers = plugintools.read_body_and_headers( loc, headers=request_headers) try: r = '\'set-cookie\',\s\'([^;]+.)' jar = plugintools.find_single_match(str(response_headers), r) jar = getjad(jar) except: pass return body
def dbsowo_play(params): plugintools.log("dbsowo_play") request_headers=[] '''headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'Accept-Encoding': 'none', 'Accept-Language': 'en-US,en;q=0.8', 'Connection': 'keep-alive'}''' #request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["User-Agent","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"]) request_headers.append(["Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"]) request_headers.append(["Accept-Charset","ISO-8859-1,utf-8;q=0.7,*;q=0.3"]) request_headers.append(["Accept-Encoding","none"]) request_headers.append(["Accept-Language","en-US,en;q=0.8"]) request_headers.append(["Connection","keep-alive"]) url = params try: data,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) except: data="";xbmcgui.Dialog().ok("Error","\nFallo al obtener la información de","\n"+url) #plugintools.log("data="+data) matches = plugintools.find_single_match(data,'<iframe[^c]+c="([^"]+)') if not "http" in matches: matches = "http:"+matches plugintools.log("dbsowo_play="+matches) video_mp4 = "" try: data,response_headers = plugintools.read_body_and_headers(matches, headers=request_headers) except: data="";xbmcgui.Dialog().ok("Error","\nFallo al obtener la información de","\n"+matches) # SENDVID if "sendvid" in matches: video_mp4 = plugintools.find_single_match(data,'"og:video"[ ]content="([^"]+)') plugintools.log("dbsowo_play_sendvid="+video_mp4) # OPENLOAD if "openload" in matches: if 'We are sorry!' in data: matches = "" test = [] test = get_video_url(matches) #plugintools.log("dbsowo_play_openload="+test[0]) video_url = decodeOpenLoad(data) video_mp4 = matches plugintools.log("dbsowo_play_openload="+video_url) # DAILYMOTION http://www.dailymotion.com/embed/video/k6w8Ts2VTXFMs4gKJSP?autoPlay=1 if "dailymotion" in matches: video_id = matches.replace("http://www.dailymotion.com/embed/video/", "") video_id = video_id.replace("?autoPlay=1", "") video_mp4 = "plugin://plugin.video.dailymotion/?url="+video_id+"&mode=playVideo" plugintools.log("dbsowo_play_dailymotion="+video_mp4) #plugintools.log("video_mp4="+video_mp4) return video_mp4
def read_body_and_headers(url, post=None, headers=[], follow_redirects=True, timeout=None): plugintools.log("movie4k.read_body_and_headers url=" + url) # Spoof user agent ID headers.append([ "User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0" ]) expiration = datetime.datetime.now() + datetime.timedelta(days=365) expiration_gmt = expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") # The functionality "only movies in english" of the site is broken on the # movie's "Latest updates" page (no titles are displayed). If the option # "only_english" is enabled inthe addon preferences, the titles in other # languages are filtered out in the movies_updates() function. if plugintools.get_setting("only_english") == "true" and not url.endswith( '/movies-updates.html'): plugintools.log("movie4k.read_body_and_headers only english") headers.append([ "Cookie", "onlylanguage=en; expires=" + expiration_gmt + "; xxx2=ok; expires=" + expiration_gmt + ";" ]) else: #TODO WHY else and not if get_settings(xxx == enabled)??? headers.append(["Cookie", "xxx2=ok; expires=" + expiration_gmt + ";"]) body, response_headers = "", "" try: body, response_headers = plugintools.read_body_and_headers( url, post, headers, follow_redirects, timeout) plugintools.log("movie4k.read_body_and_headers response_headers: " + str(response_headers)) except: plugintools.set_setting('clear_cache', 'true') import traceback plugintools.log("movie4k.read_body_and_headers unexpected error: " + "".join(traceback.format_exception(*sys.exc_info()))) xbmc.sleep(3000) try: support_string = "For support, report this error on " + FORUM_URL body, response_headers = plugintools.read_body_and_headers( url, post, headers, follow_redirects, timeout) except urllib2.HTTPError as e: xbmcgui.Dialog().ok(MYNAME, "HTTP error for " + MAIN_URL, 'Reason: ' + str(e.code) + ' ' + str(e.reason), support_string) except urllib2.URLError as e: xbmcgui.Dialog().ok(MYNAME, "Connection failure for " + MAIN_URL, 'Reason: ' + str(e.reason), support_string) except: xbmcgui.Dialog().ok( MYNAME, "Unknown connection error: " + str(sys.exc_info()), support_string) return body, response_headers
def tvshows_scraper(): """ Scrapes the tv shows from netflix that are available in the Spain :return: Number of scrapped Tv shows. """ # Scrapper TvShows headers = [] headers.append(["referer", "http://unogs.com/video/"]) source, headers2 = plugintools.read_body_and_headers( url= "http://unogs.com/cgi-bin/nf.cgi?u=saruciope1a5l7snqcnhnt1085&q=-!1900,2016-!0,5-!0,10-!0,10-!Any-!Series-!Any-!Any-!I%20Don&t=ns&cl=270&st=adv&ob=Relevance&p=1&l=10000&inc=&ao=and", headers=headers) tvshows = json.loads(source)["ITEMS"] # Create dialog heading = 'Update library [TvShows] ...' p_dialog = dialog_progress_bg('NetflixGrab', heading) p_dialog.update(0, '') t = float(100) / len(tvshows) i = 0 plugintools.log("Total TvShows Items:" + str(len(tvshows))) for tv_show in tvshows: # Get the name and id of the TV show. code = tv_show[0] name = parser.unescape(tv_show[1]).encode('utf-8').strip().replace( "?", "").replace(":", "").replace("/", "") # Update dialog. p_dialog.update(int(math.ceil((i + 1) * t)), heading, name + "[Id:" + str(code) + "]") plugintools.log("Tv_show_ID:" + str(code) + " Name:" + name) source, headers2 = plugintools.read_body_and_headers( url= "http://unogs.com/cgi-bin/nf.cgi?u=saruciope1a5l7snqcnhnt1085&t=episodes&q=" + code, headers=headers) seasons = json.loads(source)["RESULTS"] if not os.path.exists(dir_path_tv_shows + name + "/"): os.mkdir(dir_path_tv_shows + name + "/") for season in seasons: episodes = season['episodes'] for episode in episodes: num_temp = str(episode['episode'][1]) num_episode = str(episode['episode'][2]) episode_code = str(episode['episode'][0]) with open( dir_path_tv_shows + name + "/" + num_temp + "x" + num_episode + ".strm", "w") as f: f.write("plugin://plugin.video.netflixandroid/?code=" + str(episode_code)) i = i + 1 return i
def streamcloud(params): plugintools.log("[PalcoTV-0.3.0].streamcloud " + repr(params)) url = params.get("url") request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) plugintools.log("data= "+body) # Barra de progreso para la espera de 10 segundos progreso = xbmcgui.DialogProgress() progreso.create("PalcoTV", "Abriendo Streamcloud..." , url ) i = 13000 j = 0 percent = 0 while j <= 13000 : percent = ((j + ( 13000 / 10.0 )) / i)*100 xbmc.sleep(i/10) # 10% = 1,3 segundos j = j + ( 13000 / 10.0 ) msg = "Espera unos segundos, por favor... " percent = int(round(percent)) print percent progreso.update(percent, "" , msg, "") progreso.close() media_url = plugintools.find_single_match(body , 'file\: "([^"]+)"') if media_url == "": op = plugintools.find_single_match(body,'<input type="hidden" name="op" value="([^"]+)"') usr_login = "" id = plugintools.find_single_match(body,'<input type="hidden" name="id" value="([^"]+)"') fname = plugintools.find_single_match(body,'<input type="hidden" name="fname" value="([^"]+)"') referer = plugintools.find_single_match(body,'<input type="hidden" name="referer" value="([^"]*)"') hashstring = plugintools.find_single_match(body,'<input type="hidden" name="hash" value="([^"]*)"') imhuman = plugintools.find_single_match(body,'<input type="submit" name="imhuman".*?value="([^"]+)">').replace(" ","+") post = "op="+op+"&usr_login="******"&id="+id+"&fname="+fname+"&referer="+referer+"&hash="+hashstring+"&imhuman="+imhuman request_headers.append(["Referer",url]) body,response_headers = plugintools.read_body_and_headers(url, post=post, headers=request_headers) plugintools.log("data= "+body) # Extrae la URL media_url = plugintools.find_single_match( body , 'file\: "([^"]+)"' ) plugintools.log("media_url= "+media_url) plugintools.play_resolved_url(media_url) if 'id="justanotice"' in body: plugintools.log("[streamcloud.py] data="+body) plugintools.log("[streamcloud.py] Ha saltado el detector de adblock") return -1
def streamcloud(params): plugintools.log("[Movies-Online 0.0.1].streamcloud " + repr(params)) url = params.get("url") request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) plugintools.log("data= "+body) # Barra de progreso para la espera de 10 segundos progreso = xbmcgui.DialogProgress() progreso.create("Movies-Online", "Abriendo Streamcloud..." , url ) i = 13000 j = 0 percent = 0 while j <= 13000 : percent = ((j + ( 13000 / 10.0 )) / i)*100 xbmc.sleep(i/10) # 10% = 1,3 segundos j = j + ( 13000 / 10.0 ) msg = "Espera unos segundos, por favor... " percent = int(round(percent)) print percent progreso.update(percent, "" , msg, "") progreso.close() media_url = plugintools.find_single_match(body , 'file\: "([^"]+)"') if media_url == "": op = plugintools.find_single_match(body,'<input type="hidden" name="op" value="([^"]+)"') usr_login = "" id = plugintools.find_single_match(body,'<input type="hidden" name="id" value="([^"]+)"') fname = plugintools.find_single_match(body,'<input type="hidden" name="fname" value="([^"]+)"') referer = plugintools.find_single_match(body,'<input type="hidden" name="referer" value="([^"]*)"') hashstring = plugintools.find_single_match(body,'<input type="hidden" name="hash" value="([^"]*)"') imhuman = plugintools.find_single_match(body,'<input type="submit" name="imhuman".*?value="([^"]+)">').replace(" ","+") post = "op="+op+"&usr_login="******"&id="+id+"&fname="+fname+"&referer="+referer+"&hash="+hashstring+"&imhuman="+imhuman request_headers.append(["Referer",url]) body,response_headers = plugintools.read_body_and_headers(url, post=post, headers=request_headers) plugintools.log("data= "+body) # Extrae la URL media_url = plugintools.find_single_match( body , 'file\: "([^"]+)"' ) plugintools.log("media_url= "+media_url) plugintools.play_resolved_url(media_url) if 'id="justanotice"' in body: plugintools.log("[streamcloud.py] data="+body) plugintools.log("[streamcloud.py] Ha saltado el detector de adblock") return -1
def dbsuper_playlists_dbsch(params): plugintools.log("dbsuper_playlists_dbsch") T_DBSUPER = 50005 #line1 = "Tenga paciencia puede durar varios segundos." line1 = plugintools.get_localized_string(T_DBSUPER) time = 5000 #in miliseconds xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (__addonname__, line1, time, __icon__)) request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) url = params.get("url") plugintools.log(url) try: data, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) except: data = "" xbmcgui.Dialog().ok("Error", "\nFallo al obtener la información de", "\n" + url) matches = plugintools.find_multiple_matches( data, '<!--INICIA LINK-->(.*?)<!--TERMINA LINK-->') for entry in matches: #plugintools.log("data="+entry) url2 = plugintools.find_single_match(entry, 'href="(.*?)"') #thumbnail = "http://cm1.narvii.com/6545/9c98445673df95e56b6430d8c563a7a2a7a62524_120.jpg" title = plugintools.find_single_match(entry, 'target="_blank">(.*?)<') title = replace_html(title) #plugintools.log("url="+url2) #plugintools.log("title="+title) data2, response_headers = plugintools.read_body_and_headers( url2, headers=request_headers) data2 = plugintools.find_single_match( data2, "<div class='cover'>(.*?)<div class='postbot'>") thumbnail = plugintools.find_single_match(data2, 'src="(.*?)"') plugintools.add_item(action="dbsowo_subplay", title=title, thumbnail=thumbnail, url=url2, isPlayable=False, folder=True)
def get_json_response(service,parameters): plugintools.log("ruyaiptv.api.get_json_response service="+service+", parameters="+repr(parameters)) base_url = get_base_url() # Adds session token s = plugintools.get_setting("token") parameters["s"] = s # Adds origin server o = plugintools.get_setting("server") parameters["o"] = o # Service call service_url = urlparse.urljoin(base_url,service) plugintools.log("ruyaiptv.api.get_json_response service_url="+service_url) service_parameters = urllib.urlencode(parameters) plugintools.log("ruyaiptv.api.get_json_response parameters="+service_parameters) try: body , response_headers = plugintools.read_body_and_headers( service_url , post=service_parameters ) except: import traceback plugintools.log("ruyaiptv.api.get_json_response "+traceback.format_exc()) json_response = jsontools.load_json(body) return json_response
def play_peliculas_playlists(params): plugintools.log("ohpelis_play_peliculas_series_playlists") request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) url_main = params.get("url") try: data, response_headers = plugintools.read_body_and_headers( url_main, headers=request_headers) except: xbmcgui.Dialog().ok("Error", "\nFallo al obtener la información de", "\n" + data) data = "" xbmcgui.Dialog().ok("Error", "\nFallo al obtener la información de", "\n" + url_main) return pass #plugintools.log("data="+data) url = plugintools.find_single_match(data, 'rptss" src="(.*?)" frameborder') plugintools.log("url=" + url) #plugintools.log(test_video_exists(url)) uurl = "plugin://plugin.video.alfa/?" + url xbmc.executebuiltin("xbmc.PlayMedia(" + uurl + ")")
def themoviedb(title, datamovie): plugintools.log("The Movie Database: "+title) try: url = 'https://www.themoviedb.org/search?query='+title plugintools.log("URL= "+url) referer = 'https://www.themoviedb.org/' data = gethttp_referer_headers(url,referer) matches = plugintools.find_single_match(data, '<ul class="search_results movie">(.*?)</ul>') title_film = plugintools.find_single_match(matches, 'title="([^"]+)') plugintools.log("title_film= "+title_film) url_film = plugintools.find_single_match(matches, '<a href="([^"]+)') url_film_fixed = url_film.split("-") if len(url_film_fixed) >= 2: url_film_fixed = url_film[0] else: url_film_fixed = url_film url_film = 'https://www.themoviedb.org'+url_film+'?language=es' url_film = url_film.strip() plugintools.log("url_film= "+url_film) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer", referer]) body,response_headers = plugintools.read_body_and_headers(url_film, headers=request_headers) plugintools.log("body= "+body) backdrop = plugintools.find_single_match(body, '<meta name="twitter:image" content="([^"]+)') datamovie["Fanart"]=backdrop plugintools.log("backdrop= "+backdrop) except: pass
def shsp7(params): url = params.get("url") url=url.replace("/ch/","/update/").replace("php","html"); ref="http://showsport-tv.com/" thumb = params.get("thumbnail") title = params.get("title") request_headers=[] request_headers.append(["User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) request_headers.append(["Referer",ref]) bodyy,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) if bodyy.find("googlecode"): print "GOING XUSCACAMUSCA" p = re.compile(ur'id="([^"]+).*?src="([^"]+)', re.DOTALL) elif bodyy.find("iguide"): p = re.compile(ur'var\s?id\s?=\s?([^;]+).*?src="?\'?([^\'"]+)', re.DOTALL) print "GOING IGUIDE" else: print "UNKNOWN" pars=re.findall(p,bodyy);ref=url;res=''; for id,script in pars: if script.find("xuscacamusca"): ref=url url='http://xuscacamusca.se/gen_h.php?id='+id+'&width=100%&height=100%' peak2(params) elif script.find("iguide"): url=script+"1009&height=460&channel="+id+"&autoplay=true" from nstream import iguide2 iguide2(url,ref,res) else: print "NO SCRIPT"
def pordede_serie(params): plugintools.log("[%s %s] Linker Pordede %s" % (addonName, addonVersion, repr(params))) url = params.get("url") logo = params.get("thumbnail") fondo = params.get("fanart") plugintools.add_item(action="", url="", title="[COLOR lightblue][B]Linker Pordede" + version + "[/B][COLOR lightblue]" + sc4 + "[I] *** By PalcoTV Team ***[/I]" + ec4, thumbnail=thumbnail, fanart=fanart, folder=False, isPlayable=False) headers = DEFAULT_HEADERS[:] body, response_headers = plugintools.read_body_and_headers(url, headers=headers) temporada = '<div class="checkSeason"[^>]+>([^<]+)<div class="right" onclick="controller.checkSeason(.*?)\s+</div></div>' itemtemporadas = re.compile(temporada, re.DOTALL).findall(body) for nombre_temporada, bloque_episodios in itemtemporadas: patron = '<span class="title defaultPopup" href="([^"]+)"><span class="number">([^<]+)</span>([^<]+)</span>(\s*</div>\s*<span[^>]*><span[^>]*>[^<]*</span><span[^>]*>[^<]*</span></span><div[^>]*><button[^>]*><span[^>]*>[^<]*</span><span[^>]*>[^<]*</span></button><div class="action([^"]*)" data-action="seen">)?' matches = re.compile(patron, re.DOTALL).findall(bloque_episodios) num_temp = nombre_temporada.replace("Temporada", "").replace("Extras", "Extras 0") plugintools.add_item(action="", url="", title=sc2 + "-- " + nombre_temporada + " --" + ec2, thumbnail=logo, fanart=fondo, folder=True, isPlayable=False) for item in matches: id_ajax = plugintools.find_single_match( item[0], '/links/viewepisode/id/([0-9]*)' ) #id necesario marcado como visto parametros_ajax = 'http://www.pordede.com/ajax/action|model=episode&id=' + id_ajax + '&action=seen&value=1|' + url #url y parametros para marcar como visto (params Extra) visto = plugintools.find_single_match( item[3], '</button><div class="([^"]+)"') if 'action active' in visto: title = item[2] titlefull = sc + num_temp + "x" + item[ 1] + " -- " + title + ec + sc5 + "[I] [Visto][/I]" + ec5 else: title = item[2] titlefull = sc + num_temp + "x" + item[1] + " -- " + title + ec url = web + item[0] plugintools.add_item(action="pordede_server", url=url, title=sc + titlefull + ec, thumbnail=logo, fanart=fondo, extra=parametros_ajax, folder=True, isPlayable=False)
def link_sopcast(url, title): plugintools.log("link_sopcast") request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) try: dataurl, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) plugintools.log("data=" + dataurl) dataurl = plugintools.find_single_match( dataurl, 'name="SopAddress" value="(.*?)" /><param') plugintools.log("data=" + dataurl) if dataurl != "": plot = "" thumbnail = "" dataurl = 'plugin://plugin.video.p2p-streams/?url=' + dataurl + '&mode=2&name=' dataurl = dataurl.strip() plugintools.add_item(action="play", title=title, plot=plot, url=dataurl, thumbnail=thumbnail, isPlayable=True, folder=False) except: dataurl = "" xbmcgui.Dialog().ok("Error", "\nFallo al obtener la información de", "\n" + url)
def pordede_checkvist(params): parametros_ajax = params.get("extra").split( '|' ) #Recibe los parametros necesarios para marcar como visto (split '|') url_post = parametros_ajax[0] print url_post post = parametros_ajax[1] #El post viene montado desde la funcion url = parametros_ajax[2] #print url_post,post,url headers = { "Host": "www.pordede.com", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0", "Referer": url } body, response_headers = plugintools.read_body_and_headers( url_post, post=post, headers=headers) #Enviando los parametros para marcar visto url = params.get("url") title = params.get("title") params["url"] = url params["title"] = title pordede_link(params)
def get_json_response(service, parameters): plugintools.log("ruyaiptv.api.get_json_response service=" + service + ", parameters=" + repr(parameters)) base_url = get_base_url() # Adds session token s = plugintools.get_setting("token") parameters["s"] = s # Adds origin server o = plugintools.get_setting("server") parameters["o"] = o # Service call service_url = urlparse.urljoin(base_url, service) plugintools.log("ruyaiptv.api.get_json_response service_url=" + service_url) service_parameters = urllib.urlencode(parameters) plugintools.log("ruyaiptv.api.get_json_response parameters=" + service_parameters) try: body, response_headers = plugintools.read_body_and_headers( service_url, post=service_parameters) except: import traceback plugintools.log("ruyaiptv.api.get_json_response " + traceback.format_exc()) json_response = jsontools.load_json(body) return json_response
def dbsuper(params): plugintools.log("dbsuper") request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) #url = params.get("url") url = params plugintools.log("dbsuper_url = " + url) try: data, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) except: data = "" xbmcgui.Dialog().ok("Error", "\nFallo al obtener la información de", "\n" + url) video_url = "" if "openload" in url: #plugintools.log("dbsuper_data = " + data) video_url = "https://oload.stream/embed/TApaOiDf8JY/3.mp4?mime=true" video_url = "https://1fjiw6c.oloadcdn.net/dl/l/izleOOPq6gPX6DD1/TApaOiDf8JY/3.mp4?mime=true" #https://1fjiw6c.oloadcdn.net/dl/l/KAiYPSPmYe4IpTL9/M9DPzGEnWAk/4.mp4?mime=true #plugintools.log("dbsowo_play_openload="+video_url) elif "ok" in url: video_url = "" elif "vidoza" in url: video_url = plugintools.find_single_match(data, 'file:"(.*?)"') else: video_url = "" return video_url
def allmyvideos(params): plugintools.log("[tvwin-0.1.0].allmyvideos " + repr(params)) url = params.get("url") url = url.split("/") url_fixed = "http://www.allmyvideos.net/" + "embed-" + url[3] + ".html" plugintools.log("url_fixed= " + url_fixed) request_headers = [] request_headers.append( [ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31", ] ) body, response_headers = plugintools.read_body_and_headers(url_fixed, headers=request_headers) plugintools.log("data= " + body) r = re.findall('"file" : "(.+?)"', body) for entry in r: plugintools.log("vamos= " + entry) if entry.endswith("mp4?v2"): url = entry + "&direct=false" params["url"] = url plugintools.log("url= " + url) plugintools.play_resolved_url(url) xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % ("TvWin", "Resolviendo enlace...", 3, art + "s.png"))
def gethttp_headers(url): plugintools.log("url= " + url) request_headers = [] request_headers.append(["User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0"]) body, response_headers = plugintools.read_body_and_headers(url, headers=request_headers) plugintools.log("body= " + body) return body
def gethttp_referer_headers(url,referer): plugintools.log("gethttp_referer_headers "+url) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer",referer]) data,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) return data
def gethttp_referer_headers(url,referer): request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer", referer]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) return body
def shsp4(params): url = params.get("url") thumb = params.get("thumbnail") request_headers = [] request_headers.append( ["User-Agent", "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) #print body import re p = re.compile(ur'<div class="match1"(.*?\s+.*?)\$\(\s"\#m\d"\s\)', re.DOTALL) a = re.findall(p, body) for match in a: #print "\nFFFFFF";print match; p = re.compile(ur'img\ssrc="([^"]+).*?div\sclass="name">([^<]+)', re.DOTALL) foldr = re.findall(p, match) for img, catg in foldr: #print "\n"+img;print "\n"+catg; thumb = "http://showsport-tv.com/" + img title = catg plugintools.add_item(action="shsp1", title=title, url=match, thumbnail=thumb, fanart=thumb, isPlayable=False, folder=True)
def gethttp_noref(url): plugintools.log("[PalcoTV-0.3.0.gethttp_noref] "+url) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) return body
def gethttp_referer_headers(url, referer, show): plugintools.log("beta.1-0.3.0.gethttp_referer_headers ") show = plugintools.get_setting( "series_id") # Obtenemos modo de vista del usuario para series TV if show is None: show = "tvshows" elif show == "1": show = "seasons" elif show == "2": show = "fanart" elif show == "3": show = "list" elif show == "4": show = "thumbnail" elif show == "5": show = "movies" elif show == "6": show = "tvshows" elif show == "7": show = "episodes" plugintools.log("show= " + show) plugintools.modo_vista(show) request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1" ]) request_headers.append(["Referer", referer]) body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) print response_headers return body
def states(params): plugintools.log("broadcastify.states "+repr(params)) itemlist = [] # Descarga la home body,response_headers = plugintools.read_body_and_headers(params.get("url")) # Search for states combo body2 = plugintools.find_single_match(body,'<form method="GET" action="/listen/"><select size="1" name="stid"(.*?)</selec') patron = '<option value="([^"]+)">([^<]+)</option>' matches = plugintools.find_multiple_matches(body2,patron) for code,title in matches: url="http://www.broadcastify.com/listen/stid/"+code plugintools.log("title=["+title+"], url=["+url+"]") plugintools.add_item( action="feeds", title=title , url=url , folder=True ) # Search for states urls without repeating #<a href="/listen/stid/689">Flevoland</a> patron = '<a href="/listen/stid/(\d+)">([^<]+)</a>' matches = plugintools.find_multiple_matches(body,patron) encontrados = set() for code,title in matches: if code not in encontrados: url="http://www.broadcastify.com/listen/stid/"+code plugintools.log("title=["+title+"], url=["+url+"]") plugintools.add_item( action="feeds", title=title , url=url , folder=True ) encontrados.add(code)
def vipracing0(params): #plugintools.log("cipq.webpage "+repr(params))#print list of pages (PLT,PTC) # Fetch video list from website feed request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36" ]) url = params.get("url") body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) #plugintools.log("data= "+body) thumb = "http://cs301412.vk.me/v301412640/5ab5/fJUqz4EDdTM.jpg" pattern1 = '"shortcut":"([^"]*)' match = plugintools.find_multiple_matches_multi(body, pattern1) match = sorted(list(set(match))) #match = sorted(match.items(), key=lambda x: x[1]) for opcions in match: title = "Vip Racing " + str(opcions.replace("opcion-", "")) title = title.capitalize() url = "http://vipracing.tv/channel/" + opcions #url = str(url.split()) url = ", ".join(url.split()) #plugintools.log("TITLE:"+url) plugintools.add_item(action="vipracing2", title=title, url=url, thumbnail=thumb, fanart=thumb, isPlayable=True, folder=False)
def link_plexus(url, title): plugintools.log("link_plexus") request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) try: dataurl, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) plugintools.log("data=" + dataurl) dataurl = plugintools.find_single_match(dataurl, 'loadPlayer[^"]+"([^"]+)"') plugintools.log("data=" + dataurl) if dataurl != "": plot = "" thumbnail = "" dataurl = 'plugin://program.plexus/?url=acestream://' + dataurl + '&mode=1&name=' dataurl = dataurl.strip() plugintools.log("data=" + dataurl) plugintools.add_item(action="play", title=title, plot=plot, url=dataurl, thumbnail=thumbnail, isPlayable=True, folder=False) except: dataurl = "" xbmcgui.Dialog().ok("Error", "\nFallo al obtener la información de", "\n" + url)
def playedto(params): plugintools.log("[PalcoTV-0.3.0].playedto " + repr(params)) url = params.get("url") url = url.split("/") url_fixed = "http://played.to/embed-" + url[3] + "-640x360.html" plugintools.log("url_fixed= " + url_fixed) request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) body, response_headers = plugintools.read_body_and_headers( url_fixed, headers=request_headers) plugintools.log("data= " + body) r = re.findall('file(.+?)\n', body) for entry in r: entry = entry.replace('",', "") entry = entry.replace('"', "") entry = entry.replace(': ', "") entry = entry.strip() plugintools.log("vamos= " + entry) if entry.endswith("flv"): plugintools.play_resolved_url(entry) xbmc.executebuiltin( "Notification(%s,%s,%i,%s)" % ('PalcoTV', "Resolviendo enlace...", 3, art + 'icon.png')) params["url"] = entry plugintools.log("URL= " + entry)
def gethttp_referer_headers(url,referer,show): plugintools.log("gethttp_referer_headers "+url) show = plugintools.get_setting("series_id") # Obtenemos modo de vista del usuario para series TV if show is None: show = "tvshows" elif show == "1": show = "seasons" elif show == "2": show = "fanart" elif show == "3": show = "list" elif show == "4": show = "thumbnail" elif show == "5": show = "movies" elif show == "6": show = "tvshows" elif show == "7": show = "episodes" plugintools.log("show= "+show) plugintools.modo_vista(show) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1"]) request_headers.append(["Referer", referer]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers);print response_headers return body
def frame_parserl(params): url = params.get("url") print "START="+params.get("url") if params.get("title")=="[COLOR=red]Pon[COLOR=yellow]Tu[COLOR=red]Canal[/COLOR][/COLOR][/COLOR]" : pattern1 = 'popUp\(\'([^\']+).*src="([^"]+)' pattern2 = "http://canalesgratis.me/canales/"#http://canalesgratis.me/canales/ant3op2.php pattern3 = ".php" else :#PonLaTele pattern1 = 'popUp\(\'([^\']+).*src="([^"]+)' pattern2 = "http://verdirectotv.com/canales/" pattern3 = ".html" request_headers=[] request_headers.append(["User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) data=body ref = url matches = find_multiple_matches_multi(data,pattern1) i=0 for scrapedurl, scrapedthumbnail in matches: thumb = scrapedthumbnail url = urlparse.urljoin( params.get("url") , scrapedurl.strip() ) import string title = url.replace(pattern2,"").replace(pattern3,"").replace("-"," ");title = string.capwords(title) if i%2==0: p1 = title[0] p2 = "[COLOR=red]"+title[0]+"[/COLOR]" title = title.replace(p1,p2); else: p1 = title[0] p2 = "[COLOR=yellow]"+title[0]+"[/COLOR]" title = title.replace(p1,p2); i+=1 msg = "Resolviendo enlace ... " uri = url+'@'+title+'@'+ref plugintools.add_item( action="frame_parser2" , title=title , url=uri ,thumbnail=thumb ,fanart=thumb , isPlayable=True, folder=False )
def shsp3(params): url = params.get("url") thumb = params.get("thumbnail") request_headers = [] request_headers.append( ["User-Agent", "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) #os.environ["HTTP_PROXY"]=Proxy data = body #print "START="+params.get("url") import re p = re.compile(ur'(<a\sclass="mac".*?<\/div>)', re.DOTALL) matches = re.findall(p, data) #del matches[0] for match in matches: #url = scrapedurl.strip() #print match p = re.compile( ur'<img\ssrc=\'?"?([^\'"]+).*?<span\sclass="mactext">([^<]+).*?\s(<div.*?<\/div>)', re.DOTALL) links = re.findall(p, match) for imgs, titles, divs in links: title = titles.replace(" ", "") title = title.replace(" ", "|") #print divs plugintools.add_item(action="shsp2", title=title, url=divs, thumbnail=thumb, fanart=thumb, isPlayable=False, folder=True)
def gethttp_noref(url): plugintools.log("[movie.ultra.7k-0.3.0.gethttp_noref] "+url) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) return body
def playedto(params): plugintools.log("[Movies-Online 0.0.1].playedto " + repr(params)) url = params.get("url") url = url.split("/") url_fixed = "http://played.to/embed-" + url[3] + "-640x360.html" plugintools.log("url_fixed= "+url_fixed) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) body,response_headers = plugintools.read_body_and_headers(url_fixed, headers=request_headers) plugintools.log("data= "+body) r = re.findall('file(.+?)\n', body) for entry in r: entry = entry.replace('",', "") entry = entry.replace('"', "") entry = entry.replace(': ', "") entry = entry.strip() plugintools.log("vamos= "+entry) if entry.endswith("flv"): plugintools.play_resolved_url(entry) xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % ('Movies-Online', "Resolviendo enlace...", 3 , art+'icon.png')) params["url"]=entry plugintools.log("URL= "+entry)
def tumi(params): plugintools.log("[PalcoTV[0.3.0].Tumi " + repr(params)) data = plugintools.read(params.get("url")) if "Video is processing now" in data: xbmc.executebuiltin( "Notification(%s,%s,%i,%s)" % ('PalcoTV', "El archivo está en proceso", 3, art + 'icon.png')) else: # Vamos a buscar el ID de la página embebida matches = plugintools.find_multiple_matches(data, 'add_my_acc=(.*?)\"') for entry in matches: print 'match', entry # http://tumi.tv/embed-i9l4mr7jph1a.html url = 'http://tumi.tv/embed-' + entry + '.html' # Petición HTTP de esa URL request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) request_headers.append(["Referer", params.get("url")]) body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) plugintools.log("body= " + body) video_url = plugintools.find_single_match(body, 'file\: \"(.*?)\"') plugintools.log("video_url= " + video_url) plugintools.add_item(action="play", title="hola", url=video_url, folder=False, isPlayable=True) plugintools.play_resolved_url(video_url)
def shsp7(params): url = params.get("url") url = url.replace("/ch/", "/update/").replace("php", "html") ref = "http://showsport-tv.com/" thumb = params.get("thumbnail") title = params.get("title") request_headers = [] request_headers.append( ["User-Agent", "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) request_headers.append(["Referer", ref]) bodyy, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) if bodyy.find("googlecode"): print "GOING XUSCACAMUSCA" p = re.compile(ur'id="([^"]+).*?src="([^"]+)', re.DOTALL) elif bodyy.find("iguide"): p = re.compile(ur'var\s?id\s?=\s?([^;]+).*?src="?\'?([^\'"]+)', re.DOTALL) print "GOING IGUIDE" else: print "UNKNOWN" pars = re.findall(p, bodyy) ref = url res = '' for id, script in pars: if script.find("xuscacamusca"): ref = url url = 'http://xuscacamusca.se/gen_h.php?id=' + id + '&width=100%&height=100%' peak2(params) elif script.find("iguide"): url = script + "1009&height=460&channel=" + id + "&autoplay=true" from nstream import iguide2 iguide2(url, ref, res) else: print "NO SCRIPT"
def tumi(params): plugintools.log("[Movies-Online[0.0.1].Tumi "+repr(params)) data = plugintools.read(params.get("url")) if "Video is processing now" in data: xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % ('Movies-Online', "El archivo está en proceso", 3 , art+'icon.png')) else: # Vamos a buscar el ID de la página embebida matches = plugintools.find_multiple_matches(data, 'add_my_acc=(.*?)\"') for entry in matches: print 'match',entry # http://tumi.tv/embed-i9l4mr7jph1a.html url = 'http://tumi.tv/embed-' + entry + '.html' # Petición HTTP de esa URL request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer",params.get("url")]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) plugintools.log("body= "+body) video_url= plugintools.find_single_match(body, 'file\: \"(.*?)\"') plugintools.log("video_url= "+video_url) plugintools.add_item(action="play", title= "hola" , url = video_url , folder = False , isPlayable = True) plugintools.play_resolved_url(video_url)
def gethttp_headers(pageurl, referer): plugintools.log("pageUrl= " + pageurl) plugintools.log("referer= " + referer) request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) request_headers.append(["Referer", referer]) body, response_headers = plugintools.read_body_and_headers( pageurl, headers=request_headers) return body rtmp_server = matches[0] vaughnlive_user["rtmp"] = 'rtmp://' + rtmp_server + '/live?' body = body.replace(rtmp_server, "") body = body.replace("0m0", "") body = body.replace(";", "") decrypted = decrypt_vaughnlive(body) plugintools.log("decrypted= " + decrypted) rtmp_fixed = vaughnlive_user.get("rtmp") + decrypted vaughnlive_user["rtmp"] = rtmp_fixed play_vaughnlive(vaughnlive_user, params)
def allmyvideos(params): plugintools.log("[PalcoTV-0.3.0].allmyvideos " + repr(params)) url = params.get("url") url = url.split("/") url_fixed = 'http://www.allmyvideos.net/' + 'embed-' + url[3] + '.html' plugintools.log("url_fixed= " + url_fixed) request_headers = [] request_headers.append([ "User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31" ]) body, response_headers = plugintools.read_body_and_headers( url_fixed, headers=request_headers) plugintools.log("data= " + body) r = re.findall('"file" : "(.+?)"', body) for entry in r: plugintools.log("vamos= " + entry) if entry.endswith("mp4?v2"): url = entry params["url"] = url plugintools.log("url= " + url) plugintools.play_resolved_url(url) xbmc.executebuiltin( "Notification(%s,%s,%i,%s)" % ('PalcoTV', "Resolviendo enlace...", 3, art + 'icon.png'))
def gethttp_headers(pageurl): request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) body,response_headers = plugintools.read_body_and_headers(pageurl, headers=request_headers) plugintools.log("body= "+body) return body
def shsp5(params): url = params.get("url") thumb = params.get("thumbnail") request_headers = [] request_headers.append( ["User-Agent", "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) body, response_headers = plugintools.read_body_and_headers( url, headers=request_headers) #os.environ["HTTP_PROXY"]=Proxy data = body #print "START="+params.get("url") import re p = re.compile( ur'<a\sclass="menuitem\ssubmenuheader".*?>([^<]+)(.*?)<\/div>', re.DOTALL) matches = re.findall(p, data) #del matches[0] for match, links in matches: url = "http://showsport-tv.com/" + links plugintools.add_item(action="shsp6", title=match, url=url, thumbnail=thumb, fanart=thumb, isPlayable=False, folder=True)
def vipracing2(params): msg = "Resolviendo enlace ... " request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36"]) request_headers.append(["Referer","http://vipracing.tv"]) ref = 'http://vipracing.tv' url = params.get("url");ref=url body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) data = body.replace('window\.location\.replace\(ncr\)','') ''' array('freelivetv','byetv','9stream','castalba','castamp','direct2watch','kbps','flashstreaming','cast247','ilive','freebroadcast','flexstream','mips','veemi','yocast','yukons','ilive','iguide','ucaster','ezcast','maxstream','dinozap','janjua','tutelehd') ''' pattern = '<script type="text\/javascript" src="(.*direct2watch[^"]+)' uri = plugintools.find_single_match(body,pattern) pattern = 'embed\/([^\&]+).*?width=([^\&]+).*?height=([^\&]+)' match = plugintools.find_multiple_matches_multi(uri,pattern) for id,width,height in match: plugintools.log("ID= "+id) plugintools.log("WIDTH= "+width) plugintools.log("HEIGHT= "+height) data = plugintools.read(uri) p = 'src=\'?"?([^\'"]+)' uri = plugintools.find_single_match(data,p) plugintools.log("URI= "+uri) url=uri #print "URL = "+url;print "REF = "+ref; request_headers=[] request_headers.append(["User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) request_headers.append(["Referer",ref]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) #print "List : ", request_headers; bodi = body import ioncube vals=ioncube.ioncube1(bodi) #print tkserv+"\n"+strmr+"\n"+plpath+"\n"+swf#print valz;# print "URL = "+url;print "REF = "+ref; tkserv=vals[0][1];strmr=vals[1][1].replace("\/","/");plpath=vals[2][1].replace(".flv","");swf=vals[3][1]; ref=url;url=tkserv;bodyi=[];bodyy='';urli=[]; from plt import curl_frame bodi=curl_frame(url,ref,body,bodyi,bodyy,urli); p='token":"([^"]+)';token=plugintools.find_single_match(bodi,p);#print token media_url = strmr+'/'+plpath+' swfUrl='+swf+' token='+token+' live=1 timeout=15 swfVfy=1 pageUrl='+ref #media_url ='http://cpliga.nmp.hls.emision.dof6.com/hls/live/201767/channelpc2/index.m3u8' #media_url ='http://cpliga.nmp.hls.emision.dof6.com/hls/live/201767/channelpc2/20141028T074633-05-15185.ts' plugintools.play_resolved_url(media_url) print media_url '''
def seriesblanco1(params): plugintools.log('[%s %s] Linker SeriesBlanco %s' % (addonName, addonVersion, repr(params))) sinopsis = params.get("plot") datamovie = {} datamovie["Plot"]=sinopsis thumbnail = params.get("thumbnail") fanart = params.get("fanart") headers = {'Host':"seriesblanco.com","User-Agent": 'User-Agent=Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; es-ES; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12', "Referer": referer} url = params.get("url").replace('www.seriesblanco.com','seriesblanco.com') r = requests.get(url,headers=headers) data = r.content plugintools.add_item(action="",url="",title="[COLOR lightblue][B]Linker SeriesBlanco"+version+"[/B][COLOR lightblue]"+sc4+"[I] ***PLD.VisionTV***[/I]"+ec4,thumbnail=thumbnail,fanart=fanart,folder=False,isPlayable=False) #No hay peticion Ajax match_listacapis = plugintools.find_single_match(data,"<h2>Visionados Online</h2>(.*?)<h2>Descarga</h2>") #Si hay peticion Ajax if match_listacapis =="": # Buscando la url y datos del envio post a la peticion ajax ajax = plugintools.find_single_match(data,"function LoadGrid(.*?)success:") ajaxrequest = plugintools.find_single_match(ajax,"url : '(.*?)'.*?data : \"(.*?)\"") # Petición ajax url_ajax = scrapertools.cache_page(referer + ajaxrequest[0], ajaxrequest[1]) custom_post=ajaxrequest[1] body,response_headers = plugintools.read_body_and_headers(referer+ajaxrequest[0], post=custom_post) #plugintools.log("data= "+data) match_listacapis = plugintools.find_single_match(body,'<h2>Visionados Online</h2>(.*?)</table>') match_capi = plugintools.find_multiple_matches(match_listacapis,'<td><div class="grid_content sno">(.*?)<br>') for entry in match_capi: img = plugintools.find_single_match(entry,"src='/servidores([^']+)") url_img = 'http://www.seriesblanco.com/servidores'+img url_capi = plugintools.find_single_match(entry,'<a href="([^"]+)"') #url_capi = 'http://www.seriesblanco.com'+url_capi #Puede ser seriesblanco.tv o seriesblanco.com lang_audio = plugintools.find_single_match(entry,'<img src="http://seriesblanco.tv/banderas/([^"]+)"') if lang_audio =="": lang_audio = plugintools.find_single_match(entry,'<img src="http://seriesblanco.com/banderas/([^"]+)"') if lang_audio.find("es.png") >= 0: lang_audio = "ESP" elif lang_audio.find("la.png") >= 0: lang_audio = "LAT" elif lang_audio.find("vos.png") >= 0: lang_audio = "V.O.S." elif lang_audio.find("vo.png") >= 0: lang_audio = "V.O." url_server = plugintools.find_single_match(entry,"<img src='/servidores/([^']+)") url_server = url_server.replace(".png", "").replace(".jpg", "") quality = plugintools.find_single_match(entry,"<img src='/servidores/.*?alt=''>.*?</center></td><td class='tam12'>(.*?)</td>") #if quality == "": quality = "undefined" server = video_analyzer(url_server) titlefull = params.get("title")+sc2+'[I] ['+lang_audio+'] [/I]'+ec2+sc5+'[I] ['+server+'][/I] '+ec5+sc+'[I]'+quality+'[/I]'+ec if server != "": plugintools.addPeli(action="getlink_seriesblanco",title=titlefull,url=url_capi,info_labels=datamovie,thumbnail=url_img,fanart=fanart,folder=False,isPlayable=True)
def gethttp_referer_headers(url,referer): plugintools.modo_vista("tvshows");request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer", referer]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers); try: r='\'set-cookie\',\s\'([^;]+.)';jar=plugintools.find_single_match(str(response_headers),r);jar=getjad(jar); except: pass try: r='\'location\',\s\'([^\']+)';loc=plugintools.find_single_match(str(response_headers),r); except: pass if loc: request_headers.append(["Referer",url]); if jar: request_headers.append(["Cookie",jar]);#print jar body,response_headers=plugintools.read_body_and_headers(loc,headers=request_headers); try: r='\'set-cookie\',\s\'([^;]+.)';jar=plugintools.find_single_match(str(response_headers),r);jar=getjad(jar); except: pass plugintools.modo_vista("tvshows") return body
def curl_frame(url,ref,body,bodyi,bodyy,urli): request_headers=[]; request_headers.append(["User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) request_headers.append(["Referer",ref]) body,response_headers=plugintools.read_body_and_headers(url, headers=request_headers); print "HEADERS:\n";print response_headers urli+=([url]);bodyi+=([body]);#print bodyi;print urli; urli=list(set(urli));#bodyi=filter(len,list(set(bodyi)));
def login(server,username,password): plugintools.log("ruyaiptv.api login server="+server+", username="******", password="******"users/login.php") service_parameters = urllib.urlencode({'username':username,'password':password}) body , response_headers = plugintools.read_body_and_headers( service_url , post=service_parameters ) return body
def gethttp_referer_headers(url,referer): plugintools.log("gethttp_referer_headers "+url) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1"]) request_headers.append(["Referer", referer]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers);print response_headers return body
def gethttp_headers(params): url = params.get("url") request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer",'http://www.digitele.com/pluginfiles/canales/']) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) #plugintools.log("body= "+body) return body
def peaktv(params): #plugintools.get_localized_string(21) url = params.get("url") request_headers=[] request_headers.append(["User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers) #os.environ["HTTP_PROXY"]=Proxy data=body #print "START="+params.get("url") p = 'href="([^<]*)' matches = plugintools.find_multiple_matches_multi(data,p) del matches[0] for scrapedurl in matches: url = scrapedurl.strip() #print url title = plugintools.find_single_match(url,'>(.*?:[^:]+)') #title = title.replace("\xe2","a".encode('iso8859-16')); title = title.replace("\xe2","a"); title = title.replace("\xc3","t"); title = title.replace("\xe0","f"); title = title.replace("\xfc","u"); title = title.replace("\xdb","s"); title = title.replace("\x15f","s"); ''' #print title.decode("utf-8") print unicode(title,"iso8859-16") ''' canal = plugintools.find_single_match(url,'php\?([^"]+)') url = 'http://peaktv.me/Live.php/?'+canal.strip() if 'DigiSport1' in str(url): thumb='http://www.digisport.ro/img/sigla_digisport1.png' elif 'DigiSport2' in str(url): thumb='http://itutorial.ro/wp-content/uploads/digi_sport2.png' elif 'DigiSport3' in str(url): thumb='http://www.sport4u.tv/web/logo/sport/digi_sport3_ro.png' elif 'DolceSportHD' in str(url): thumb='http://static.dolcetv.ro/img/tv_sigle/sigle_black/116.png' elif 'DolceSport1' in str(url): thumb='http://static.dolcetv.ro/img/tv_sigle/sigle_black/101.png' elif 'DolceSport2' in str(url): thumb='http://static.dolcetv.ro/img/tv_sigle/sigle_black/107.png' elif 'DolceSport3' in str(url): thumb='http://static.dolcetv.ro/img/tv_sigle/sigle_black/134.png' elif 'DolceSport4' in str(url): thumb='http://static.dolcetv.ro/img/tv_sigle/sigle_black/247.png' elif 'EuroSport2HD' in str(url): thumb='http://www.sport4u.tv/web/logo/sport/eurosport-2.png' elif 'EuroSport1HD' in str(url): thumb='http://4.bp.blogspot.com/-k50Qb45ZHGY/UrMCA2zRoGI/AAAAAAAAStA/Dj6sF0dHcs8/s1600/790px-Eurosport_logo.svg.png' elif 'LookPlusHD' in str(url): thumb='http://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Look_Plus_HD.png/100px-Look_Plus_HD.png' elif 'LookTVHD' in str(url): thumb='http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Look_TV_HD_logo.png/100px-Look_TV_HD_logo.png' else: thumb='http://frocus.net/images/logotv/Sport-ro_HD.jpg' print thumb fanart = thumb plugintools.add_item( action="peaktv2" , title=title , url=url ,thumbnail=thumb ,fanart=fanart , isPlayable=True, folder=False )
def play(params): plugintools.log("broadcastify.play "+repr(params)) if params.get("url")!="": # Descarga la home body,response_headers = plugintools.read_body_and_headers(params.get("url")) plugintools.log("body="+body) location = plugintools.find_single_match(body,"<location>([^<]+)</location>") plugintools.play_resolved_url( location )
def gethttp_referer_headers(url,referer,show): plugintools.modo_vista(show) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer", referer]) request_headers.append(["X-Requested-With", "XMLHttpRequest"]) request_headers.append(["Cookie:","__utma=253162379.286456173.1418323503.1421078750.1422185754.16; __utmz=253162379.1421070671.14.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=http%3A%2F%2Fwww.seriesflv.net%2Fserie%2Fhora-de-aventuras.html; __cfduid=daeed6a2aacaffab2433869fd863162821419890996; __utmb=253162379.4.10.1422185754; __utmc=253162379; __utmt=1"]) body,response_headers = plugintools.read_body_and_headers(url, headers=request_headers);print response_headers return body
def gethttp_referer_headers(pageurl, referer): plugintools.log("[PLD.VisionTV-0.3.0].gethttp_headers "+pageurl) request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer",referer]) body,response_headers = plugintools.read_body_and_headers(pageurl, headers=request_headers) plugintools.log("body= "+body) return body
def gethttp_referer_headers(url_user): pageurl = url_user.get("pageurl") referer = url_user.get("referer") print 'referer',referer request_headers=[] request_headers.append(["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"]) request_headers.append(["Referer", referer]) body,response_headers = plugintools.read_body_and_headers(pageurl, headers=request_headers) plugintools.log("body= "+body) return body
def read_body_and_headers(url, post=None, headers=[], follow_redirects=False, timeout=None): plugintools.log("movie4k.read_body_and_headers url="+url) expiration = datetime.datetime.now() + datetime.timedelta(days=365) expiration_gmt = expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST") if plugintools.get_setting("only_english")=="true": plugintools.log("movie4k.read_body_and_headers only english") headers.append(["Cookie","onlylanguage=en; expires="+expiration_gmt+"; xxx2=ok; expires="+expiration_gmt+";"]) else: headers.append(["Cookie","xxx2=ok; expires="+expiration_gmt+";"]) try: body,response_headers = plugintools.read_body_and_headers(url,post,headers,follow_redirects,timeout) except: xbmc.sleep(3) body,response_headers = plugintools.read_body_and_headers(url,post,headers,follow_redirects,timeout) return body,response_headers
def curl_frame(url,ref,body,bodyi,bodyy,urli): request_headers=[]; request_headers.append(["User-Agent","Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"]) request_headers.append(["Referer",ref]) try: body,response_headers=plugintools.read_body_and_headers(url, headers=request_headers); bodyi+=([body]); except: #ACTIVATE LINE (print in try) to view headers and errors!!! pass