def GetTitles(section, url, startPage='1', numOfPages='1'): # Get Movie Titles try: if int(startPage) > 1: pageUrl = urlparse.urljoin(url, 'page/%d' % int(startPage)) else: pageUrl = url html = response_html(pageUrl, '3') # html = cloudflare_mode(pageUrl) start = int(startPage) end = start + int(numOfPages) for page in range(start, end): if page != start: pageUrl = urlparse.urljoin(url, 'page/%s' % page) html = response_html(pageUrl, '3') # html = cloudflare_mode(pageUrl) match = client.parseDOM(html, 'div', attrs={'class': 'post'}) for item in match: movieUrl = client.parseDOM(item, 'a', ret='href')[0] name = client.parseDOM(item, 'a')[0] try: img = client.parseDOM(item, 'img', ret='src')[1] img = img.replace('.ru', '.to') except: img = ICON try: desc = client.parseDOM(item, 'div', attrs={'class': 'postContent'})[0] except: desc = 'N/A' # match = [(client.parseDOM(i, 'a', ret='href')[0], # client.parseDOM(i, 'a')[0], # client.parseDOM(i, 'img', ret='src')[1], # client.parseDOM(i, 'div', attrs={'class': 'postContent'})[0]) for i in match if i] # match = re.compile('postHeader.+?href="(.+?)".+?>(.+?)<.+?src=.+? src="(.+?).+?(Plot:.+?)</p>"', re.DOTALL).findall(html) # for movieUrl, name, img, desc in match: desc = Sinopsis(desc) name = '[B][COLORgold]{0}[/COLOR][/B]'.format(name.encode('utf-8')) mode = 'GetPack' if 'tv-packs' in url else 'GetLinks' addon.add_directory({'mode': mode, 'section': section, 'url': movieUrl, 'img': img, 'plot': desc}, {'title': name, 'plot': desc}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=FANART) if 'Older Entries' not in html: break # keep iterating until the last page is reached if 'Older Entries' in html: addon.add_directory({'mode': 'GetTitles', 'url': url, 'startPage': str(end), 'numOfPages': numOfPages}, {'title': control.lang(32010).encode('utf-8')}, img=IconPath + 'next_page.png', fanart=FANART) except BaseException: control.infoDialog( control.lang(32011).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'movies') control.directory(int(sys.argv[1])) view.setView('movies', {'skin.estuary': 55, 'skin.confluence': 500})
def GetPack(section, url, img, plot): # TV packs links try: html = response_html(url, '3') # html = cloudflare_mode(url) main = client.parseDOM(html, 'div', {'class': 'postContent'})[0] data = client.parseDOM(main, 'p') data = [i for i in data if 'nfo1.' in i] for i in data: title = client.parseDOM(i, 'strong')[0] title = clear_Title(title) title = '[B][COLORgold]{0}[/COLOR][/B]'.format(title.encode('utf-8')) frames = dom.parse_dom(i, 'a', req='href') frames = [i.attrs['href'] for i in frames if not 'uploadgig' in i.content.lower()] frames = [i for i in frames if 'nfo1.' in i] addon.add_directory({'mode': 'GetLinksPack', 'section': section, 'url': frames, 'img': img, 'plot': plot}, {'title': title, 'plot': plot}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=FANART) except BaseException: control.infoDialog( control.lang(32012).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def Categories(section): # categories sec = '/category/%s' % section html = response_html(BASE_URL, '96') # html = cloudflare_mode(BASE_URL) # xbmc.log('HTMLLLLL: %s' % html) match = client.parseDOM(html, 'li', attrs={'id': 'categories-2'})[0] items = zip(client.parseDOM(match, 'a'), client.parseDOM(match, 'a', ret='href')) items = [(i[0], i[1]) for i in items if sec in i[1]] img = IconPath + 'movies.png' if 'movies' in section else IconPath + 'tv_shows.png' if 'movie' in section: addon.add_directory({'mode': 'recom', 'url': BASE_URL}, {'title': control.lang(32038).encode('utf-8')}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=FANART) for title, link in items: title = '[B][COLORgold]{0}[/COLOR][/B]'.format(title.encode('utf-8')) link = client.replaceHTMLCodes(link) addon.add_directory({'mode': 'GetTitles', 'section': section, 'url': link, 'startPage': '1', 'numOfPages': '2'}, {'title': title}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def recommended_movies(url): try: # r = response_html(url, '8') r = cloudflare_mode(url) r = client.parseDOM(r, 'div', attrs={'class': 'textwidget'})[-1] items = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'img', ret='src')) for item in items: movieUrl = urljoin(BASE_URL, item[0]) if not item[0].startswith('http') else item[0] name = movieUrl.split('/')[-1] if not movieUrl.endswith('/') else movieUrl[:-1].split('/')[-1] name = re.sub(r'-|\.', ' ', name) if 'search' in movieUrl: query = name.split('?s=')[1] query = query.replace('.', '+') action = {'mode': 'search_bb', 'url': query} else: action = {'mode': 'GetLinks', 'section': section, 'url': movieUrl, 'img': item[1], 'plot': 'N/A'} name = six.ensure_str(name, 'utf-8') name = '[B][COLORgold]{0}[/COLOR][/B]'.format(name) addon.add_directory(action, {'title': name, 'plot': 'N/A'}, allfun, img=item[1], fanart=FANART) except BaseException: control.infoDialog( control.lang(32011).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'movies') control.directory(int(sys.argv[1])) view.setView('movies', {'skin.estuary': 55, 'skin.confluence': 500})
def menu(): addon.add_directory( { 'mode': 'scn_items', 'url': Baseurl + 'category/films/' }, {'title': '[B][COLOR yellow]Latest Movies[/COLOR][/B]'}, allfun, img=ART + 'movies.png', fanart=FANART) addon.add_directory({ 'mode': 'scn_items', 'url': Baseurl + 'category/tv/' }, {'title': '[B][COLOR yellow]Latest TV Shows[/COLOR][/B]'}, allfun, img=ART + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'scn_movies'}, {'title': '[B][COLOR gold]Movies[/COLOR][/B]'}, allfun, img=ART + 'movies.png', fanart=FANART) addon.add_directory({'mode': 'scn_series'}, {'title': '[B][COLOR gold]TV Shows[/COLOR][/B]'}, allfun, img=ART + 'tv_shows.png', fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def eztv_latest(url): html = client.request(eztv_base) posts = client.parseDOM(html, 'tr', attrs={'class': 'forum_header_border'}) for post in posts: infos = dom.parse_dom(post, 'a')[1] title = infos.attrs['title'].encode('utf-8') page_link = infos.attrs['href'] page_link = urljoin(eztv_base, page_link) if page_link.startswith('/') else page_link magnet = re.findall(r'href="(magnet:.+?)"', post, re.DOTALL)[0] addon.add_directory({'mode': 'open_page', 'url': page_link, 'img': img, 'plot': 'N/A'}, {'title': title}, allfun, img=img, fanart=FANART) try: np = dom.parse_dom(html, 'a', req='href') np = [i.attrs['href'] for i in np if 'next page' in i.content][0] np = urljoin(eztv_base, np) addon.add_directory({'mode': 'eztv_latest', 'url': np}, {'title': control.lang(32010).encode('utf-8')}, img=IconPath + 'eztv.png', fanart=FANART) except BaseException: pass control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def setviews(): try: control.idle() items = [ (control.lang(32017).encode('utf-8'), 'addons'), (control.lang(32018).encode('utf-8'), 'movies'), (control.lang(32019).encode('utf-8'), 'files') ] select = control.selectDialog([i[0] for i in items], 'SELECT') if select == -1: raise Exception() content = items[select][1] title = control.lang(32020).encode('utf-8') poster, banner, fanart = ICON, BANNER, FANART addon.add_directory({'mode': 'addView', 'content': content}, {'type': 'video', 'title': title, 'icon': poster, 'thumb': poster, 'poster': poster, 'banner': banner}, img=ICON, fanart=FANART) control.content(int(sys.argv[1]), content) control.directory(int(sys.argv[1])) view.setView(content, {}) except: quit()
def eztv_search(): url = 'https://eztv.io/search/?q1={}&q2=&search=Search' search_url = 'https://eztv.io/search/{}' keyboard = xbmc.Keyboard() keyboard.setHeading(control.lang(32002).encode('utf-8')) keyboard.doModal() if keyboard.isConfirmed(): _query = keyboard.getText() query = _query.encode('utf-8') query = quote_plus(query).replace('+', '-') # get_link = client.request(url.format(query), output='location') search_url = search_url.format(query) # xbmc.log('SEARCH-URL: {}'.format(search_url)) data = client.request(query) try: alts = client.parseDOM(data, 'tr', attrs={'class': 'forum_header_border'}) alts = [dom.parse_dom(str(i), 'a', req=['href', 'title'])[0] for i in alts if alts] # xbmc.log('SEARCH-ALTSL: {}'.format(alts)) for alt in alts: link, title = alt.attrs['href'], alt.attrs['title'] link = urljoin(eztv_base, link) if link.startswith('/') else link addon.add_directory({'mode': 'open_page', 'url': link, 'img': img, 'plot': 'N/A'}, {'title': title}, allfun, img=img, fanart=FANART) except IndexError: pass else: return control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def movies_menu(): # addon.add_directory({'mode': 'to_etos'}, # {'title': '[B][COLOR gold]' + Lang(32034).encode('utf-8') + '[/COLOR][/B]'}, # allfun, img=ICON, fanart=FANART) addon.add_directory( { 'mode': 'to_genre', 'url': Baseurl, 'section': 'movies' }, { 'title': '[B][COLOR gold]' + Lang(32035).encode('utf-8') + '[/COLOR][/B]' }, allfun, img=ART + 'movies.png', fanart=FANART) addon.add_directory( { 'mode': 'to_items', 'url': Baseurl + '/category/movies/' }, {'title': Lang(32000).encode('utf-8')}, allfun, img=ART + 'movies.png', fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def to_items(url): #34 data = client.request(url, headers=headers) posts = zip(client.parseDOM(data, 'div', attrs={'id': r'post-\d+'}), client.parseDOM(data, 'h2')) for post, name in posts: try: plot = client.parseDOM(post, 'div', attrs={'class': 'plot'})[0] except IndexError: plot = 'N/A' desc = client.replaceHTMLCodes(plot) desc = tools.clear_Title(desc) desc = desc.encode('utf-8') try: title = client.parseDOM(name, 'a')[0] except BaseException: title = client.parseDOM(name, 'img', ret='alt')[0] # try: # year = client.parseDOM(data, 'div', {'class': 'metadata'})[0] # year = client.parseDOM(year, 'span')[0] # year = '[COLOR lime]({0})[/COLOR]'.format(year) # except IndexError: # year = '(N/A)' title = tools.clear_Title(title) title = '[B][COLOR white]{}[/COLOR][/B]'.format(title).encode('utf-8') link = client.parseDOM(name, 'a', ret='href')[0] link = client.replaceHTMLCodes(link).encode('utf-8', 'ignore') poster = client.parseDOM(post, 'img', ret='src')[0] poster = client.replaceHTMLCodes(poster).encode('utf-8', 'ignore') # if '/tvshows/' in link: # addon.add_directory({'mode': 'to_seasons', 'url': link}, {'title': title, 'plot': str(desc)}, # allfun, img=poster, fanart=FANART) # else: addon.add_directory({ 'mode': 'to_links', 'url': link }, { 'title': title, 'plot': str(desc) }, allfun, img=poster, fanart=FANART) try: np = client.parseDOM(data, 'a', ret='href', attrs={'rel': 'next'})[0] # np = dom_parser.parse_dom(np, 'a', req='href') # np = [i.attrs['href'] for i in np if 'icon-chevron-right' in i.content][0] page = re.findall(r'page/(\d+)/', np)[0] title = control.lang(32010).encode('utf-8') + \ ' [COLORwhite]([COLORlime]{}[/COLOR])[/COLOR]'.format(page) addon.add_directory({ 'mode': 'to_items', 'url': np }, {'title': title}, img=ART + 'next_page.png', fanart=FANART) except BaseException: pass control.content(int(sys.argv[1]), 'movies') control.directory(int(sys.argv[1])) view.setView('movies', {'skin.estuary': 55, 'skin.confluence': 500})
def genre(section): sec = 'category/films' if 'mov' in section else 'category/tv' html = client.request(Baseurl, headers=headers) items = client.parseDOM(html, 'ul', attrs={'class': 'categories'})[0] # xbmc.log('SCNSRC-GENRE2: {}'.format(str(items))) pattern = r'''<a href=(.+?)>(.+?)</a> <a.+?</.+?\((.+?)\)''' items = re.findall(pattern, items, re.DOTALL) # xbmc.log('SCNSRC-GENRE2: {}'.format(str(items))) items = [(i[0], i[1], i[2]) for i in items if sec in i[0]] for i in items: if 'tv-pack' in i[0]: continue title = i[1] title = tools.clear_Title(title) title = '{} ([COLORyellow]{}[/COLOR])'.format(title, str( i[2])).encode('utf-8') url = i[0].split(' ')[0] addon.add_directory({ 'mode': 'scn_items', 'url': url }, { 'title': title, 'plot': title }, allfun, img=ICON, fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def genre(section): sec = 0 if 'mov' in section else 1 html = client.request(Baseurl, headers=headers) items = client.parseDOM(html, 'li', attrs={'class': 'category-list-item'})[sec] items = dom.parse_dom(items, 'a', req='href') for i in items: if 'tv-pack' in i[0]: continue title = i.content title = tools.clear_Title(title) title = '{}'.format(title).encode('utf-8') url = i.attrs['href'] addon.add_directory({ 'mode': 'ddl_items', 'url': url }, { 'title': title, 'plot': title }, allfun, img=ICON, fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def recommended_movies(url): try: r = response_html(url, '8') r = client.parseDOM(r, 'li', attrs={'id': 'text-7'})[0] items = zip(client.parseDOM(r, 'a', ret='href'), client.parseDOM(r, 'img', ret='src')) for item in items: movieUrl = urlparse.urljoin(BASE_URL, item[0]) if not item[0].startswith('http') else item[0] name = movieUrl.split('/')[-1] if not movieUrl.endswith('/') else movieUrl[:-1].split('/')[-1] name = re.sub('-|\.', ' ', name) if 'search' in movieUrl: query = name.replace('.', '+') action = {'mode': 'search_bb', 'url': query} else: action = {'mode': 'GetLinks', 'section': section, 'url': movieUrl, 'img': item[1], 'plot': 'N/A'} name = '[B][COLORgold]{0}[/COLOR][/B]'.format(name.encode('utf-8')) addon.add_directory(action, {'title': name, 'plot': 'N/A'}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=item[1], fanart=FANART) except BaseException: control.infoDialog( control.lang(32011).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'movies') control.directory(int(sys.argv[1])) view.setView('movies', {'skin.estuary': 55, 'skin.confluence': 500, 'skin.xonfluence': 500})
def eztv_menu(): addon.add_directory({'mode': 'eztv_latest'}, {'title': 'Latest Releases'}, allfun, img=IconPath + 'eztv.png', fanart=FANART) addon.add_directory({'mode': 'eztv_calendar', 'url': urljoin(eztv_base, '/calendar')}, {'title': 'Calendar'}, allfun, img=IconPath + 'eztv.png', fanart=FANART) addon.add_directory({'mode': 'eztv_search'}, {'title': 'Search'}, allfun, img=IconPath + 'eztv.png', fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def GetLinksPack(section, url, img, plot): try: urls = eval(url) frames = [] for u in urls: html = response_html(u, '72') # html = cloudflare_mode(u) data = client.parseDOM(html, 'ol')[0] frames += client.parseDOM(data, 'div') try: check = re.findall('.(S\d+E\d+).', data, re.I)[0] if check: check = True hdlr = re.compile(r'.(S\d+E\d+).', re.I) else: check = re.findall(r'\.(\d+)\.', data, re.DOTALL)[0] if check: check = True hdlr = re.compile(r'\.(\d+)\.') except IndexError: check = False if check: frames = sorted(frames, key=lambda x: hdlr.search(x).group(1)) else: frames = frames for frame in frames: title = frame.split('/')[-1] host = GetDomain(frame) host = '[B][COLORcyan]{0}[/COLOR][/B]'.format(host.encode('utf-8')) title = '{0}-[B][COLORgold]{1}[/COLOR][/B]'.format(host, title.encode('utf-8')) cm = [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)] downloads = True if control.setting('downloads') == 'true' and not (control.setting( 'movie.download.path') == '' or control.setting('tv.download.path') == '') else False if downloads: cm.append((control.lang(32013).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=download&title=%s&img=%s&url=%s)' % (title.split('-')[1], img, frame)) ) addon.add_directory( {'mode': 'PlayVideo', 'url': frame, 'listitem': listitem, 'img': img, 'title': title, 'plot': plot}, {'title': title, 'plot': plot}, cm, img=img, fanart=FANART, is_folder=False) except BaseException: control.infoDialog( control.lang(32012).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def foreign_movies(url): items = [('Bluray-1080p', '/category/foreign-movies/f-bluray-1080p/'), ('Bluray-720p', '/category/foreign-movies/f-bluray-720p/'), ('DVDRIP-BDRIP', '/category/foreign-movies/f-dvdrip-bdrip/'), ('WEBRIP-WEBDL', '/category/foreign-movies/f-webrip-web-dl/'), ('OLD', 'category/foreign-movies/f-old-foreign-movies/')] for title, link in items: title = '[B][COLORgold]{0}[/COLOR][/B]'.format(title) addon.add_directory({'mode': 'GetTitles', 'section': section, 'url': BASE_URL + link, 'startPage': '1', 'numOfPages': '2'}, {'title': title}, allfun, img=IconPath + 'movies.png', fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def search_menu(): addon.add_directory({'mode': 'search_bb', 'url': 'new'}, {'title': control.lang(32014).encode('utf-8')}, img=IconPath + 'search.png', fanart=FANART) try: from sqlite3 import dbapi2 as database except ImportError: from pysqlite2 import dbapi2 as database dbcon = database.connect(control.searchFile) dbcur = dbcon.cursor() try: dbcur.execute("""CREATE TABLE IF NOT EXISTS Search (url text, search text)""") except BaseException: pass dbcur.execute("SELECT * FROM Search ORDER BY search") lst = [] delete_option = False for (url, search) in dbcur.fetchall(): # if six.PY2: # title = unquote_plus(search).encode('utf-8') # else: title = six.ensure_text(unquote_plus(search), 'utf-8') title = '[B]{}[/B]'.format(title) delete_option = True addon.add_directory({'mode': 'search_bb', 'url': search}, {'title': title}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32015).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=del_search_item&query=%s)' % search,), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=IconPath + 'search.png', fanart=FANART) lst += [(search)] dbcur.close() if delete_option: addon.add_directory({'mode': 'del_search_items'}, {'title': control.lang(32016).encode('utf-8')}, img=IconPath + 'search.png', fanart=FANART, is_folder=False) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def MainMenu(): # homescreen addon.add_directory({'mode': 'open_news'}, {'title': '[COLOR lime][B]News - Updates[/COLOR][/B]'}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=ICON, fanart=FANART, is_folder=False) addon.add_directory({'mode': 'Categories', 'section': 'movies'}, {'title': control.lang(32000).encode('utf-8')}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=IconPath + 'movies.png', fanart=FANART) addon.add_directory({'mode': 'Categories', 'section': 'tv-shows'}, {'title': control.lang(32001).encode('utf-8')}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=IconPath + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'search_menu'}, {'title': control.lang(32002).encode('utf-8')}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=IconPath + 'search.png', fanart=FANART) downloads = True if control.setting('downloads') == 'true' and ( len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False if downloads: addon.add_directory({'mode': 'downloadlist'}, {'title': control.lang(32003).encode('utf-8')}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=IconPath + 'downloads.png', fanart=FANART) addon.add_directory({'mode': 'settings'}, {'title': control.lang(32004).encode('utf-8')}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=IconPath + 'tools.png', fanart=FANART, is_folder=False) addon.add_directory({'mode': 'setviews'}, {'title': control.lang(32005).encode('utf-8')}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=IconPath + 'set_view.png', fanart=FANART) # addon.add_directory({'mode': 'help'}, {'title': control.lang(32006).encode('utf-8')}, # [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], # img=IconPath + 'github.png', fanart=FANART, is_folder=False) addon.add_directory({'mode': 'forceupdate'}, {'title': '[COLOR gold][B]Version: [COLOR lime]%s[/COLOR][/B]' % version}, [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')], img=ICON, fanart=FANART, is_folder=False) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def open_show(url): # xbmc.log('URLLLLL: {}'.format(url)) html = client.request(url) try: alts = client.parseDOM(html, 'tr', attrs={'class': 'forum_header_border'}) alts = [dom.parse_dom(str(i), 'a', req=['href', 'title'])[1] for i in alts if alts] for alt in alts: link, title = alt.attrs['href'], alt.attrs['title'] link = urljoin(eztv_base, link) if link.startswith('/') else link addon.add_directory({'mode': 'open_page', 'url': link, 'img': img, 'plot': 'N/A'}, {'title': title}, allfun, img=img, fanart=FANART) except IndexError: pass control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def MainMenu(): # homescreen addon.add_directory({'mode': 'open_news'}, {'title': '[COLOR lime][B]News - Updates[/COLOR][/B]'}, allfun, img=ICON, fanart=FANART, is_folder=False) addon.add_directory({'mode': 'scene'}, {'title': '[B][COLORwhite]SCENE RELEASE[/B][/COLOR]'}, allfun, img=IconPath + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'twoddl'}, {'title': '[B][COLORwhite]TWODDL[/B][/COLOR]'}, allfun, img=IconPath + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'ddlvalley',}, {'title': '[B][COLORwhite]DDLVALLEY[/B][/COLOR]'}, allfun, img=IconPath + 'movies.png', fanart=FANART) addon.add_directory({'mode': 'scnsrc'}, {'title': '[B][COLORwhite]SCENESOURCE[/B][/COLOR]'}, allfun, img=IconPath + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'rlsbb'}, {'title': '[B][COLORwhite]RELEASEBB[/B][/COLOR]'}, allfun, img=IconPath + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'eztv'}, {'title': '[B][COLORwhite]EZTV[/B][/COLOR]'}, allfun, img=IconPath + 'tv_shows.png', fanart=FANART) addon.add_directory({'mode': 'search_menu'}, {'title': control.lang(32002).encode('utf-8')}, allfun, img=IconPath + 'search.png', fanart=FANART) downloads = True if control.setting('downloads') == 'true' and ( len(control.listDir(control.setting('movie.download.path'))[0]) > 0 or len(control.listDir(control.setting('tv.download.path'))[0]) > 0) else False if downloads: addon.add_directory({'mode': 'downloadlist'}, {'title': control.lang(32003).encode('utf-8')}, allfun, img=IconPath + 'downloads.png', fanart=FANART) # if control.setting('eztv_menu') == 'true': # addon.add_directory({'mode': 'eztv'}, {'title': 'EZTV TV Shows'}, allfun, # img=IconPath + 'eztv.png', fanart=FANART) addon.add_directory({'mode': 'settings'}, {'title': control.lang(32004).encode('utf-8')}, allfun, img=IconPath + 'tools.png', fanart=FANART, is_folder=False) addon.add_directory({'mode': 'setviews'}, {'title': control.lang(32005).encode('utf-8')}, allfun, img=IconPath + 'set_view.png', fanart=FANART) # addon.add_directory({'mode': 'help'}, {'title': control.lang(32006).encode('utf-8')}, # [(control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=ClearCache)')], # img=IconPath + 'github.png', fanart=FANART, is_folder=False) addon.add_directory({'mode': 'forceupdate'}, {'title': '[COLOR gold][B]Version: [COLOR lime]%s[/COLOR][/B]' % version}, allfun, img=ICON, fanart=FANART, is_folder=False) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def open_episode_page(url): html = client.request(url) try: poster = client.parseDOM(html, 'td', attrs={'align': 'center'}) poster = [i for i in poster if 'img src=' in i][0] poster = client.parseDOM(poster, 'img', ret='src')[0] poster = urljoin(eztv_base, poster) if poster.startswith('/') else poster except IndexError: poster = IconPath + 'eztv.png' try: img = client.parseDOM(html, 'a', attrs={'class': 'pirobox'}, ret='href')[0] img = 'https:' + img if img.startswith('//') else img img = img.replace('large', 'small') except IndexError: img = FANART try: magnet = re.findall(r'href="(magnet:.+?)"', html, re.DOTALL)[0] title = client.parseDOM(html, 'title')[0].split(' EZTV')[0] addon.add_video_item({'mode': 'PlayVideo', 'url': magnet, 'img': img}, {'title': title}, allfun, img=poster, fanart=img) except IndexError: control.infoDialog( '[COLOR red][B]No Magnet Link available![/B][/COLOR]\n' '[COLOR lime][B]Please try other title!![/B][/COLOR]', NAME, ICON, 5000) return try: alts = client.parseDOM(html, 'tr', attrs={'class': 'forum_header_border'}) alts = [dom.parse_dom(str(i), 'a', req=['href', 'title'])[0] for i in alts if alts] for alt in alts: link, title = alt.attrs['href'], alt.attrs['title'] link = urljoin(eztv_base, link) if link.startswith('/') else link addon.add_directory({'mode': 'open_page', 'url': link, 'img': img, 'plot': 'N/A'}, {'title': title}, allfun, img=img, fanart=FANART) except IndexError: pass control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def etos(): from datetime import datetime dt = datetime.today() year = dt.year for etos in range(int(year) - 0, 1980, -1): titlos = str(etos) link = ''.join([Baseurl, '/tag/{}'.format(str(etos))]) addon.add_directory({ 'mode': 'to_items', 'url': link }, { 'title': titlos, 'plot': titlos }, allfun, img=ICON, fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def downloads_root(): movie_downloads = control.setting('movie.download.path') tv_downloads = control.setting('tv.download.path') cm = [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)'), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)')] if len(control.listDir(movie_downloads)[0]) > 0: item = control.item(label='Movies') item.addContextMenuItems(cm) item.setArt({'icon': IconPath + 'movies.png', 'fanart': FANART}) xbmcplugin.addDirectoryItem(int(sys.argv[1]), movie_downloads, item, True) if len(control.listDir(tv_downloads)[0]) > 0: item = control.item(label='Tv Shows') item.addContextMenuItems(cm) item.setArt({'icon': IconPath + 'tv_shows.png', 'fanart': FANART}) xbmcplugin.addDirectoryItem(int(sys.argv[1]), tv_downloads, item, True) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def eztv_calendar(url): html = client.request(url) tables = client.parseDOM(html, 'table', attrs={'class': 'forum_header_border'})[1:] for table in tables: day = client.parseDOM(table, 'td', attrs={'class': 'forum_thread_header'})[0] day = '[B][COLORgold]{}[/B][/COLOR]'.format(day.strip().upper()) addon.add_item({}, {'title': day}, allfun, img=IconPath + 'eztv.png', fanart=FANART) items = client.parseDOM(table, 'tr', attrs={'name': 'hover'}) items = [i for i in items if 'alt="' in i] items = [(client.parseDOM(i, 'a', ret='href')[0], client.parseDOM(i, 'img', ret='src')[0], client.parseDOM(i, 'img', ret='alt')[0]) for i in items if i] for page_link, poster, name in items: poster = urljoin(eztv_base, poster) if poster.startswith('/') else poster page_link = urljoin(eztv_base, page_link) if page_link.startswith('/') else page_link addon.add_directory({'mode': 'open_show', 'url': page_link, 'img': poster, 'plot': 'N/A'}, {'title': name.encode('utf-8')}, allfun, img=poster, fanart=FANART) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def series_menu(): addon.add_directory( { 'mode': 'scn_genre', 'url': Baseurl, 'section': 'tvshows' }, { 'title': '[B][COLOR gold]' + Lang(32035).encode('utf-8') + '[/COLOR][/B]' }, allfun, img=ART + 'tv_shows.png', fanart=FANART) addon.add_directory({ 'mode': 'scn_items', 'url': Baseurl + 'category/tv/' }, {'title': Lang(32001).encode('utf-8')}, allfun, img=ART + 'tv_shows.png', fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def Categories(section): # categories sec = r'/category/%s' % section #html = response_html(BASE_URL, '96') html = cloudflare_mode(BASE_URL) # xbmc.log('HTML: %s' % html) match = client.parseDOM(html, 'aside', attrs={'id': 'categories-2'})[0] items = zip(client.parseDOM(match, 'a'), client.parseDOM(match, 'a', ret='href')) items = [(i[0], i[1]) for i in items if sec in i[1] and not 'RSS' in i[0]] img = IconPath + 'movies.png' if 'movies' in section else IconPath + 'tv_shows.png' if 'movie' in section: addon.add_directory({'mode': 'recom', 'url': BASE_URL}, {'title': control.lang(32038).encode('utf-8')}, allfun, img=img, fanart=FANART) addon.add_directory({'mode': 'foreign', 'url': BASE_URL}, {'title': '[B][COLORgold]Foreign Movies[/COLOR][/B]'}, allfun, img=img, fanart=FANART) for title, link in items: title = '[B][COLORgold]{0}[/COLOR][/B]'.format(title) link = client.replaceHTMLCodes(link) addon.add_directory({'mode': 'GetTitles', 'section': section, 'url': link, 'startPage': '1', 'numOfPages': '2'}, {'title': title}, allfun, img=img, fanart=FANART) control.content(int(sys.argv[1]), 'addons') control.directory(int(sys.argv[1])) view.setView('addons', {'skin.estuary': 55, 'skin.confluence': 500})
def to_links(url, img, plot): # Get Links try: html = client.request(url, headers=headers) try: # <h1 class="postTitle" rel="bookmark">American Dresser 2018 BRRip XviD AC3-RBG</h1> match = client.parseDOM(html, 'h2')[0] match = re.findall(r'(.+?)\s+(\d{4}|S\d+E\d+|S\d+)', match, re.I)[0] listitem = match except IndexError: match = client.parseDOM(html, 'h2')[0] match = re.sub('<.+?>', '', match) listitem = match name = '%s (%s)' % (listitem[0].replace('.', ' '), listitem[1]) # xbmc.log('SCNSRC-NAME: {}'.format(str(name))) main = client.parseDOM(html, 'div', {'id': 'comment_list'})[0] main = client.parseDOM(main, 'p') # main = [i for i in main if i] # xbmc.log('SCNSRC-MAIN: {}'.format(str(main))) try: comments = dom.parse_dom(html, 'div', {'class': re.compile('content')}) main += [i.content for i in comments if i] except IndexError: pass links = [] import resolveurl for item in main: frames = client.parseDOM(item, 'a', ret='href') for url in frames: host = tools.GetDomain(url) if 'Unknown' in host: continue # ignore .rar files if any(x in url.lower() for x in ['.rar.', '.zip.', '.iso.']) \ or any(url.lower().endswith(x) for x in ['.rar', '.zip', '.iso']): continue if any(x in url.lower() for x in ['sample', 'zippyshare']): continue addon.log('******* %s : %s' % (host, url)) if resolveurl.HostedMediaFile(url=url): addon.log('in GetLinks if loop') title = url.rpartition('/') title = title[2].replace('.html', '') title = title.replace('.htm', '') title = title.replace( '.rar', '[COLOR red][B][I]RAR no streaming[/B][/I][/COLOR]') title = title.replace( 'rar', '[COLOR red][B][I]RAR no streaming[/B][/I][/COLOR]') title = title.replace('www.', '') title = title.replace('DDLValley.me_', ' ') title = title.replace('_', ' ') title = title.replace('.', ' ') title = title.replace( '480p', '[COLOR coral][B][I]480p[/B][/I][/COLOR]') title = title.replace( '540p', '[COLOR coral][B][I]540p[/B][/I][/COLOR]') title = title.replace( '720p', '[COLOR gold][B][I]720p[/B][/I][/COLOR]') title = title.replace( '1080p', '[COLOR orange][B][I]1080p[/B][/I][/COLOR]') title = title.replace( '1080i', '[COLOR orange][B][I]1080i[/B][/I][/COLOR]') title = title.replace( '2160p', '[COLOR cyan][B][I]4K[/B][/I][/COLOR]') title = title.replace( '.4K.', '[COLOR cyan][B][I]4K[/B][/I][/COLOR]') title = title.replace( 'mkv', '[COLOR gold][B][I]MKV[/B][/I][/COLOR] ') title = title.replace( 'avi', '[COLOR pink][B][I]AVI[/B][/I][/COLOR] ') title = title.replace( 'mp4', '[COLOR purple][B][I]MP4[/B][/I][/COLOR] ') host = host.replace( 'youtube.com', '[COLOR red][B][I]Movie Trailer[/B][/I][/COLOR]') if 'railer' in host: title = host + ' : ' + title addon.add_directory( { 'mode': 'PlayVideo', 'url': url, 'img': img, 'title': name, 'plot': plot }, { 'title': title, 'plot': plot }, [( control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=settings)', ), ( control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=ClearCache)', ), ( control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=setviews)', )], img=img, fanart=FANART, is_folder=False) else: links.append((host, title, url, name)) if control.setting('test.links') == 'true': threads = [] for i in links: threads.append(tools.Thread(tools.link_tester, i)) [i.start() for i in threads] [i.join() for i in threads] for item in tools.tested_links: link, title, name = item[0], item[1], item[2] cm = [ ( control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=settings)', ), ( control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=ClearCache)', ), ( control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=setviews)', ) ] downloads = True if control.setting( 'downloads') == 'true' and not ( control.setting('movie.download.path') == '' or control.setting('tv.download.path') == '') else False if downloads: # frame = resolveurl.resolve(link) cm.append((control.lang(32013).encode( 'utf-8' ), 'RunPlugin(plugin://plugin.video.rlshub/?mode=download&title=%s&img=%s&url=%s)' % (name, img, link))) addon.add_directory( { 'mode': 'PlayVideo', 'url': link, 'listitem': listitem, 'img': img, 'title': name, 'plot': plot }, { 'title': title, 'plot': plot }, cm, img=img, fanart=FANART, is_folder=False) else: for item in links: host, title, link, name = item[0], item[1], item[2], item[3] title = '%s - %s' % (host, title) cm = [ ( control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=settings)', ), ( control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=ClearCache)', ), ( control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.rlshub/?mode=setviews)', ) ] downloads = True if control.setting( 'downloads') == 'true' and not ( control.setting('movie.download.path') == '' or control.setting('tv.download.path') == '') else False if downloads: cm.append((control.lang(32013).encode( 'utf-8' ), 'RunPlugin(plugin://plugin.video.rlshub/?mode=download&title=%s&img=%s&url=%s)' % (name, img, link))) addon.add_directory( { 'mode': 'PlayVideo', 'url': link, 'listitem': listitem, 'img': img, 'title': name, 'plot': plot }, { 'title': title, 'plot': plot }, cm, img=img, fanart=FANART, is_folder=False) except BaseException: control.infoDialog( control.lang(32012).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def Search_bb(url): if 'new' == url: keyboard = xbmc.Keyboard() keyboard.setHeading(control.lang(32002).encode('utf-8')) keyboard.doModal() if keyboard.isConfirmed(): _query = keyboard.getText() query = _query.encode('utf-8') try: query = quote_plus(query) referer_link = 'http://search.proxybb.com?s={0}'.format(query) url = 'http://search.proxybb.com/Home/GetPost?phrase={0}&pindex=1&content=true&type=Simple&rad=0.{1}' url = url.format(query, random.randint(33333333333333333, 99999999999999999)) #########save in Database######### if six.PY2: term = unquote_plus(query).decode('utf-8') else: term = unquote_plus(query) dbcon = database.connect(control.searchFile) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM Search WHERE search = ?", (term,)) dbcur.execute("INSERT INTO Search VALUES (?,?)", (url, term)) dbcon.commit() dbcur.close() #########search in website######### headers = {'Referer': referer_link, 'X-Requested-With': 'XMLHttpRequest'} first = client.request(referer_link, headers=headers) xbmc.sleep(10) html = client.request(url, headers=headers) posts = json.loads(html)['results'] posts = [(i['post_name'], i['post_title'], i['post_content'], i['domain']) for i in posts if i] for movieUrl, title, infos, domain in posts: if not 'imdb.com/title' in infos: continue base = BASE_URL if 'old' not in domain else OLD_URL movieUrl = urljoin(base, movieUrl) if not movieUrl.startswith('http') else movieUrl title = title.encode('utf-8') infos = infos.replace('\\', '') try: img = client.parseDOM(infos, 'img', ret='src')[0] img = img.replace('.ru', '.to') except: img = ICON try: fan = client.parseDOM(infos, 'img', ret='src')[1] except: fan = FANART try: # desc = client.parseDOM(infos, 'div', attrs={'class': 'entry-summary'})[0] desc = re.findall(r'>(Plot:.+?)</p>', infos, re.DOTALL)[0] except: desc = 'N/A' desc = Sinopsis(desc) # title = six.python_2_unicode_compatible(six.ensure_str(title)) title = six.ensure_str(title, 'utf-8') name = '[B][COLORgold]{0}[/COLOR][/B]'.format(title) mode = 'GetPack' if re.search(r'\s+S\d+\s+', name) else 'GetLinks' addon.add_directory( {'mode': mode, 'url': movieUrl, 'img': img, 'plot': desc}, {'title': name, 'plot': desc}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=fan) # if 'olderEntries' in ref_html: pindex = int(re.search('pindex=(\d+)&', url).group(1)) + 1 np_url = re.sub(r'&pindex=\d+&', '&pindex={0}&'.format(pindex), url) rand = random.randint(33333333333333333, 99999999999999999) np_url = re.sub(r'&rand=0\.\d+$', '&rand={}'.format(rand), np_url) addon.add_directory( {'mode': 'search_bb', 'url': np_url + '|Referer={0}|nextpage'.format(referer_link)}, {'title': control.lang(32010).encode('utf-8')}, img=IconPath + 'next_page.png', fanart=FANART) except BaseException: control.infoDialog(control.lang(32022).encode('utf-8'), NAME, ICON, 5000) elif '|nextpage' in url: url, referer_link, np = url.split('|') referer_link = referer_link.split('=', 1)[1] headers = {'Referer': referer_link, 'X-Requested-With': 'XMLHttpRequest'} first = client.request(referer_link, headers=headers) xbmc.sleep(10) html = client.request(url, headers=headers) # xbmc.log('NEXT HTMLLLLL: {}'.format(html)) posts = json.loads(html)['results'] posts = [(i['post_name'], i['post_title'], i['post_content'], i['domain']) for i in posts if i] for movieUrl, title, infos, domain in posts: base = BASE_URL if 'old' not in domain else OLD_URL movieUrl = urljoin(base, movieUrl) if not movieUrl.startswith('http') else movieUrl title = six.ensure_str(title, 'utf-8') infos = infos.replace('\\', '') try: img = client.parseDOM(infos, 'img', ret='src')[0] img = img.replace('.ru', '.to') except: img = ICON try: fan = client.parseDOM(infos, 'img', ret='src')[1] except: fan = FANART try: desc = re.search(r'>(Plot:.+?)</p>', infos, re.DOTALL).group(0) except: desc = 'N/A' desc = Sinopsis(desc) name = '[B][COLORgold]{0}[/COLOR][/B]'.format(title) mode = 'GetPack' if re.search(r'\s+S\d+\s+', name) else 'GetLinks' addon.add_directory( {'mode': mode, 'url': movieUrl, 'img': img, 'plot': desc}, {'title': name, 'plot': desc}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=fan) # if 'olderEntries' in ref_html: pindex = int(re.search('pindex=(\d+)&', url).groups()[0]) + 1 np_url = re.sub('&pindex=\d+&', '&pindex={0}&'.format(pindex), url) rand = random.randint(33333333333333333, 99999999999999999) np_url = re.sub(r'&rand=0\.\d+$', '&rand={}'.format(rand), np_url) addon.add_directory( {'mode': 'search_bb', 'url': np_url + '|Referer={0}|nextpage'.format(referer_link)}, {'title': control.lang(32010).encode('utf-8')}, img=IconPath + 'next_page.png', fanart=FANART) else: try: url = quote_plus(url) referer_link = 'http://search.proxybb.com?s={0}'.format(url) headers = {'Referer': referer_link, 'X-Requested-With': 'XMLHttpRequest'} # first = scraper.get('http://rlsbb.ru', headers=headers).text xbmc.sleep(10) s_url = 'http://search.proxybb.com/Home/GetPost?phrase={0}&pindex=1&content=true&type=Simple&rad=0.{1}' s_url = s_url.format(url, random.randint(33333333333333333, 99999999999999999)) html = client.request(s_url, headers=headers) posts = json.loads(html)['results'] posts = [(i['post_name'], i['post_title'], i['post_content'], i['domain']) for i in posts if i] for movieUrl, title, infos, domain in posts: base = BASE_URL if 'old' not in domain else OLD_URL movieUrl = urljoin(base, movieUrl) if not movieUrl.startswith('http') else movieUrl title = six.ensure_str(title, 'utf-8') infos = infos.replace('\\', '') try: img = client.parseDOM(infos, 'img', ret='src')[0] img = img.replace('.ru', '.to') except: img = ICON try: fan = client.parseDOM(infos, 'img', ret='src')[1] except: fan = FANART try: desc = re.search(r'>(Plot:.+?)</p>', infos, re.DOTALL).group(0) except: desc = 'N/A' desc = Sinopsis(desc) name = '[B][COLORgold]{0}[/COLOR][/B]'.format(title) mode = 'GetPack' if re.search(r'\s+S\d+\s+', name) else 'GetLinks' addon.add_directory( {'mode': mode, 'url': movieUrl, 'img': img, 'plot': desc}, {'title': name, 'plot': desc}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=fan) pindex = int(re.search('pindex=(\d+)&', s_url).groups()[0]) + 1 np_url = re.sub('&pindex=\d+&', '&pindex={0}&'.format(pindex), s_url) rand = random.randint(33333333333333333, 99999999999999999) np_url = re.sub(r'&rand=0\.\d+$', '&rand={}'.format(rand), np_url) addon.add_directory( {'mode': 'search_bb', 'url': np_url + '|Referer={0}|nextpage'.format(referer_link)}, {'title': control.lang(32010).encode('utf-8')}, img=IconPath + 'next_page.png', fanart=FANART) except BaseException: control.infoDialog(control.lang(32022).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})
def Search_bb(url): if 'new' in url: keyboard = xbmc.Keyboard() keyboard.setHeading(control.lang(32002).encode('utf-8')) keyboard.doModal() if keyboard.isConfirmed(): _query = keyboard.getText() query = _query.encode('utf-8') try: from resources.lib.modules import cfscrape scraper = cfscrape.create_scraper() query = urllib.quote_plus(query) referer_link = 'http://search.rlsbb.ru/search/{0}'.format( query) headers = { 'User-Agent': client.randomagent(), 'Referer': referer_link } code = scraper.get(referer_link, headers=headers).content code = client.parseDOM(code, 'script', ret='data-code-rlsbb')[0] url = 'http://search.rlsbb.ru/lib/search45224149886049641.php?phrase={0}&pindex=1&code={1}&radit=0.{2}' url = url.format( query.replace('+', '%2B'), code, random.randint(00000000000000001, 99999999999999999)) #########save in Database######### term = urllib.unquote_plus(query).decode('utf-8') dbcon = database.connect(control.searchFile) dbcur = dbcon.cursor() dbcur.execute("DELETE FROM Search WHERE search = ?", (term, )) dbcur.execute("INSERT INTO Search VALUES (?,?)", (url, term)) dbcon.commit() dbcur.close() #########search in website######### html = scraper.get(url, headers=headers).content posts = json.loads(html)['results'] posts = [(i['post_name'], i['post_title']) for i in posts if i] for movieUrl, title in posts: movieUrl = urlparse.urljoin(BASE_URL, movieUrl) title = title.encode('utf-8') addon.add_directory({ 'mode': 'GetLinks', 'url': movieUrl }, {'title': title}, img=IconPath + 'search.png', fanart=FANART) except BaseException: control.infoDialog( control.lang(32022).encode('utf-8'), NAME, ICON, 5000) else: try: from resources.lib.modules import cfscrape scraper = cfscrape.create_scraper() referer_link = 'http://search.rlsbb.ru/search/{0}'.format(url) headers = { 'User-Agent': client.randomagent(), 'Referer': referer_link } code = scraper.get(referer_link, headers=headers).content code = client.parseDOM(code, 'script', ret='data-code-rlsbb')[0] s_url = 'http://search.rlsbb.ru/lib/search45224149886049641.php?phrase={0}&pindex=1&code={1}&radit=0.{2}' s_url = s_url.format( url.replace('+', '%2B'), code, random.randint(00000000000000001, 99999999999999999)) html = scraper.get(s_url, headers=headers).content #xbmc.log('$#$HTML:%s' % html, xbmc.LOGNOTICE) posts = json.loads(html)['results'] posts = [(i['post_name'], i['post_title']) for i in posts if i] for movieUrl, title in posts: movieUrl = urlparse.urljoin(BASE_URL, movieUrl) title = title.encode('utf-8') addon.add_directory({ 'mode': 'GetLinks', 'url': movieUrl }, {'title': title}, img=IconPath + 'search.png', fanart=FANART) except BaseException: control.infoDialog( control.lang(32022).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', { 'skin.estuary': 55, 'skin.confluence': 500, 'skin.xonfluence': 500 })
def GetLinks(section, url, img, plot): # Get Links try: import resolveurl from resources.lib.modules import init # html = response_html(url, '3') html = cloudflare_mode(url) listitem = GetMediaInfo(html) name = '%s (%s)' % (listitem[0], listitem[1]) main = list() try: main = client.parseDOM(html, 'div', {'class': 'postContent'}) except IndexError: pass main = [i for i in main if i] comments = dom.parse_dom(html, 'div', {'class': re.compile('content')}) main += [i.content for i in comments if i] links = [] for item in main: frames = client.parseDOM(item, 'a', ret='href') for url in frames: host = GetDomain(url) if 'Unknown' in host: continue # ignore .rar files if any(x in url.lower() for x in ['.rar.', '.zip.', '.iso.']) \ or any(url.lower().endswith(x) for x in ['.rar', '.zip', '.iso']): continue if any(x in url.lower() for x in ['sample', 'zippyshare']): continue addon.log('******* %s : %s' % (host, url)) if resolveurl.HostedMediaFile(url=url).valid_url(): addon.log('in GetLinks if loop') title = url.rpartition('/') title = title[2].replace('.html', '') title = title.replace('.htm', '') title = title.replace('.rar', '[COLOR red][B][I]RAR no streaming[/B][/I][/COLOR]') title = title.replace('rar', '[COLOR red][B][I]RAR no streaming[/B][/I][/COLOR]') title = title.replace('www.', '') title = title.replace('-', ' ') title = title.replace('_', ' ') title = title.replace('.', ' ') title = title.replace('480p', '[COLOR coral][B][I]480p[/B][/I][/COLOR]') title = title.replace('540p', '[COLOR coral][B][I]540p[/B][/I][/COLOR]') title = title.replace('720p', '[COLOR gold][B][I]720p[/B][/I][/COLOR]') title = title.replace('1080p', '[COLOR orange][B][I]1080p[/B][/I][/COLOR]') title = title.replace('1080i', '[COLOR orange][B][I]1080i[/B][/I][/COLOR]') title = title.replace('2160p', '[COLOR cyan][B][I]4K[/B][/I][/COLOR]') title = title.replace('.4K.', '[COLOR cyan][B][I]4K[/B][/I][/COLOR]') title = title.replace('mkv', '[COLOR gold][B][I]MKV[/B][/I][/COLOR] ') title = title.replace('avi', '[COLOR pink][B][I]AVI[/B][/I][/COLOR] ') title = title.replace('mp4', '[COLOR purple][B][I]MP4[/B][/I][/COLOR] ') host = host.replace('youtube.com', '[COLOR red][B][I]Movie Trailer[/B][/I][/COLOR]') if 'railer' in host: title = host + ' : ' + title addon.add_directory( {'mode': 'PlayVideo', 'url': url, 'listitem': listitem, 'img': img, 'title': name, 'plot': plot}, {'title': title, 'plot': plot}, [(control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)], img=img, fanart=FANART, is_folder=False) else: links.append((host, title, url, name)) if control.setting('test.links') == 'true': threads = [] for i in links: threads.append(Thread(link_tester, i)) [i.start() for i in threads] [i.join() for i in threads] for item in tested_links: link, title, name = item[0], item[1], item[2] cm = [ (control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)] downloads = True if control.setting('downloads') == 'true' and not (control.setting( 'movie.download.path') == '' or control.setting('tv.download.path') == '') else False if downloads: # frame = resolveurl.resolve(link) cm.append((control.lang(32013).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=download&title=%s&img=%s&url=%s)' % (name, img, link)) ) addon.add_directory( {'mode': 'PlayVideo', 'url': link, 'listitem': listitem, 'img': img, 'title': name, 'plot': plot}, {'title': title, 'plot': plot}, cm, img=img, fanart=FANART, is_folder=False) else: for item in links: host, title, link, name = item[0], item[1], item[2], item[3] title = '%s - %s' % (host, title) cm = [ (control.lang(32007).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=settings)',), (control.lang(32008).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=ClearCache)',), (control.lang(32009).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=setviews)',)] downloads = True if control.setting('downloads') == 'true' and not (control.setting( 'movie.download.path') == '' or control.setting('tv.download.path') == '') else False if downloads: cm.append((control.lang(32013).encode('utf-8'), 'RunPlugin(plugin://plugin.video.releaseBB/?mode=download&title=%s&img=%s&url=%s)' % (name, img, link)) ) addon.add_directory( {'mode': 'PlayVideo', 'url': link, 'listitem': listitem, 'img': img, 'title': name, 'plot': plot}, {'title': title, 'plot': plot}, cm, img=img, fanart=FANART, is_folder=False) except BaseException: control.infoDialog(control.lang(32012).encode('utf-8'), NAME, ICON, 5000) control.content(int(sys.argv[1]), 'videos') control.directory(int(sys.argv[1])) view.setView('videos', {'skin.estuary': 55, 'skin.confluence': 500})