def GetFileHosts(self, url, list, lock, message_queue): from entertainment.net import Net net = Net(do_not_cache_if_any=do_no_cache_keywords_list) custom_url = self.get_url() if self.Settings().get_setting("proxy") == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) content = common.unescape(common.str_conv(net.http_GET(url).content)) import re for sq in re.finditer(r"<span class=quality_(.+?)>.+?<a href=\".+?external.+?url=(.+?)&", content): quality = sq.group(1).upper() if quality == "UNKNOWN": continue import base64 host_url = base64.b64decode(sq.group(2)) if not "affbuzz" in host_url.lower(): self.AddFileHost(list, quality, host_url)
def GetFileHosts(self, url, list, lock, message_queue): from entertainment.net import Net net = Net(do_not_cache_if_any=do_no_cache_keywords_list) custom_url = self.get_url() if self.Settings().get_setting('proxy') == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) content = common.unescape(common.str_conv(net.http_GET(url).content)) import re #print content for sq in re.finditer(r"quality_(.+?)>.+?url=(.+?)&", content): quality = sq.group(1).upper() quality = quality.replace('"', '') if quality == 'UNKNOWN': continue import base64 host_url = base64.b64decode(sq.group(2)) if not 'affbuzz' in host_url.lower(): if not 'ads.ad-center.com' in host_url.lower(): if not 'offer?' in host_url.lower(): #print quality self.AddFileHost(list, quality, host_url)
def get_formated_date(self, date_str, fmt=""): import re import datetime if not fmt: if '00' in date_str: date_str = '01/Aug/2000' #date_str = date_str.replace('00/([0-9]{2})/([0-9]{4})','01/Aug/2000') date_str = date_str.replace('00/00/0000','01/Aug/2000') #date_str = re.sub(pattern, replace, date_str) item_air_date = common.unescape(date_str).replace(' ', '') item_fmtd_air_date = "" if 'Jan' in item_air_date: item_fmtd_air_date = '01-' elif 'Feb' in item_air_date: item_fmtd_air_date = '02-' elif 'Mar' in item_air_date: item_fmtd_air_date = '03-' elif 'Apr' in item_air_date: item_fmtd_air_date = '04-' elif 'May' in item_air_date: item_fmtd_air_date = '05-' elif 'Jun' in item_air_date: item_fmtd_air_date = '06-' elif 'Jul' in item_air_date: item_fmtd_air_date = '07-' elif 'Aug' in item_air_date: item_fmtd_air_date = '08-' elif 'Sep' in item_air_date: item_fmtd_air_date = '09-' elif 'Oct' in item_air_date: item_fmtd_air_date = '10-' elif 'Nov' in item_air_date: item_fmtd_air_date = '11-' elif 'Dec' in item_air_date: item_fmtd_air_date = '12-' else: item_fmtd_air_date = '12-' date = re.search('([0-9]{1,2})', item_air_date) if date: date = date.group(1) item_fmtd_air_date += "%02d-" % int(date) else: item_fmtd_air_date += "01-" year = re.search('([0-9]{4})', item_air_date) if year: year = year.group(1) item_fmtd_air_date += year else: item_fmtd_air_date += "0001" fmt = "%m-%d-%Y" else: item_fmtd_air_date = date_str try: item_fmtd_air_date = datetime.datetime.strptime(item_fmtd_air_date, fmt) except TypeError: import time item_fmtd_air_date = datetime.datetime(*(time.strptime(item_fmtd_air_date, fmt)[0:6])) except ValueError: item_fmtd_air_date = "08-01-2000" try: item_fmtd_air_date = datetime.datetime.strptime(item_fmtd_air_date, fmt) except TypeError: import time item_fmtd_air_date = datetime.datetime(*(time.strptime(item_fmtd_air_date, fmt)[0:6])) return item_fmtd_air_date
def Search(self, srcr, keywords, type, list, lock, message_queue, page='', total_pages=''): from entertainment.net import Net net = Net(cached=False, do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting('proxy') == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() keywords = self.CleanTextForSearch(keywords) search_page_url = custom_url + 'index.php?search' search_page_content = common.unescape( common.str_conv(net.http_GET(search_page_url).content)) import re search_key = re.compile( 'input type="hidden" name="key" value="([0-9a-f]*)"', re.DOTALL).findall(search_page_content)[0] import urllib from entertainment import odict search_dict = odict.odict({ 'key': search_key, 'search_keywords': keywords, 'search_section': '1' if type == 'movies' else '2', 'sort': 'featured' }) search_dict.sort(key=lambda x: x[0].lower()) search_for_url = custom_url + 'index.php?' + urllib.urlencode( search_dict) self.ExtractContentAndAddtoList(srcr, 'search', search_for_url, type, list, page=page, total_pages=total_pages)
def SearchContent(self, search_key, search_keywords, type, year): from entertainment.net import Net net = Net(do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting('proxy') == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() import re import urllib search_dict = { 'key': search_key, 'search_keywords': search_keywords, 'search_section': '1' if type == 'movies' else '2', 'year': year } search_for_url = custom_url + 'index.php?' + urllib.urlencode( search_dict) from entertainment import odict search_dict_for_cache = odict.odict(search_dict) search_dict_for_cache.update({'key': ''}) search_dict_for_cache.sort(key=lambda x: x[0].lower()) search_for_url_for_cache = custom_url + 'index.php?' + urllib.urlencode( search_dict_for_cache) search_results = common.unescape( common.str_conv( net.http_GET(search_for_url, url_for_cache=search_for_url_for_cache).content)) search_content = None #print search_results for search_item in re.finditer( r"<div class=\"index_item.+?\"><a href=\"(.+?)\" title=\"Watch (.+?)\"", search_results): searchitem = search_item.group(2) if year == '0' or year == '': searchitem = re.sub(' \([0-9]+\)', '', searchitem) if common.CreateIdFromString( searchitem) == common.CreateIdFromString( search_keywords + (' (' + year + ')' if year != '0' and year != '' else '')): search_content = search_item break return search_content
def SearchContent(self, search_key, search_keywords, type, year): from entertainment.net import Net net = Net(do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting("proxy") == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() import re import urllib search_dict = { "key": search_key, "search_keywords": search_keywords, "search_section": "1" if type == "movies" else "2", "year": year, "advanced": "1", } search_for_url = custom_url + "index.php?" + urllib.urlencode(search_dict) from entertainment import odict search_dict_for_cache = odict.odict(search_dict) search_dict_for_cache.update({"key": ""}) search_dict_for_cache.sort(key=lambda x: x[0].lower()) search_for_url_for_cache = custom_url + "index.php?" + urllib.urlencode(search_dict_for_cache) search_results = common.unescape( common.str_conv(net.http_GET(search_for_url, url_for_cache=search_for_url_for_cache).content) ) search_content = None for search_item in re.finditer( r"<div class=\"index_item.+?\"><a href=\"(.+?)\" title=\"Watch (.+?)\"", search_results ): searchitem = search_item.group(2) if year == "0" or year == "": searchitem = re.sub(" \([0-9]+\)", "", searchitem) if common.CreateIdFromString(searchitem) == common.CreateIdFromString( search_keywords + (" (" + year + ")" if year != "0" and year != "" else "") ): search_content = search_item break return search_content
def GetFileHosts(self, url, list, lock, message_queue): from entertainment.net import Net net = Net() content = common.unescape(common.str_conv(net.http_GET(url).content)) import re for link in re.finditer(r"href='(/watch/.+?)'>(.+?)</a>", content): if link.group(2).startswith('</a>'): continue self.AddLiveLink(list, link.group(2), self.get_url() + link.group(1))
def get_formated_date(self, date_str): import re import datetime if '00' in date_str: date_str = '01/Aug/2000' #date_str = date_str.replace('00/([0-9]{2})/([0-9]{4})','01/Aug/2000') date_str = date_str.replace('00/00/0000','01/Aug/2000') #date_str = re.sub(pattern, replace, date_str) item_air_date = common.unescape(date_str).replace(' ', '') item_fmtd_air_date = "" if 'Jan' in item_air_date: item_fmtd_air_date = '01-' elif 'Feb' in item_air_date: item_fmtd_air_date = '02-' elif 'Mar' in item_air_date: item_fmtd_air_date = '03-' elif 'Apr' in item_air_date: item_fmtd_air_date = '04-' elif 'May' in item_air_date: item_fmtd_air_date = '05-' elif 'Jun' in item_air_date: item_fmtd_air_date = '06-' elif 'Jul' in item_air_date: item_fmtd_air_date = '07-' elif 'Aug' in item_air_date: item_fmtd_air_date = '08-' elif 'Sep' in item_air_date: item_fmtd_air_date = '09-' elif 'Oct' in item_air_date: item_fmtd_air_date = '10-' elif 'Nov' in item_air_date: item_fmtd_air_date = '11-' elif 'Dec' in item_air_date: item_fmtd_air_date = '12-' else: item_fmtd_air_date = '12-' date = re.search('([0-9]{1,2})', item_air_date) if date: date = date.group(1) item_fmtd_air_date += "%02d-" % int(date) else: item_fmtd_air_date += "01-" year = re.search('([0-9]{4})', item_air_date) if year: year = year.group(1) item_fmtd_air_date += year else: item_fmtd_air_date += "0001" try: item_fmtd_air_date = datetime.datetime.strptime(item_fmtd_air_date, "%m-%d-%Y") except TypeError: import time item_fmtd_air_date = datetime.datetime(*(time.strptime(item_fmtd_air_date, "%m-%d-%Y")[0:6])) return item_fmtd_air_date
def get_formated_date(self, date_str): import re import datetime item_air_date = common.unescape(date_str).replace(' ', '') item_fmtd_air_date = "" if 'Jan' in item_air_date: item_fmtd_air_date = '01-' elif 'Feb' in item_air_date: item_fmtd_air_date = '02-' elif 'Mar' in item_air_date: item_fmtd_air_date = '03-' elif 'Apr' in item_air_date: item_fmtd_air_date = '04-' elif 'May' in item_air_date: item_fmtd_air_date = '05-' elif 'Jun' in item_air_date: item_fmtd_air_date = '06-' elif 'Jul' in item_air_date: item_fmtd_air_date = '07-' elif 'Aug' in item_air_date: item_fmtd_air_date = '08-' elif 'Sep' in item_air_date: item_fmtd_air_date = '09-' elif 'Oct' in item_air_date: item_fmtd_air_date = '10-' elif 'Nov' in item_air_date: item_fmtd_air_date = '11-' elif 'Dec' in item_air_date: item_fmtd_air_date = '12-' else: item_fmtd_air_date = '12-' date=item_air_date.split('.')[0] date = re.search('([0-9]{1,2})', date) if date: date = date.group(1) item_fmtd_air_date += "%02d-" % int(date) else: item_fmtd_air_date += "01-" year = re.search('([0-9]{4})', item_air_date) if year: year = year.group(1) item_fmtd_air_date += year else: item_fmtd_air_date += "0001" try: item_fmtd_air_date = datetime.datetime.strptime(item_fmtd_air_date, "%m-%d-%Y") except TypeError: import time item_fmtd_air_date = datetime.datetime(*(time.strptime(item_fmtd_air_date, "%m-%d-%Y")[0:6])) return item_fmtd_air_date
def Search(self, srcr, keywords, type, list, lock, message_queue, page="", total_pages=""): from entertainment.net import Net net = Net(cached=False, do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting("proxy") == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() keywords = self.CleanTextForSearch(keywords) search_page_url = custom_url + "index.php?search" search_page_content = common.unescape(common.str_conv(net.http_GET(search_page_url).content)) import re search_key = re.search('input type="hidden" name="key" value="([0-9a-f]*)"', search_page_content).group(1) import urllib from entertainment import odict search_dict = odict.odict( { "key": search_key, "search_keywords": keywords, "search_section": "1" if type == "movies" else "2", "sort": "featured", } ) search_dict.sort(key=lambda x: x[0].lower()) search_for_url = custom_url + "index.php?" + urllib.urlencode(search_dict) self.ExtractContentAndAddtoList(srcr, "search", search_for_url, type, list, page=page, total_pages=total_pages)
def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue): from entertainment.net import Net net = Net(cached=False, do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting('proxy') == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() if 'primeware.racing' in custom_url: import xbmcaddon ADDON = xbmcaddon.Addon( id='script.icechannel.primewireag.settings') ADDON.setSetting('custom_text_url', 'http://www.primewire.ch/') title = self.CleanTextForSearch(title) name = self.CleanTextForSearch(name) search_page_url = custom_url + 'index.php?search' search_page_content = common.unescape( common.str_conv(net.http_GET(search_page_url).content)) if 'virginmedia.com/courtorders' in search_page_content.lower( ) or 'ukispcourtorders' in search_page_content.lower( ) or 'is not available through bskyb' in search_page_content.lower( ) or 'ACCESS TO THE WEBSITES LISTED ON THIS PAGE HAS BEEN BLOCKED PURSUANT TO ORDERS OF THE HIGH COURT' in search_page_content.upper( ): import xbmcaddon ADDON = xbmcaddon.Addon( id='script.icechannel.primewireag.settings') ADDON.setSetting('custom_url', 'Custom') ADDON.setSetting('custom_text_url', 'http://www.primewire.ch/') import re search_key = re.compile( 'input type="hidden" name="key" value="([0-9a-f]*)"', re.DOTALL).findall(search_page_content)[0] search_content = None name = name.replace("'", " ") search_content = self.SearchContent(search_key, name, type, year) if search_content == None and ':' in name: new_name = name.replace(':', ' -') search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None and (new_name.endswith('s') or new_name.endswith('?')): new_name = new_name[:len(new_name) - 1] search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None: search_content = self.SearchContent( search_key, new_name, type, '0') if search_content == None: new_name = name.replace(':', '') search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None and (new_name.endswith('s') or new_name.endswith('?')): new_name = new_name[:len(new_name) - 1] search_content = self.SearchContent( search_key, new_name, type, year) if search_content == None: search_content = self.SearchContent( search_key, new_name, type, '0') if search_content == None: search_content = self.SearchContent(search_key, name, type, '') if type == 'tv_episodes' and search_content: show_url = search_content.group(1) show_url = re.sub('watch-', 'tv-', show_url) show_url = show_url + '/season-' + season + '-episode-' + episode search_content = re.search('(.*)', show_url) if search_content: self.GetFileHosts(custom_url + search_content.group(1), list, lock, message_queue)
def GetFileHostsForContent(self, title, name, year, season, episode, type, list, lock, message_queue): from entertainment.net import Net net = Net(cached=False, do_not_cache_if_any=do_no_cache_keywords_list) if self.Settings().get_setting("proxy") == "true": import socks (proxy, port) = self.get_proxy() socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy, port) net.set_socket_class(socks.socksocket) custom_url = self.get_url() title = self.CleanTextForSearch(title) name = self.CleanTextForSearch(name) search_page_url = custom_url + "index.php?search" search_page_content = common.unescape(common.str_conv(net.http_GET(search_page_url).content)) if custom_url == "http://primewire.unblocked.pw/": import xbmcaddon ADDON = xbmcaddon.Addon(id="script.icechannel.PrimeWire.settings") ADDON.setSetting("custom_text_url", "https://www.primewire.ag/") if ( "virginmedia.com/courtorders" in search_page_content or "ukispcourtorders" in search_page_content or "is not available through BSkyB" in search_page_content or "ACCESS TO THE WEBSITES LISTED ON THIS PAGE HAS BEEN BLOCKED PURSUANT TO ORDERS OF THE HIGH COURT" in search_page_content ): import xbmcaddon ADDON = xbmcaddon.Addon(id="script.icechannel.PrimeWire.settings") ADDON.setSetting("custom_url", "Custom") ADDON.setSetting("custom_text_url", "https://www.primewire.ag/") import re search_key = re.search('input type="hidden" name="key" value="([0-9a-f]*)"', search_page_content).group(1) search_content = None name = name.replace("'", " ") search_content = self.SearchContent(search_key, name, type, year) if search_content == None and ":" in name: new_name = name.replace(":", " -") search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None and (new_name.endswith("s") or new_name.endswith("?")): new_name = new_name[: len(new_name) - 1] search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None: search_content = self.SearchContent(search_key, new_name, type, "0") if search_content == None: new_name = name.replace(":", "") search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None and (new_name.endswith("s") or new_name.endswith("?")): new_name = new_name[: len(new_name) - 1] search_content = self.SearchContent(search_key, new_name, type, year) if search_content == None: search_content = self.SearchContent(search_key, new_name, type, "0") if search_content == None: search_content = self.SearchContent(search_key, name, type, "") if type == "tv_episodes" and search_content: show_url = search_content.group(1) show_url = re.sub("watch-", "tv-", show_url) show_url = show_url + "/season-" + season + "-episode-" + episode search_content = re.search("(.*)", show_url) if search_content: self.GetFileHosts(custom_url + search_content.group(1), list, lock, message_queue)