def WatchTrailer(url): html = net(userAgent).http_GET(url).content pattern = '<div id="trailers" style="margin-bottom:-15px"></div>\n.+?<script type="text/javascript" src="(.+?)">.+?</script>' r = re.findall(r''+pattern+'', html, re.I|re.M|re.DOTALL) for url in r: html = net(userAgent).http_GET(url).content pattern = '\"media\$player\"\:\[\{\"url\"\:\"(.+?)\&feat' r = re.findall(r''+pattern+'', html) try:trailer_url = r[0] except:sys.exit(0) xbmc.executebuiltin("PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=%s)" %(trailer_url)[str(trailer_url).rfind("v=")+2:] )
def AtoZ(url, imdb): res_name = [] res_letter = [] res_name.append('#1234') res_letter.append('#1234') for l in string.uppercase: res_name.append(l.title()) res_letter.append(l.title()) dialog = xbmcgui.Dialog() ret = dialog.select('Select The Letter', res_name) if 'TVA' in imdb: cat = 'show/' types = 'tvshow' mode = '13' if 'MVZ' in imdb: cat = 'movie/' types = 'movie' mode = '20' if ret == -1:MAIN() letter = res_letter[ret] if '#1234' in letter: pattern = 'a\shref=\"('+baseUrl+cat+'\d.+?)\" title' else: pattern = 'a\shref=\"('+baseUrl+cat+letter+'.+?)\" title' html = net(userAgent).http_GET(url).content r = re.findall(pattern, html, re.I|re.M) totalitems = len(r) for url in r: name = url.rpartition('/')[2].replace('-', ' ').title() addDir(mode, url, types, name, name, '', totalitems, imdb, None, '')
def ListHosts(url, name, imdb): originalName = name sources = [] html = BeautifulSoup(net(userAgent).http_GET(url).content).prettify soup = BeautifulSoup(str(html)) a = soup.findAll("span", {"class": "embed-out-link"}) pattern = 'http://adf.ly/\d+/(.+?)\"' r = re.findall(pattern, str(a), re.I) for url in r: if 'www' in url: url = 'http://'+url else: url = 'http://www.'+url hosted_media = urlresolver.HostedMediaFile(url=url, title=name) sources.append(hosted_media) sources = urlresolver.filter_source_list(sources) r = re.findall(r'url\'\: \'(.+?)\', \'host', str(sources)) totalitems = len(r) hoster = [] if 'DM' in imdb: for url in r: name = re.findall(r'\.(\w+)\.', url)[0].title() hoster.append(url) return (hoster) else: for url in r: name = re.findall(r'\.(\w+)\.', url)[0].title() addDir(100, url, None, originalName, name, '', totalitems, imdb+'HL', True, None)
def Genre(url, imdb): res_genre = [] res_url = [] html = OpenUrl(url) if 'TVG' in imdb:pattern = 'href=\"(http:\/\/www.movie-kingdom.com\/tv-tags\/\w+)\"\sstyle' elif 'MVG' in imdb:pattern = 'href=\"(http:\/\/www.movie-kingdom.com\/movie-tags\/\w+)\"\sstyle' r = re.findall(r''+pattern+'', html, re.I) for url in r: r = url.rpartition('/') name = r[2].title() res_genre.append(name) res_url.append(url) dialog = xbmcgui.Dialog() ret = dialog.select('Please Select Genre',res_genre) if ret == -1:MAIN() genreUrl = res_url[ret] html = BeautifulSoup(net(userAgent).http_GET(genreUrl).content).prettify soup = BeautifulSoup(str(html)) a = soup.findAll("div", {"class": "buttons"}) if 'TVG' in imdb:pattern = '\<\/div\>,\s\<div\sclass=\"buttons\"\>\n\<a\shref=\"(.+?)\".+?php\?src=(.+?)\&' elif 'MVG' in imdb:pattern = '\<\/div\>,\s\<div\sclass=\"buttons\"\>\n\<a\shref=\"(.+?)\".+?php\?src=(.+?)\&' r = re.findall(r''+pattern+'', str(a), re.I|re.M|re.DOTALL) totalitems = len(r) for url, img in r: name = url.rpartition('/') name = name[2].replace('-', ' ').title() if '.com/show/' in url: types = 'tvshow' mode = '13' elif '.com/movie/' in url: types = 'movie' mode = '20' addDir(mode, url, types, name, name, img, totalitems, imdb, None, None)
def setControls(self): heading = "[COLOR aqua]HackedTV Change Log Information[/COLOR]" self.win.getControl(self.CONTROL_LABEL).setLabel(heading) text = re.findall(r'<start>(.+?)<end>', net().http_GET(ChangeLogUrl).content, re.I | re.M | re.DOTALL)[0] self.win.getControl(self.CONTROL_TEXTBOX).setText(text)
def FindHosts(url, name): print url EpName = name sources = [] try: soup = BeautifulSoup(net().http_GET(url).content) except Exception, e: HTMLERROR(e)
def OpenUrl(url): try: html = net(user_agent=userAgent).http_GET(url).content #import HTMLParser #h = HTMLParser.HTMLParser() #html = h.unescape(html) return html#.encode('utf-8') except urllib2.URLError, e: xbmc.executebuiltin("XBMC.Notification([COLOR blue]Movie Kingdom Network Error[/COLOR],[COLOR blue]Failed To Connect To MovieKingdom.com Check Log For Details[/COLOR],7000,"+error_logo+")") xbmc.log('MOVIEKINGDOM NETWORK ERROR: '+str(e)) sys.exit(0)
def Index(url, types): if 'aHR0' in url: url = base64.b64decode(url) Referer = url else: Referer = '' try: headers = {} headers['Referer'] = Referer soup = BeautifulSoup(net().http_GET(url, headers = headers).content) r = re.findall('Tv-Release.Net .. We\'ll Be Back', str(soup), re.I) if r: e = 'TV- Release is Down For Maintenance'.title() HTMLERROR(e) except Exception, e: HTMLERROR(e)
def get(name, url): db = database.connect( db_dir ) cur = db.cursor() now = time.time() cur.execute('SELECT * FROM url_cache WHERE url = "%s"' %url) cached = cur.fetchone() if cached: db.close() return cached else: xbmc.log('No cached response. Requesting from internet') try: data = net().http_GET(url).content except:pass sql = 'INSERT OR REPLACE INTO url_cache (name, url) VALUES(?,?)' cur.execute(sql, (name, url)) db.commit() db.close() return name, url
def Search(url, imdb): if imdb == 'SRO': search = url.lower().strip().replace(' ', '-') html = BeautifulSoup(net(userAgent).http_GET('http://www.movie-kingdom.com/a-z-movies.php').content).prettify r = re.findall('\<a\shref=\"(\S+'+search+'\S+)\"\sti', str(html), re.I) html = BeautifulSoup(net(userAgent).http_GET('http://www.movie-kingdom.com/a-z-shows.php').content).prettify t = re.findall('href="(\S*'+search+'\S*)"', str(html), re.I) r = r+t totalitems = len(r) for url in r: name = url.rpartition('/') name = name[2].replace('-', ' ').strip().title() if '.com/show/' in url: addDir(13, url, 'tvshow', name, '[COLOR blue]TV:[/COLOR]'+name, '', totalitems, 'TVR',False, '') elif '.com/movie/' in url: addDir(20, url, 'movie', name, '[COLOR blue]MOVIE:[/COLOR]'+name, '', totalitems, 'MVR', False, '') elif imdb == 'SR': searchType = ['By Name', 'By Year', 'By Director', 'By Actor'] dialog = xbmcgui.Dialog() ret = dialog.select('Choose How To Search', searchType) if ret == -1:MAIN() searchtype = searchType[ret] if ret == 0: url = 'http://www.movie-kingdom.com/index.php?menu=search&query=' last_search = addon.load_data('search') if not last_search: last_search = '' search ='' keyboard = xbmc.Keyboard(search, '[B]SEARCH Movie-kingdom By Name[/B]'.title()) last_search = last_search.replace('-',' ') keyboard.setDefault(last_search) keyboard.doModal() if keyboard.isConfirmed(): search = keyboard.getText().replace(' ','-') addon.save_data('search', search) if search == None or len(search)<1:MAIN() html = BeautifulSoup(net(userAgent).http_GET('http://www.movie-kingdom.com/a-z-movies.php').content).prettify r = re.findall('\<a\shref=\"(\S+'+search+'\S+)\"\sti', str(html), re.I) html = BeautifulSoup(net(userAgent).http_GET('http://www.movie-kingdom.com/a-z-shows.php').content).prettify t = re.findall('href="(\S*'+search+'\S*)"', str(html), re.I) r = r+t if ret == 1: url = 'http://www.movie-kingdom.com/index.php?menu=search&year=' search = xbmcgui.Dialog().numeric(0, '[B]SEARCH By Year[/B]'.title()) if len(search)!= 4: dialog = xbmcgui.Dialog() dialog.ok("[B]SEARCH ERROR[/B]", "Search by year date MUST be four numbers long.","eg. 1998, 2011, 2013 only.","") Search('','SR') html = net(userAgent).http_GET(url+search).content pattern = '\"buttons\"\>.+?\<a\shref="(.+?)\"' r = re.findall(r''+pattern+'', html, re.I|re.DOTALL) if ret == 2: url = 'http://www.movie-kingdom.com/index.php?menu=search&director=' last_search = addon.load_data('search') if not last_search: last_search = '' search ='' keyboard = xbmc.Keyboard(search, '[B]SEARCH By director[/B]'.title()) last_search = last_search.replace('-',' ') keyboard.setDefault(last_search) keyboard.doModal() if keyboard.isConfirmed(): search = keyboard.getText().replace(' ','-') addon.save_data('search', search) if search == None or len(search)<1:MAIN() html = net(userAgent).http_GET(url+search).content pattern = '\"buttons\"\>.+?\<a\shref="(.+?)\"' r = re.findall(r''+pattern+'', html, re.I|re.DOTALL) if ret == 3: url = 'http://www.movie-kingdom.com/index.php?menu=search&star=' last_search = addon.load_data('search') if not last_search: last_search = '' search ='' keyboard = xbmc.Keyboard(search, '[B]SEARCH By Actor[/B]'.title()) last_search = last_search.replace('-',' ') keyboard.setDefault(last_search) keyboard.doModal() if keyboard.isConfirmed(): search = keyboard.getText().replace(' ','-') addon.save_data('search', search) if search == None or len(search)<1:MAIN() html = net(userAgent).http_GET(url+search).content pattern = '\"buttons\"\>.+?\<a\shref="(.+?)\"' r = re.findall(r''+pattern+'', html, re.I|re.DOTALL) totalitems = len(r) for url in r: name = url.rpartition('/') name = name[2].strip().replace('-', ' ').title() if '.com/show/' in url: addDir(13, url, 'tvshow', name, '[COLOR blue]TV:[/COLOR]'+name, '', totalitems, 'TVR',False, '') elif '.com/movie/' in url: addDir(20, url, 'movie', name, '[COLOR blue]MOVIE:[/COLOR]'+name, '', totalitems, 'MVR', False, '')
def setControls(self): heading = "[COLOR aqua]HackedTV Change Log Information[/COLOR]" self.win.getControl(self.CONTROL_LABEL).setLabel(heading) text = re.findall(r'<start>(.+?)<end>', net().http_GET(ChangeLogUrl).content, re.I|re.M|re.DOTALL)[0] self.win.getControl(self.CONTROL_TEXTBOX).setText(text)
import downloader import extract art = xbmc.translatePath(os.path.join(ADDON.getAddonInfo('path'), 'resources', 'art')) baseUrl = 'https://drive.google.com/folderview?id=0B7glCX3gJUKIMW5HQ1Y4bWxQY3c&usp=sharing' downloadUrl = 'https://docs.google.com/uc?export=download&id=' downloadPath = xbmc.translatePath(os.path.join('special://home/addons','packages')) SettingsPath = xbmc.translatePath(os.path.join('special://home/userdata','HackedTvSettings.xml')) f = open (SettingsPath,'r') HackedTvSettings = f.read() f.close() print HackedTvSettings html = net().http_GET(baseUrl).content r = re.findall(r'id=\"entry\-(.+?)\"\stabindex=\"\d\"\saria\-label=\"Name\:\s(.+?)\,', html, re.I|re.M|re.DOTALL) for Gid, name in r:#Gid = google file id if name == 'updateUrl.xml': TUUrl = re.findall(r'\<url\>(.+?)\<\/url\>', net().http_GET(downloadUrl+Gid).content, re.I)[0] UpdateUrl = re.findall(r'action="(.+?)"', net().http_GET(TUUrl).content, re.I)[0] UpdateName ='hackedtvupdater.zip' print '++++++++++++++++++'+UpdateUrl if name == 'hackedtvVersion.xml':NewVersionUrl=downloadUrl+Gid if name == 'changelog.txt':ChangeLogUrl=downloadUrl+Gid print ChangeLogUrl print NewVersionUrl print UpdateUrl
art = xbmc.translatePath( os.path.join(ADDON.getAddonInfo('path'), 'resources', 'art')) baseUrl = 'https://drive.google.com/folderview?id=0B7glCX3gJUKIMW5HQ1Y4bWxQY3c&usp=sharing' downloadUrl = 'https://docs.google.com/uc?export=download&id=' downloadPath = xbmc.translatePath( os.path.join('special://home/addons', 'packages')) SettingsPath = xbmc.translatePath( os.path.join('special://home/userdata', 'HackedTvSettings.xml')) f = open(SettingsPath, 'r') HackedTvSettings = f.read() f.close() print HackedTvSettings html = net().http_GET(baseUrl).content r = re.findall( r'id=\"entry\-(.+?)\"\stabindex=\"\d\"\saria\-label=\"Name\:\s(.+?)\,', html, re.I | re.M | re.DOTALL) for Gid, name in r: #Gid = google file id if name == 'updateUrl.xml': TUUrl = re.findall(r'\<url\>(.+?)\<\/url\>', net().http_GET(downloadUrl + Gid).content, re.I)[0] UpdateUrl = re.findall(r'action="(.+?)"', net().http_GET(TUUrl).content, re.I)[0] UpdateName = 'hackedtvupdater.zip' print '++++++++++++++++++' + UpdateUrl if name == 'hackedtvVersion.xml': NewVersionUrl = downloadUrl + Gid if name == 'changelog.txt': ChangeLogUrl = downloadUrl + Gid print ChangeLogUrl