def BUILDMENU_BETA(): key = base64.b64encode(plugintools.get_setting("beta")) link = Common.OPEN_URL(BetaKeys).replace('\n', '').replace('\r', '') match = re.compile('passkey="(.+?)"').findall(link) for passkey in match: if key == passkey: link = Common.OPEN_URL(BetaWiz).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: Common.addDir(name, url, 90, ART + name + '.png', ART + name + '.png', description) else: link = Common.OPEN_URL(BetaVIP).replace('\n', '').replace('\r', '') match = re.compile('passkey="(.+?)"').findall(link) for passkey in match: if key == passkey: link = Common.OPEN_URL(BetaVIPWiz).replace('\n', '').replace( '\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: Common.addDir(name, url, 90, ART + name + '.png', ART + name + '.png', description) else: plugintools.message( AddonTitle, "Invalid Key: Check Details", "[COLOR yellow]https://www.facebook.com/groups/1735809796639007/" )
def ResolveUrl(url): link = False try: result = cloudflare.source(url) matches = re.compile( '<div id="embed_code".+?<iframe.+?src=["|\'](.*?)["|\'].+?<\/iframe><\/div>', re.I + re.M + re.U + re.S).findall(result) url = matches[0] if url.find('//') == 0: url = 'http:{0}'.format(url) if "divxpress" in url: html = common.OPEN_URL(url) matches = re.compile( 'input type="hidden" name="(.*?)" value="(.*?)"', re.I + re.M + re.U + re.S).findall(html) user_data = {} for match in matches: user_data[match[0]] = match[1] html = common.OPEN_URL(url, user_data=user_data) matches = re.compile( "<div id=\"player_code\"><script type='text/javascript'>(.*?)</script></div>", re.I + re.M + re.U + re.S).findall(html) unpack = jsunpack.unpack(matches[0]) matches = re.compile('"src"value="(.*?)"', re.I + re.M + re.U + re.S).findall(unpack) link = "{0}|User-Agent={1}&Referer={2}".format( matches[0], 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3', url) elif "vidzi" in url: html = common.OPEN_URL(url) matches = re.compile( "<script type='text/javascript'>(.*?)</script>", re.I + re.M + re.U + re.S).findall(html) unpack = jsunpack.unpack(matches[0]) matches = re.compile('file\s*:\s*"([^"]+)', re.I + re.M + re.U + re.S).findall(unpack) link = "{0}|Referer=http://vidzi.me/nplayer/jwplayer.flash.swf".format( matches[0]) elif "uptostream" in url: html = common.OPEN_URL(url) matches = re.compile("source src='(.+?)'").findall(html) link = "{0}".format(matches[-1]) matches = re.compile("subtitles' src='(.+?)'").findall(html) subtitles = matches[0] if len(matches) > 0 else '' link = "{0};;{1}".format('http:' + link, 'http:' + subtitles) else: if "movreel" in url: url = url.replace("/embed-", "/") elif "openload" in url: url = url.replace(".co", ".io") xbmc.log(str(url) + ">>>>>>>" * 40) item = urlresolver.HostedMediaFile(url) xbmc.log(str(item) + "?????????" * 40) link = urlresolver.resolve(item.get_url()) xbmc.log(str(link) + "<<<<" * 40) except Exception, e: print e
def ResolveUrl(url): link = False try: result = cloudflare.source(url) matches = re.compile( common.Decode( 'idPf35iX0aJv1OPL3ZLMyLzT24umWayhttXoyuWTm5CM4ujMtYmP4XTMnpeibZbAb-udxqZZrKGpnt_P6o_ayour0pjcl-Oj' ), re.I + re.M + re.U + re.S).findall(result) url = matches[0] if url.find('//') == 0: url = 'http:{0}'.format(url) if "divxpress" in url: html = common.OPEN_URL(url) matches = re.compile( 'input type="hidden" name="(.*?)" value="(.*?)"', re.I + re.M + re.U + re.S).findall(html) user_data = {} for match in matches: user_data[match[0]] = match[1] html = common.OPEN_URL(url, user_data=user_data) matches = re.compile( "<div id=\"player_code\"><script type='text/javascript'>(.*?)</script></div>", re.I + re.M + re.U + re.S).findall(html) unpack = jsunpack.unpack(matches[0]) matches = re.compile('"src"value="(.*?)"', re.I + re.M + re.U + re.S).findall(unpack) link = "{0}|User-Agent={1}&Referer={2}".format( matches[0], common.GetUA(), url) elif "vidzi" in url: html = common.OPEN_URL(url) matches = re.compile( "<script type='text/javascript'>(.*?)</script>", re.I + re.M + re.U + re.S).findall(html) unpack = jsunpack.unpack(matches[0]) matches = re.compile('file\s*:\s*"([^"]+)', re.I + re.M + re.U + re.S).findall(unpack) link = "{0}|Referer=http://vidzi.tv/nplayer/jwplayer.flash.swf".format( matches[0]) elif "uptostream" in url: html = common.OPEN_URL(url) matches = re.compile("source src='(.+?)'").findall(html) link = "{0}".format(matches[-1]) matches = re.compile("subtitles' src='(.+?)'").findall(html) subtitles = matches[0] if len(matches) > 0 else '' link = "{0};;{1}".format(link, subtitles) else: if "movreel" in url: url = url.replace("/embed-", "/") #elif "openload" in url: # url = url.replace(".co",".io") item = urlresolver.HostedMediaFile(url) link = urlresolver.resolve(item.get_url()) except Exception, e: print e
def PlayTrailer(url): result = common.OPEN_URL(url) matches = re.compile('"videoUrl":"(.+?)"', re.I + re.M + re.U + re.S).findall(result) if len(matches) > 0: url = matches[0] PlayWs(url)
def Restore_RD_TRAKT(): link=Common.OPEN_URL(BASEURL) plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(EXCLUDES_FOLDER,match+'_settings.xml')) if os.path.exists(EXCLUDEMOVE): if not os.path.exists(ADDONPATH): os.makedirs(ADDONPATH) if os.path.isfile(ADDONSETTINGS): os.remove(ADDONSETTINGS) os.rename(EXCLUDEMOVE, ADDONSETTINGS) try: os.remove(EXCLUDEMOVE) except: pass try: shutil.rmtree(EXCLUDEMOVE) shutil.rmdir(EXCLUDEMOVE) except: pass Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS()
def BUILDMENU_KRYPTON(): accept = 0 Krypton = 0 dialog = xbmcgui.Dialog() xbmc_version=xbmc.getInfoLabel("System.BuildVersion") version=float(xbmc_version[:4]) if version >= 17.0 and version <= 17.9: accept = 1 Krypton = 0 dialog = xbmcgui.Dialog() try: response = urllib2.urlopen(KryptonWiz) except: Krypton = 1 if accept == 1: if Krypton == 0: link = Common.OPEN_URL(KryptonWiz).replace('\n','').replace('\r','') match = re.compile('name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"').findall(link) for name,url,iconimage,fanart,description in match: Common.addDir(name,url,90,ART+name+'.png',ART+name+'.png',description) else: dialog.ok(AddonTitle,'Sorry we are unable to get the Krypton Build list at this time.','The Krypton host appears to be down.','[I][COLOR lightsteelblue]Plese try again later.[/COLOR][/I]') else: dialog.ok(AddonTitle, "Sorry we are unable to process your request","[COLOR red][I][B]Error: You are not running Kodi Krypton[/COLOR][/I][/B]","[I]Your are running: [COLOR lightsteelblue][B]Kodi " + codename + " Version:[COLOR cyan] %s" % version + "[/COLOR][/I][/B][/COLOR]")
def AUTO_READ_ZIP_TRAKT(url): dialog = xbmcgui.Dialog() _out = xbmc.translatePath(os.path.join('special://','home/tmp_trakt')) _in = url dp.create(AddonTitle,"Restoring File:",_in,'Please Wait...') unzip(_in, _out, dp) name = "[COLOR ghostwhite][B]RESTORE[/B][/COLOR]" link=Common.OPEN_URL(TRAKTURL) plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(_out,match+'_settings.xml')) if os.path.exists(EXCLUDEMOVE): if not os.path.exists(ADDONPATH): os.makedirs(ADDONPATH) if os.path.isfile(ADDONSETTINGS): os.remove(ADDONSETTINGS) os.rename(EXCLUDEMOVE, ADDONSETTINGS) try: os.remove(EXCLUDEMOVE) except: pass try: shutil.rmtree(_out) shutil.rmdir(_out) except: pass dialog = xbmcgui.Dialog() dialog.ok(AddonTitle,'Your Real Debrid & Trakt settings have been restored!','','')
def READ_ZIP_TRAKT(url): dialog = xbmcgui.Dialog() if dialog.yesno(AddonTitle,"[COLOR yellow]" + url + "[/COLOR]","Do you want to restore this backup?"): _out = xbmc.translatePath(os.path.join('special://','home/tmp')) _in = url dp.create(AddonTitle,"Restoring File:",_in,'Please Wait...') unzip(_in, _out, dp) name = "[COLOR ghostwhite][B]RESTORE[/B][/COLOR]" link=Common.OPEN_URL(TRAKTURL) plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(_out,match+'_settings.xml')) if os.path.exists(EXCLUDEMOVE): if not os.path.exists(ADDONPATH): os.makedirs(ADDONPATH) if os.path.isfile(ADDONSETTINGS): os.remove(ADDONSETTINGS) os.rename(EXCLUDEMOVE, ADDONSETTINGS) try: os.remove(EXCLUDEMOVE) except: pass name = "[COLOR ghostwhite][B]RESTORE[/B][/COLOR]" #add_download = Common.add_one_backups(name) dialog = xbmcgui.Dialog() dialog.ok(AddonTitle,'RD and Trakt Settings Successfully Restored','','') else: sys.exit(1)
def SHOWCOMMUNITYBUILDS(url): link = Common.OPEN_URL(url).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)"').findall(link) for name, url, iconimage, fanart in match: Common.addDir(name, url, 99, iconimage, fanart, " ")
def COMMUNITY(): link = Common.OPEN_URL(Community_List).replace('\n','').replace('\r','') match = re.compile('name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)"').findall(link) for name,url,iconimage,fanart in match: Common.addDir("[COLOR cyan]" + name + " [/COLOR]",url,93,iconimage,fanart,'') Common.addItem('[COLOR white]HOW TO ADD YOUR BUILDS TO THE LIST![/COLOR]',BASEURL,17,ICON,FANART,'')
def getImageLink(name): #needs to add an year to api call url = 'http://www.omdbapi.com/?t={0}&y=&r=json'.format(name) try: js = json.loads(common.OPEN_URL(url)) return js["Poster"] except: pass return ''
def GetEpisodes(url, iconimage, description): result = common.OPEN_URL(url) matches = re.compile( 'onclick=\"get_episode\(\'(.*?)\',\'(.*?)\'\);\">(.*?)<', re.I + re.M + re.U + re.S).findall(result) url = url.replace('get_episodes', 'get_episode') for episode in matches: addDir(name + ' ' + episode[2], url + '&episodeid=' + episode[1], 4, iconimage, True, description)
def IndexPage(url): if not 'page' in url: if 'search_movies' in url: url = url + '&page=/0' else: url = url + '/page/0' current_page = int(url.split('/')[-1]) result = common.OPEN_URL(url) block = re.compile('pnation.*?</strong>(.*?)<\/div>', re.I + re.M + re.U + re.S).findall(result) pages = "" if len(block) == 0 else re.compile( '<a href=".*?[\/&]page[=]?\/(.*?)">(.*?)</a>', re.I + re.M + re.U + re.S).findall(block[0]) nextPagesCount = len(pages) step = 10000 if nextPagesCount == 0 else int(pages[0][0]) - current_page last_page = current_page if nextPagesCount == 0 else int(pages[-1][0]) for i in range(nextPagesCount - 1, -1, -1): if pages[i][1] == '': continue if int(pages[i][0]) > last_page: last_page = int(pages[i][0]) break for pageIndex in range(10): try: result = common.OPEN_URL(url) matches = re.compile( '<div class=\"mov\".*? <img src="(.*?)".*?<h3><a href="(.*?)">(.*?)<.*?<p class=\"ic_text\">(.*?)<\/p>', re.I + re.M + re.U + re.S).findall(result) for match in matches: addDir(match[2], '{0}{1}'.format(baseUrl, match[1]), 4, match[0], True, match[3]) except Exception as ex: print ex if current_page >= last_page: return True current_page += step url = url[:url.rfind('/') + 1] url += str(current_page) if current_page <= last_page: addDir('[COLOR blue]תוצאות נוספות[/COLOR]', url, 2, '') return True
def SPEEDTEST(): link = Common.OPEN_URL(SpeedTest).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: Common.addItem( '[COLOR cyan]' + name + " | " + description + '[/COLOR]', url, 15, ICON, ART + 'speedfanart.jpg', '')
def BUILDMENU(): link = Common.OPEN_URL(wizard_rel).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: Common.addDir( name + " [COLOR gold]Ver:[/COLOR] [COLOR lime]" + description + "[/COLOR]", url, 11, iconimage, fanart, description)
def ADVANCEDSETTINGS(): link = Common.OPEN_URL(AdvancedSettings).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: Common.addDir('[COLOR cyan]' + name + '[/COLOR]', url, 90, ICON, FANART, description)
def GetSeasons(series_num, iconimage, description): result = common.OPEN_URL('{0}/watchmovies/get_seasons/{1}'.format( baseUrl, series_num)) matches = re.compile('onclick=\"get_episodes\(\'(.*?)\'\);\">(.*?)<', re.I + re.M + re.U + re.S).findall(result) for season in matches: addDir( '{0} {1}'.format(name, season[1]), '{0}/watchmovies/get_episodes/{1}?seasonid={2}'.format( baseUrl, series_num, season[0]), 3, iconimage, True, description)
def LinksPage(url, iconimage, description): result = common.OPEN_URL(url) matches = re.compile( '<div style="width:540px;padding-top:5px;">(.+?)</div>', re.I + re.M + re.U + re.S).findall(result) if len(matches) == 1: description = matches[0] matches = re.compile( '<div class="alert submit-link-div".+?<iframe src="(.+?)".+?</iframe>', re.I + re.M + re.U + re.S).findall(result) if len(matches) == 1: addDir('[COLOR green]{0} - טריילר[/COLOR]'.format(name), matches[0], 8, iconimage, False, description) if not 'get_seasons' in result: matches = re.compile( '<li .+?id="wrapserv"><a href="(.+?)" target.*?src="\/img\/servers\/(.+?).png.+?<div class="span3".+?<b>איכות (.+?)<\/b>.+?<\/li>', re.I + re.M + re.U + re.S).findall(result) links = [] for match in matches: if "goodvideohost" in match[1]: continue elif "yify" in match[1]: yifyLinks = resolver.GetYifyLinks(match[0]) for link in yifyLinks: links.append((link["url"], match[1], link["quality"])) continue links.append(match) if len(links) < 1: addDir('[COLOR red] לא נמצאו מקורות ניגון [/COLOR]', '99', 99, '', False, description) return if len(links) > 1: links = SortByQuality(links) playingUrlsList = [] for link in links: playingUrlsList.append(link[0]) addDir('[COLOR red] בחר בניגון אוטומטי [/COLOR]', '99', 99, '', False, description) addDir('{0} - ניגון אוטומטי'.format(name), json.dumps(playingUrlsList), 7, iconimage, False, description) addDir( '[COLOR red] או בחר מקור לניגון, אם לא עובד נסה אחר [/COLOR]', '99', 99, '', False, description) for link in links: addDir("{0} - {1} - איכות {2}".format(name, link[1], link[2]), link[0], 5, iconimage, False, description) else: series_num = url.split('-')[-1] GetSeasons(series_num, iconimage, description)
def ADVANCEDSETTINGS(): link = Common.OPEN_URL(AdvancedSettings).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?ersion="(.+?)"' ).findall(link) if os.path.isfile(ADVANCED_SET_FILE): Common.addItem( '[COLOR white]Remove Current Advanced Settings Configuration[/COLOR]', BASEURL, 53, ART + 'asettings.png', FANART, '') for name, url, iconimage, fanart, description in match: Common.addItem(name, url, 54, ART + 'asettings.png', FANART, description)
def Check_RD_TRAKT(): if not os.path.exists(EXCLUDES_FOLDER): os.makedirs(EXCLUDES_FOLDER) link=Common.OPEN_URL(BASEURL) plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(EXCLUDES_FOLDER,match+'_settings.xml')) if os.path.exists(ADDONSETTINGS): os.rename(ADDONSETTINGS, EXCLUDEMOVE)
def CATEGORIES(): if KODIVERSION >= 18.0: WIZARDURL = "http://sergiogracas.com/emular/kodi/tema.txt" elif KODIVERSION >= 17.0: WIZARDURL = "http://sergiogracas.com/emular/kodi/tema.txt" elif KODIVERSION >= 16.0: WIZARDURL = "http://sergiogracas.com/emular/kodi/tema.txt" else: WIZARDURL = "http://sergiogracas.com/emular/kodi/tema.txt" link = common.OPEN_URL(WIZARDURL).replace('\n','').replace('\r','') match = re.compile('name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?escription="(.+?)"').findall(link) for name,url,iconimage,fanart,description in match: common.addDir(name,url,1,iconimage,fanart,description) setView('movies', 'MAIN')
def BACKUP_RD_TRAKT(): if not os.path.exists(USB): os.makedirs(USB) vq = _get_keyboard( heading="Enter a name for this backup" ) if ( not vq ): return False, 0 title = urllib.quote_plus(vq) backup_zip = xbmc.translatePath(os.path.join(USB,title+'RD_Trakt_Settings.zip')) if not os.path.exists(EXCLUDES_FOLDER): os.makedirs(EXCLUDES_FOLDER) link=Common.OPEN_URL(TRAKTURL) plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(EXCLUDES_FOLDER,match+'_settings.xml')) dialog = xbmcgui.Dialog() if os.path.exists(ADDONSETTINGS): copyfile(ADDONSETTINGS, EXCLUDEMOVE) exclude_dirs = [' '] exclude_files = [" "] message_header = "Creating full backup..." message_header2 = "Creating full backup..." message1 = "Archiving..." message2 = "" message3 = "Please Wait" ARCHIVE_CB(EXCLUDES_FOLDER, backup_zip, message_header2, message1, message2, message3, exclude_dirs, exclude_files) time.sleep(1) name = "[COLOR ghostwhite][B]BACKUP[/B][/COLOR]" #add_download = Common.add_one_backups(name) try: shutil.rmtree(EXCLUDEMOVE) shutil.rmdir(EXCLUDEMOVE) except: pass Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() Common.REMOVE_EMPTY_FOLDERS() dialog.ok("[COLOR green][B]SUCCESS![/B][/COLOR]", 'The backup was completed successfully!.',"Backup Location: ",'[COLOR=yellow]'+backup_zip+'[/COLOR]')
def CATEGORIES(): if KODIVERSION >= 18.0: WIZARDURL = "https://pastebin.com/raw/6vSmSwzM" if KODIVERSION >= 17.0: WIZARDURL = "https://pastebin.com/raw/F4YhyH6e" elif KODIVERSION >= 16.0: WIZARDURL = "https://pastebin.com/raw/TcuQpfrf" else: WIZARDURL = "https://pastebin.com/raw/kfCRu1GY" link = common.OPEN_URL(WIZARDURL).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?escription="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: common.addDir(name, url, 1, iconimage, fanart, description) setView('movies', 'MAIN')
def CATEGORIES(): if KODIVERSION <= 16.0: dialog.ok(AddonTitle,'Por favor, atualizar o seu sistema Kodi!','','') return else: if KODIVERSION >= 17.0: WIZARDURL = "https://pastebin.com/raw/kjKBV5AG" if KODIVERSION >= 18.0: dialog.ok(AddonTitle,'Nada para atualizar!','','') return else: link = common.OPEN_URL(WIZARDURL).replace('\n','').replace('\r','') match = re.compile('name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?escription="(.+?)"').findall(link) for name,url,iconimage,fanart,description in match: common.addDir(name,url,1,iconimage,fanart,description) setView('movies', 'MAIN')
def CheckAdFlyLink(url): if "adf.ly" not in url: return url retUrl = None try: html = common.OPEN_URL(url) ysmm = re.findall(r"var ysmm =.*\;?", html) if len(ysmm) > 0: ysmm = re.sub(r'var ysmm \= \'|\'\;', '', ysmm[0]) left = '' right = '' for c in [ysmm[i:i + 2] for i in range(0, len(ysmm), 2)]: left += c[0] right = c[1] + right retUrl = base64.b64decode(left.encode() + right.encode())[2:].decode() if re.search(r'go\.php\?u\=', retUrl): retUrl = base64.b64decode(re.sub(r'(.*?)u=', '', retUrl)).decode() except Exception as e: print str(e) return retUrl
def AUTO_BACKUP_RD_TRAKT(): TMP_TRAKT = xbmc.translatePath(os.path.join(HOME,'tmp_trakt')) if not os.path.exists(TMP_TRAKT): os.makedirs(TMP_TRAKT) backup_zip = xbmc.translatePath(os.path.join(TMP_TRAKT,'Restore_RD_Trakt_Settings.zip')) if not os.path.exists(EXCLUDES_FOLDER): os.makedirs(EXCLUDES_FOLDER) link=Common.OPEN_URL(TRAKTURL) plugins=re.compile('<plugin>(.+?)</plugin>').findall(link) for match in plugins: ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA,match)) ADDONSETTINGS = xbmc.translatePath(os.path.join(ADDONPATH,'settings.xml')) EXCLUDEMOVE = xbmc.translatePath(os.path.join(EXCLUDES_FOLDER,match+'_settings.xml')) dialog = xbmcgui.Dialog() if os.path.exists(ADDONSETTINGS): copyfile(ADDONSETTINGS, EXCLUDEMOVE) exclude_dirs = [' '] exclude_files = [" "] message_header = "Creating full backup..." message_header2 = "Creating full backup..." message1 = "Archiving..." message2 = "" message3 = "Please Wait" ARCHIVE_CB(EXCLUDES_FOLDER, backup_zip, message_header2, message1, message2, message3, exclude_dirs, exclude_files) time.sleep(1) name = "[COLOR ghostwhite][B]BACKUP[/B][/COLOR]" try: shutil.rmtree(EXCLUDES_FOLDER) shutil.rmdir(EXCLUDES_FOLDER) except: pass
def CATEGORIES(): if KODIVERSION <= 16.0: dialog.ok( AddonTitle, 'Sentimos muito, por favor, atualizar o seu sistema Kodi para a versao 17!', '', '') return else: if KODIVERSION >= 17.0: WIZARDURL = "http://sergiogracas.com/emular/kodi/tema.txt" if KODIVERSION >= 18.0: dialog.ok(AddonTitle, 'Nada para atualizar!', '', '') return else: link = common.OPEN_URL(WIZARDURL).replace('\n', '').replace('\r', '') match = re.compile( 'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?escription="(.+?)"' ).findall(link) for name, url, iconimage, fanart, description in match: common.addDir(name, url, 1, iconimage, fanart, description) setView('movies', 'MAIN')
def Playf4m(url, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = common.OPEN_URL( 'http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai' ) result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}%3F{1}%26hdcore%3D3.0.3".format(url[i:], ticket) else: url = url[i:] print url if name is not None: name = urllib.unquote_plus(name) from F4mProxy import f4mProxyHelper player = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) #player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True) player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True, iconimage=iconimage)
def ResolveUrl(url): link = False try: result = common.OPEN_URL(url) matches = re.compile( '<div id="embed_code".+?<iframe.+?src=["|\'](.*?)["|\'].+?<\/iframe><\/div>', re.I + re.M + re.U + re.S).findall(result) url = matches[0] if "filehoot" in url: url = url.replace("/embed-", "/") url = "{0}.html".format(url[:url.rfind('-')]) html = common.OPEN_URL(url) id = re.compile("http://filehoot.com/(.+?).html", re.I + re.M + re.U + re.S).findall(url) user_data = { 'op': 'download1', 'usr_login': '', 'id': id[0], 'fname': '', 'referer': '', 'method_free': 'Continue+to+watch+your+Video' } html = common.OPEN_URL(url, user_data=user_data) matches = re.compile('{file:["|\'](.+?)["|\']', re.I + re.M + re.U + re.S).findall(html) if len(matches) > 0: link = matches[0] elif "allmyvideos" in url: html = common.OPEN_URL(url) #print html matches = re.compile('["|\']file["|\'].+?:.+?["|\'](.+?)["|\']', re.I + re.M + re.U + re.S).findall(html) if len(matches) > 0: link = matches[0] elif "goodvideohost" in url: url = url.replace("/embed-", "/") html = common.OPEN_URL(url) url = re.compile('method="POST" action=\'(.+?)\'', re.I + re.M + re.U + re.S).findall(html)[0] op = re.compile('name="op" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] usr_login = re.compile('name="usr_login" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] id = re.compile('name="id" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] fname = re.compile('name="fname" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] referer = re.compile('name="referer" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] hash = re.compile('name="hash" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] imhuman = re.compile('name="imhuman" value="(.+?)"', re.I + re.M + re.U + re.S).findall(html)[0] #user_data = {'op':'download1','usr_login':'','id':id[0],'fname':'','referer':'','hash':hash[0],'imhuman':'Proceed+to+video'} user_data = { 'op': urllib.quote_plus(op), 'usr_login': urllib.quote_plus(usr_login), 'id': urllib.quote_plus(id), 'fname': urllib.quote_plus(fname), 'referer': urllib.quote_plus(referer), 'hash': urllib.quote_plus(hash), 'imhuman': urllib.quote_plus(imhuman) } html = common.OPEN_URL(url, user_data=user_data) matches = re.compile('{file:"(.+?)"', re.I + re.M + re.U + re.S).findall(html) if len(matches) > 0: link = matches[0] else: if "movreel" in url: url = url.replace("/embed-", "/") item = urlresolver.HostedMediaFile(url) link = urlresolver.resolve(item.get_url()) except: pass return link
def GetYifyLinks(url): sources = [] try: result = common.OPEN_URL(url) matches = re.compile( '<div id="embed_code".+?<iframe.+?src=["|\'](.*?)["|\'].+?<\/iframe><\/div>', re.I + re.M + re.U + re.S).findall(result) url = matches[0] html = common.OPEN_URL(url) links = re.compile('pic=([^&]+)').findall(html) for i in links: try: user_data = {'url': i, 'fv': '16'} html = common.OPEN_URL( "http://yify.tv/player/pk/pk/plugins/player_p2.php", user_data=user_data) result = json.loads(html) try: sources.append({ 'quality': '1080p', 'url': [ i['url'] for i in result if i['width'] == 1920 and 'google' in i['url'] ][0] }) except: pass try: sources.append({ 'quality': '720p', 'url': [ i['url'] for i in result if i['width'] == 1280 and 'google' in i['url'] ][0] }) except: pass try: sources.append({ 'quality': '1080p', 'url': [ i['url'] for i in result if i['width'] == 1920 and not 'google' in i['url'] and not 'mediafire' in i['url'] ][0] }) except: pass try: sources.append({ 'quality': '720p', 'url': [ i['url'] for i in result if i['width'] == 1280 and not 'google' in i['url'] and not 'mediafire' in i['url'] ][0] }) except: pass except: pass except Exception, e: print e