class Mp4EdgeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mp4edge.com" domains = ["mp4edge.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:.*?)mp4edge\.com)/stream/([0-9a-zA-Z]+)' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/stream/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: return r.group(1) else: raise UrlResolver.ResolverError('File not found')
class AllVidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "allvid" domains = ["allvid.ch"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://(allvid\.ch)/(?:embed-)(.+?)(?:-|/|\.|$)' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/embed-%s.html' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('sources\s*:\s*\[\s*\{\s*file\s*:\s*["\'](.+?)["\']', html) if r: return r.group(1) else: raise UrlResolver.ResolverError('File not found')
class AaaaPlayVidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_playvid" domains = ["playvid.com", "playvids.com"] def __init__(self): p = self.get_setting('priority') or 100 self.pattern = 'http://(.*?playvids*\.com)/(?:embed|watch/)(.+)' self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/embed/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search( '<embed\s*(?:data-href-html5=".+?"\s*)?type="application/x-shockwave-flash"(.+?)/>', html) if r: s = urllib2.unquote(r.group(1).replace('&', '&')) r = re.search('.*?video_vars\[video_url_default\]=(.+?)&.*', s) if r: r = re.search( '.*?video_vars\[video_urls\]\[' + re.escape(r.group(1)) + '\]=(.+?)&.*', s) if r: return self.__add_headers_for_kodi(r.group(1)) raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class ZeroCastResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "zerocast" domains = ["zerocast.tv"] pattern = '(?://|\.)(zerocast\.tv)/((?:embed|(?:channels/)*chan(?:nel)*)\.php\?.*(?:a=[0-9]+|chan=[a-zA-Z0-9]+).*)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = None if 'chan=' in web_url: html = self.net.http_GET(web_url, headers=self.headers).content r = re.search( '<script\stype=[\'"]text/javascript[\'"]\ssrc=[\'"](.+?)[\'"]>', html) if r: web_url = r.group(1) r = re.search('.+?a=([0-9]+).+', web_url) if r: web_url = 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % r.group( 1) html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: stream_url = r.group(1) else: r = re.search('curl\s*=\s*[\'"](.+?)[\'"]', html) if r: try: stream_url = r.group(1).decode('base64', 'strict') except Exception: raise UrlResolver.ResolverError('Failed to decode url') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found') def get_url(self, host, media_id): return 'http://zerocast.tv/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class AaaaYucacheResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_yucache.net" domains = ["yucache.net"] def __init__(self): p = self.get_setting("priority") or 99 self.priority = int(p) self.pattern = "http://((?:www|embed)*\.*(?:yucache\.net))/((?:embed(?:_ext)*/)*[0-9a-zA-Z/\?_\-=]+)[&]*.*" self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {"User-Agent": self.user_agent} def get_url(self, host, media_id): return "http://%s/%s" % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting("enabled") == "false": return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers["Referer"] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search( "(?:playlist:|timer\s*=\s*null;).+?url\s*[:=]+\s*['\"]+(http://stream\..+?)['\"]+", html, re.DOTALL ) if r: stream_url = urllib.unquote_plus(r.group(1)) opener = urllib2.build_opener() opener.addheaders = [("User-agent", self.user_agent)] opener.addheaders = [("Referer", web_url)] try: """ Quick test for redirected stream_url """ resp = opener.open(stream_url) if stream_url != resp.geturl(): stream_url = resp.geturl() except urllib2.HTTPError, e: if e.code == 403: if stream_url != e.geturl(): stream_url = e.geturl() else: stream_url = None if stream_url: return self.__add_headers_for_kodi(stream_url) else: raise UrlResolver.ResolverError("File not found")
class AaaaVideo44Resolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_video44.net" domains = ["video44.net", "easyvideo.me"] def __init__(self): p = self.get_setting('priority') or 99 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www.)?(?:video44.net|easyvideo.me))/gogo/.*?file=([%0-9a-zA-Z\-_\.]+).*?' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): media_id = re.sub(r'%20', '_', media_id) return 'http://%s/gogo/?sv=1&file=%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*"(.+?)"', html) if not r: r = re.search('playlist:.+?url:\s*\'(.+?)\'', html, re.DOTALL) if r: if 'google' in r.group(1): return HostedMediaFile(url=r.group(1)).resolve() else: return self.__add_headers_for_kodi(r.group(1)) else: raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class AaaaSextvXResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_sextvx" domains = ["sextvx.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.pattern = 'http://.*?(sextvx\.com/[a-zA-Z]{2})/(?:embed|video|stream)/([0-9]+?)(?:-|$|/.*)' self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/embed/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'Referer': web_url} html = self.net.http_GET(web_url, headers=self.headers).content # http://www.sextvx.com/flux?d=web.flv&s=3&p=4,7,5,8,9,475894 r = re.search('.*?<div id="player" path="(.+?),.+?\.(.+?)".*?', html) if r: s = r.group(1) p = r.group(2).replace('/', ',') web_url = 'http://www.sextvx.com/flux?d=web.flv&s=' + s + '&p=' + p stream_url = self.net.http_GET(web_url, headers=headers).content if stream_url: return self.__add_headers_for_kodi(stream_url) raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class ZeroCastResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "zerocast" domains = ["zerocast.tv"] pattern = '(?://|\.)(zerocast\.tv)/((?:embed|(?:channels/)*chan(?:nel)*)\.php\?.*(?:a=[0-9]+|chan=[a-zA-Z0-9]+).*)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = None if 'chan=' in web_url: html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('<script\stype=[\'"]text/javascript[\'"]\ssrc=[\'"](.+?)[\'"]>', html) if r: web_url = r.group(1) r = re.search('.+?a=([0-9]+).+', web_url) if r: web_url = 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % r.group(1) html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: stream_url = r.group(1) else: r = re.search('curl\s*=\s*[\'"](.+?)[\'"]', html) if r: try: stream_url = r.group(1).decode('base64', 'strict') except Exception: raise UrlResolver.ResolverError('Failed to decode url') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found') def get_url(self, host, media_id): return 'http://zerocast.tv/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class AaaaPlayVidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_playvid" domains = ["playvid.com", "playvids.com"] def __init__(self): p = self.get_setting('priority') or 100 self.pattern = 'http://(.*?playvids*\.com)/(?:embed|watch/)(.+)' self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/embed/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('<embed\s*(?:data-href-html5=".+?"\s*)?type="application/x-shockwave-flash"(.+?)/>', html) if r: s = urllib2.unquote(r.group(1).replace('&', '&')) r = re.search('.*?video_vars\[video_url_default\]=(.+?)&.*', s) if r: r = re.search('.*?video_vars\[video_urls\]\[' + re.escape(r.group(1)) + '\]=(.+?)&.*', s) if r: return self.__add_headers_for_kodi(r.group(1)) raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class AaaaMp4EdgeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_mp4edge.com" domains = ["mp4edge.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:.*?)mp4edge\.com)/stream/([0-9a-zA-Z]+)' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/stream/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: return self.__add_headers_for_kodi(r.group(1)) else: raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class AaaaAnimeUploaderResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_animeuploader" domains = ["animeuploader.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.pattern = 'http[s]*://(.*?(?:animeuploader)\.com)/embed\.php\?video=(.+?)(?:&.*|$)' self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s//embed.php?video=%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content r = re.search('\s*?sources:\s*?\[\s*?\{\s*?file:\s*?[\'"](.+?)[\'"].*', html) if r: return self.__add_headers_for_kodi(r.group(1)) else: raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class AaaaYucacheResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_yucache.net" domains = ["yucache.net"] def __init__(self): p = self.get_setting('priority') or 99 self.priority = int(p) self.pattern = 'http://((?:www|embed)*\.*(?:yucache\.net))/((?:embed(?:_ext)*/)*[0-9a-zA-Z/\?_\-=]+)[&]*.*' self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('(?:playlist:|timer\s*=\s*null;).+?url\s*[:=]+\s*[\'"]+(http://stream\..+?)[\'"]+', html, re.DOTALL) if r: stream_url = urllib.unquote_plus(r.group(1)) opener = urllib2.build_opener() opener.addheaders = [('User-agent', self.user_agent)] opener.addheaders = [('Referer', web_url)] try: """ Quick test for redirected stream_url """ resp = opener.open(stream_url) if stream_url != resp.geturl(): stream_url = resp.geturl() except urllib2.HTTPError, e: if e.code == 403: if stream_url != e.geturl(): stream_url = e.geturl() else: stream_url = None if stream_url: return self.__add_headers_for_kodi(stream_url) else: raise UrlResolver.ResolverError('File not found')
class UsersCloudResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "userscloud" domains = ["userscloud.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'https://(userscloud\.com)/(?:embed-)*([a-zA-Z0-9]+)[/|-|$]*' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'https://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('>(eval\(function\(p,a,c,k,e,d\).+?)</script>', html, re.DOTALL) if r: r = jsunpack.unpack(r.group(1)) r = re.search( 'param\sname\s*=\s*[\'"]src[\'"]\s*value\s*=\s*[\'"](.+?)[\'"]', r) if r: stream_url = r.group(1) if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found')
class MediaPlayBoxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver] name = "MediaPlayBox" domains = ["mediaplaybox.com"] pattern = '(?://|\.)(mediaplaybox\.com)/video/(.*)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.net.set_user_agent(common.IE_USER_AGENT) self.headers = {'User-Agent': common.IE_USER_AGENT} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content patterns = [ 'property="og:video"\s+content="[^"]+\?f=([^"]+)', 'itemprop="embedURL"\s+content="[^"]+\?f=([^"]+)', '<embed[^>]+src="[^"]+\?f=([^"]+)' ] for pattern in patterns: match = re.search(pattern, html) if match: xml = self.net.http_GET(match.group(1)).content root = ET.fromstring(xml) result = root.find('./video/src') if result is not None: return result.text raise UrlResolver.ResolverError('Unable to find mediaplaybox video') def get_url(self, host, media_id): return 'http://mediaplaybox.com/video/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class UsersCloudResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "userscloud" domains = ["userscloud.com"] pattern = '(?://|\.)(userscloud\.com)/(?:embed-)?([0-9a-zA-Z/]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('>(eval\(function\(p,a,c,k,e,d\).+?)</script>', html, re.DOTALL) if r: js_data = jsunpack.unpack(r.group(1)) stream_url = re.findall('<param\s+name="src"\s*value="([^"]+)', js_data) stream_url += re.findall('file\s*:\s*[\'|\"](.+?)[\'|\"]', js_data) stream_url = [i for i in stream_url if not i.endswith('.srt')] if stream_url: return stream_url[0] raise UrlResolver.ResolverError('File not found') def get_url(self, host, media_id): return 'https://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class AllVidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "allvid" domains = ["allvid.ch"] pattern = '(?://|\.)(allvid\.ch)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content for match in re.finditer('(eval\(function.*?)</script>', html, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) js_data = js_data.replace('\\\'', '\'') r = re.search('sources\s*:\s*\[\s*\{\s*file\s*:\s*["\'](.+?)["\']', js_data) if r: return r.group(1) else: raise UrlResolver.ResolverError('File not found') def get_url(self, host, media_id): return 'http://%s/embed-%s.html' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class UsersFilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver] name = "UsersFiles" domains = ["usersfiles.com"] pattern = '(?://|\.)(usersfiles\.com)/(?:embed-)?([0-9a-zA-Z/]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.net.set_user_agent(common.IE_USER_AGENT) self.headers = {'User-Agent': common.IE_USER_AGENT} def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content match = re.search('<script[^>]*>(eval.*?)</script>', html, re.DOTALL) if match: js_data = jsunpack.unpack(match.group(1)) stream_url = re.findall('<param\s+name="src"\s*value="([^"]+)', js_data) stream_url += re.findall('file\s*:\s*[\'|\"](.+?)[\'|\"]', js_data) stream_url = [i for i in stream_url if not i.endswith('.srt')] if stream_url: return stream_url[0] raise UrlResolver.ResolverError('Unable to find userfiles video') def get_url(self, host, media_id): return 'http://usersfiles.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class UsersCloudResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "userscloud" domains = ["userscloud.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'https://(userscloud\.com)/(?:embed-)*([a-zA-Z0-9]+)[/|-|$]*' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'https://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('>(eval\(function\(p,a,c,k,e,d\).+?)</script>', html, re.DOTALL) if r: r = jsunpack.unpack(r.group(1)) r = re.search('param\sname\s*=\s*[\'"]src[\'"]\s*value\s*=\s*[\'"](.+?)[\'"]', r) if r: stream_url = r.group(1) if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found')
class UsersFilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver] name = "UsersFiles" domains = ["usersfiles.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http[s]*://((?:www\.)?usersfiles.com)/(.*)' self.net.set_user_agent(common.IE_USER_AGENT) self.headers = {'User-Agent': common.IE_USER_AGENT} def get_url(self, host, media_id): return 'http://usersfiles.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content match = re.search('<script[^>]*>(eval.*?)</script>', html, re.DOTALL) if match: js_data = jsunpack.unpack(match.group(1)) print js_data match = re.search('<param\s+name="src"\s*value="([^"]+)', js_data) if match: return match.group(1) raise UrlResolver.ResolverError('Unable to find userfiles video')
class ZeroCastResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "zerocast" domains = ["zerocast.tv"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://(zerocast\.tv)/(?:embed|channel)\.php\?.*a=([0-9]+).+' # 'http://zerocast.tv/embed|channel.php?a=1875&id=&width=640&height=480&autostart=true&strech= self.user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko' self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: return r.group(1) else: raise UrlResolver.ResolverError('File not found')
class AaaaPlay44Resolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_play44.net" domains = ["play44.net", "byzoo.org", "playpanda.net", "playbb.me", "videozoo.me", "videowing.me"] def __init__(self): p = self.get_setting('priority') or 99 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www\.)*(?:play44|byzoo|playpanda|playbb|videozoo|videowing)\.(?:me|org|net)/(?:embed[/0-9a-zA-Z]*?|gplus)(?:\.php)*)\?.*?((?:vid|video|id)=[%0-9a-zA-Z_\-\./]+|.*)[\?&]*.*' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): if media_id: return 'http://%s?%s' % (host, media_id) else: return 'http://%s' % host def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = '' new_host = urlparse(web_url).netloc html = self.net.http_GET(web_url, headers=self.headers).content if 'videozoo' not in new_host: r = re.search('(?:playlist:|timer\s*=\s*null;).+?url\s*[:=]+\s*[\'"]+(.+?)[\'"]+', html, re.DOTALL) else: r = re.search('\*/\s+?(eval\(function\(p,a,c,k,e,d\).+)\s+?/\*', html) if r: try: r = jsunpack.unpack(r.group(1)) if r: r = re.search('\[{"url":"(.+?)"', r.replace('\\', '')) except: if r: re_src = re.search('urlResolvers\|2F(.+?)\|', r.group(1)) re_url = re.search('php\|3D(.+?)\|', r.group(1)) r = None if re_src and re_url: stream_url = 'http://%s/%s.php?url=%s' % (new_host, re_src.group(1), re_url.group(1)) stream_url = self._redirect_test(stream_url) if r: stream_url = urllib.unquote_plus(r.group(1)) if 'http' not in stream_url: stream_url = 'http://' + host + '/' + stream_url.replace('/gplus.php', 'gplus.php').replace('/picasa.php', 'picasa.php') stream_url = self._redirect_test(stream_url) """ Rebuild stream_url with only st= and e= flags """ s = re.search('(http://.+/)(.+?)\?.*(st=[0-9a-zA-Z_\-]+).*?(e=[0-9]+).*', stream_url) if s: stream_url = str(s.group(1)) + str(s.group(2)) + '?' + str(s.group(3)) + '&' + str(s.group(4)) if stream_url: if 'google' in stream_url: return HostedMediaFile(url=stream_url).resolve() else: return self.__add_headers_for_kodi(stream_url) else: raise UrlResolver.ResolverError('File not found') def _redirect_test(self, url): opener = urllib2.build_opener() opener.addheaders = [('User-agent', self.user_agent)] opener.addheaders = [('Referer', urlparse(url).netloc)] try: """ Quick test for redirected stream_url """ resp = opener.open(url) if url != resp.geturl(): return resp.geturl() else: return url except urllib2.HTTPError, e: if e.code == 403: if url != e.geturl(): return e.geturl() raise UrlResolver.ResolverError('File not found')
class AaaaGoogleResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_googlevideo" domains = [ "googlevideo.com", "picasaweb.google.com", "googleusercontent.com", "plus.google.com", "googledrive.com" ] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.pattern = 'http[s]*://(.*?(?:\.googlevideo|(?:picasaweb|plus)\.google|google(?:usercontent|drive))\.com)/(.*?(?:videoplayback\?|\?authkey|host/)*.+)' self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'https://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = '' vid_sel = web_url if ('picasaweb.' in host) or ('plus.' in host): vid_sel = '' videos = [] vid_id = re.search('(?:.*?#|.+/)(.+?)(?:\?|$)', web_url) if vid_id: vid_id = vid_id.group(1) resp = self.net.http_GET(web_url, headers=self.headers) if 'picasaweb.' in host: html = re.search( '\["shared_group_' + re.escape(vid_id) + '"\](.+?),"ccOverride":"false"}', resp.content, re.DOTALL) if html: videos = re.compile( ',{"url":"(https://.+?\.google(?:video|usercontent)\.com/.+?)","height":([0-9]+?),"width":([0-9]+?),"type":"video/.+?"}' ).findall(html.group(1)) elif 'plus.' in host: html = re.search( '"' + re.escape(vid_id) + '",\[\](.+?),"https://video.googleusercontent.com/.*?"', resp.content, re.DOTALL) if html: temp = re.compile( '\[(\d+),(\d+),(\d+),"(.+?)"\]').findall( html.group(1)) if temp: for i, w, h, v in temp: videos.append( [str(v).replace('\\u003d', '='), int(h)]) vid_list = [] url_list = [] best = 0 quality = 0 if videos: if len(videos) > 1: for index, video in enumerate(videos): if int(video[1]) > quality: best = index quality = int(video[1]) vid_list.extend(['GoogleVideo - %sp' % quality]) url_list.extend([video[0]]) if len(videos) == 1: vid_sel = videos[0][0] else: if self.get_setting('auto_pick') == 'true': vid_sel = url_list[best] else: result = xbmcgui.Dialog().select( 'Choose a link', vid_list) if result != -1: vid_sel = url_list[result] else: raise UrlResolver.ResolverError( 'No link selected') if vid_sel: if ('redirector.' in vid_sel) or ('googleusercontent' in vid_sel): stream_url = urllib2.urlopen(vid_sel).geturl() elif 'google' in vid_sel: stream_url = vid_sel if stream_url: return self.__add_headers_for_kodi(stream_url) raise UrlResolver.ResolverError('File not found') def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % ( self.__class__.__name__) return xml def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class AaaaMp4EdgeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_mp4edge.com" domains = ["mp4edge.com"] def __init__(self): p = self.get_setting("priority") or 100 self.priority = int(p) self.net = Net() self.pattern = "http://((?:.*?)mp4edge\.com)/stream/([0-9a-zA-Z]+)" self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {"User-Agent": self.user_agent} def get_url(self, host, media_id): return "http://%s/stream/%s" % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting("enabled") == "false": return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers["Referer"] = web_url html = self.net.http_GET(web_url, headers=self.headers).content r = re.search("file\s*:\s*[\"'](.+?)[\"']", html) if r: return self.__add_headers_for_kodi(r.group(1)) else: raise UrlResolver.ResolverError("File not found") def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus("http://%s/" % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = "60" _cookies = "" for _cookie in self.net._cj: _cookies += urllib.quote_plus("%s=%s;" % (_cookie.name, _cookie.value)) if _cookies: return "%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s" % ( url, _referer, _user_agent, _connection_timeout, _cookies, ) else: return "%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s" % ( url, _referer, _user_agent, _connection_timeout, )
class UpToBoxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uptobox" domains = ["uptobox.com", "uptostream.com"] pattern = '(?://|\.)(uptobox.com|uptostream.com)/(?:iframe/)?([0-9A-Za-z_]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'Uptobox.com is not available in your country' in html: raise Exception() r = re.search( '(You have to wait (?:[0-9]+ minute[s]*, )*[0-9]+ second[s]*)', html) if r: raise Exception() r = re.search('<form\sname\s*=[\'"]F1[\'"].+?>(.+?)<br\s*/*>', html, re.DOTALL).group(1) data = {} for match in re.finditer( r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html): key, value = match.groups() data[key] = value for i in range(0, 3): try: html = self.net.http_POST(web_url, data, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') stream_url = re.search( '<a\shref\s*=[\'"](.+?)[\'"]\s*>\s*<span\sclass\s*=\s*[\'"]button_upload green[\'"]\s*>', html).group(1) return stream_url except: xbmc.sleep(1000) except: pass try: web_url = self.get_stream_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'Uptobox.com is not available in your country' in html: raise Exception() ''' r = re.search('(You have reached the limit of *[0-9]+ minute[s]*)', html) if r: raise Exception() ''' sources = re.compile( '<source.+?src\s*=\s*[\'"](.+?)[\'"].+?data-res\s*=\s*[\'"](.+?)[\'"].*?/>' ).findall(html) sources = [(i[0], int(re.sub('[^0-9]', '', i[1]))) for i in sources] sources = sorted(sources, key=lambda k: k[1]) stream_url = sources[-1][0] if stream_url.startswith('//'): stream_url = 'http:' + stream_url return stream_url except: pass raise UrlResolver.ResolverError('File not found') def get_url(self, host, media_id): return 'http://uptobox.com/%s' % media_id def get_stream_url(self, host, media_id): return 'http://uptostream.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class AaaaPlay44Resolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_play44.net" domains = [ "play44.net", "byzoo.org", "playpanda.net", "playbb.me", "videozoo.me", "videowing.me" ] def __init__(self): p = self.get_setting('priority') or 99 self.priority = int(p) self.net = Net() self.pattern = 'http://((?:www\.)*(?:play44|byzoo|playpanda|playbb|videozoo|videowing)\.(?:me|org|net)/(?:embed[/0-9a-zA-Z]*?|gplus)(?:\.php)*)\?.*?((?:vid|video|id)=[%0-9a-zA-Z_\-\./]+|.*)[\?&]*.*' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): if media_id: return 'http://%s?%s' % (host, media_id) else: return 'http://%s' % host def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or self.name in host def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = '' new_host = urlparse(web_url).netloc html = self.net.http_GET(web_url, headers=self.headers).content if 'videozoo' not in new_host: r = re.search( '(?:playlist:|timer\s*=\s*null;).+?url\s*[:=]+\s*[\'"]+(.+?)[\'"]+', html, re.DOTALL) else: r = re.search('\*/\s+?(eval\(function\(p,a,c,k,e,d\).+)\s+?/\*', html) if r: try: r = jsunpack.unpack(r.group(1)) if r: r = re.search('\[{"url":"(.+?)"', r.replace('\\', '')) except: if r: re_src = re.search('urlResolvers\|2F(.+?)\|', r.group(1)) re_url = re.search('php\|3D(.+?)\|', r.group(1)) r = None if re_src and re_url: stream_url = 'http://%s/%s.php?url=%s' % ( new_host, re_src.group(1), re_url.group(1)) stream_url = self._redirect_test(stream_url) if r: stream_url = urllib.unquote_plus(r.group(1)) if 'http' not in stream_url: stream_url = 'http://' + host + '/' + stream_url.replace( '/gplus.php', 'gplus.php').replace('/picasa.php', 'picasa.php') stream_url = self._redirect_test(stream_url) """ Rebuild stream_url with only st= and e= flags """ s = re.search( '(http://.+/)(.+?)\?.*(st=[0-9a-zA-Z_\-]+).*?(e=[0-9]+).*', stream_url) if s: stream_url = str(s.group(1)) + str(s.group(2)) + '?' + str( s.group(3)) + '&' + str(s.group(4)) if stream_url: if 'google' in stream_url: return HostedMediaFile(url=stream_url).resolve() else: return self.__add_headers_for_kodi(stream_url) else: raise UrlResolver.ResolverError('File not found') def _redirect_test(self, url): opener = urllib2.build_opener() opener.addheaders = [('User-agent', self.user_agent)] opener.addheaders = [('Referer', urlparse(url).netloc)] try: """ Quick test for redirected stream_url """ resp = opener.open(url) if url != resp.geturl(): return resp.geturl() else: return url except urllib2.HTTPError, e: if e.code == 403: if url != e.geturl(): return e.geturl() raise UrlResolver.ResolverError('File not found')
numpagesindex = { '0' : 1, '1' : 2, '2' : 3, '3' : 4, '4' : 5, '5' : 6, '6' : 7, '7' : 8, '8' : 9, '9' : 10 } catagories = [ 'Action', 'Adult', 'Adventure', 'Animation', 'Biography', 'Comedy', 'Crime', 'Documentary', 'Drama', 'Family', 'Fantasy', 'Film Noir', 'Game Show', 'History', 'Horror', 'Music', 'Mystical', 'News', 'Reality TV', 'Romance', 'Sci-Fi', 'Short', 'Sport', 'Talk Show', 'Thriller', 'War', 'Western' ] addon = Addon('plugin.video.solarmovie', sys.argv) cm = ContextMenu(addon) net = Net() net.set_user_agent('Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; yie9)') base_url = 'http://www.solarmovie.eu' mode = addon.queries['mode'] play = addon.queries.get('play', None) solarpath = addon.get_path() smallimage = os.path.join(xbmc.translatePath(solarpath), \ 'art','logo_in_gold_black.jpg') numpages = numpagesindex[addon.get_setting('numpages')] maxlinks = int(addon.get_setting('maxlinks')) hideadult = addon.get_setting('hideadult') enableproxy = addon.get_setting('proxy_enable') proxyserver = addon.get_setting('proxy_server') proxyport = addon.get_setting('proxy_port')
from metahandler import metahandlers from resources.modules import main from resources.utils import autoupdate from t0mm0.common.addon import Addon addon_id = 'plugin.video.twomovies' addon = main.addon ADDON = xbmcaddon.Addon(id='plugin.video.twomovies') from t0mm0.common.net import Net net = Net() newagent ='Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36' net.set_user_agent(newagent) #PATHS artwork = xbmc.translatePath(os.path.join('special://home','addons',addon_id,'resources','art/')) messages = xbmc.translatePath(os.path.join('special://home','addons',addon_id,'resources','messages/')) settings = xbmcaddon.Addon(id='plugin.video.twomovies') addon_path = os.path.join(xbmc.translatePath('special://home/addons'), '') domain = settings.getSetting('tmovies_domain') base_url = 'http://www.'+domain+'' #========================DLStuff======================= mode = addon.queries['mode'] url = addon.queries.get('url', '') name = addon.queries.get('name', '') thumb = addon.queries.get('thumb', '')
class UpToBoxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uptobox" domains = ["uptobox.com", "uptostream.com"] pattern = '(?://|\.)(uptobox.com|uptostream.com)/(?:iframe/)?([0-9A-Za-z_]+)' def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_media_url(self, host, media_id): try: web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'Uptobox.com is not available in your country' in html: raise Exception() r = re.search('(You have to wait (?:[0-9]+ minute[s]*, )*[0-9]+ second[s]*)', html) if r: raise Exception() r = re.search('<form\sname\s*=[\'"]F1[\'"].+?>(.+?)<br\s*/*>', html, re.DOTALL).group(1) data = {} for match in re.finditer(r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html): key, value = match.groups() data[key] = value for i in range(0, 3): try: html = self.net.http_POST(web_url, data, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') stream_url = re.search('<a\shref\s*=[\'"](.+?)[\'"]\s*>\s*<span\sclass\s*=\s*[\'"]button_upload green[\'"]\s*>', html).group(1) return stream_url except: xbmc.sleep(1000) except: pass try: web_url = self.get_stream_url(host, media_id) self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'Uptobox.com is not available in your country' in html: raise Exception() ''' r = re.search('(You have reached the limit of *[0-9]+ minute[s]*)', html) if r: raise Exception() ''' r = re.search('<video\sid.+?>(.+?)</video>', html, re.DOTALL).group(1) sources = re.compile('<source.+?src\s*=\s*[\'"](.+?)[\'"].+?data-res\s*=\s*[\'"](.+?)[\'"].*?/>').findall(r) sources = [(i[0], int(re.sub('[^0-9]', '', i[1]))) for i in sources] sources = sorted(sources, key=lambda k: k[1]) stream_url = sources[-1][0] if stream_url.startswith('//'): stream_url = 'http:' + stream_url return stream_url except: pass raise UrlResolver.ResolverError('File not found') def get_url(self, host, media_id): return 'http://uptobox.com/%s' % media_id def get_stream_url(self, host, media_id): return 'http://uptostream.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host
class UpToBoxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uptobox" domains = ["uptobox.com", "uptostream.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http[s]*://(upto(?:box|stream)\.com)/([a-zA-Z0-9]+)' self.user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko' self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): """ return url for uptostream, less country restrictions and no time limit on link generation (90%+ of random links tested had streaming links) check if file has not been made available for streaming in get_media_url and fail-back to uptobox if necessary """ return 'http://uptostream.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'This file is not available to stream yet' in html: web_url = 'http://uptobox.com/%s' % media_id self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'Uptobox.com is not available in your country' in html: raise UrlResolver.ResolverError( 'Uptobox.com is not available in your country') else: r = re.search( '(You have to wait (?:[0-9]+ minute[s]*, )*[0-9]+ second[s]*)', html) if r: raise UrlResolver.ResolverError(r.group(1)) r = re.search('<form\sname\s*=[\'"]F1[\'"].+?>(.+?)<br\s*/*>', html, re.DOTALL) if r: r = r.group(1) form_data = {} form_inputs = re.compile( 'input\stype\s*=\s*[\'"]hidden[\'"]\sname\s*=\s*[\'"](.+?)[\'"]\svalue\s*=\s*[\'"](.+?)[\'"]\s*>' ).findall(r) if form_inputs: for key, value in form_inputs: form_data[key] = value html = self.net.http_POST(web_url, form_data=form_data, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') r = re.search( '<a\shref\s*=[\'"](.+?)[\'"]\s*>\s*<span\sclass\s*=\s*[\'"]button_upload green[\'"]\s*>', html) if r: stream_url = r.group(1) else: r = re.search('<video\sid.+?>(.+?)</video>', html, re.DOTALL) if r: r = r.group(1) sources = re.compile( '<source.+?src\s*=\s*[\'"](.+?)[\'"].+?data-res\s*=\s*[\'"](.+?)[\'"].*?/>' ).findall(r) if sources: if len(sources) == 1: stream_url = sources[0][0] elif len(sources) > 1: vid_list = [] for source, quality in sources: vid_list.extend(['Uptobox - %s' % quality]) if self.get_setting('auto_pick') == 'true': stream_url = sources[-1][0] else: result = xbmcgui.Dialog().select( 'Choose Quality', vid_list) if result != -1: stream_url = sources[result][0] else: raise UrlResolver.ResolverError( 'No quality selected') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found') def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % ( self.__class__.__name__) return xml
class UpToBoxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uptobox" domains = ["uptobox.com", "uptostream.com"] def __init__(self): p = self.get_setting("priority") or 100 self.priority = int(p) self.net = Net() self.pattern = "http[s]*://(upto(?:box|stream)\.com)/([a-zA-Z0-9]+)" self.user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko" self.net.set_user_agent(self.user_agent) self.headers = {"User-Agent": self.user_agent} def get_url(self, host, media_id): """ return url for uptostream, less country restrictions and no time limit on link generation (90%+ of random links tested had streaming links) check if file has not been made available for streaming in get_media_url and fail-back to uptobox if necessary """ return "http://uptostream.com/%s" % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting("enabled") == "false": return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers["Referer"] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode("utf-8", "ignore") if "This file is not available to stream yet" in html: web_url = "http://uptobox.com/%s" % media_id self.headers["Referer"] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode("utf-8", "ignore") if "Uptobox.com is not available in your country" in html: raise UrlResolver.ResolverError("Uptobox.com is not available in your country") else: r = re.search("(You have to wait (?:[0-9]+ minute[s]*, )*[0-9]+ second[s]*)", html) if r: raise UrlResolver.ResolverError(r.group(1)) r = re.search("<form\sname\s*=['\"]F1['\"].+?>(.+?)<br\s*/*>", html, re.DOTALL) if r: r = r.group(1) form_data = {} form_inputs = re.compile( "input\stype\s*=\s*['\"]hidden['\"]\sname\s*=\s*['\"](.+?)['\"]\svalue\s*=\s*['\"](.+?)['\"]\s*>" ).findall(r) if form_inputs: for key, value in form_inputs: form_data[key] = value html = self.net.http_POST(web_url, form_data=form_data, headers=self.headers).content if isinstance(html, unicode): html = html.encode("utf-8", "ignore") r = re.search( "<a\shref\s*=['\"](.+?)['\"]\s*>\s*<span\sclass\s*=\s*['\"]button_upload green['\"]\s*>", html ) if r: stream_url = r.group(1) else: r = re.search("<video\sid.+?>(.+?)</video>", html, re.DOTALL) if r: r = r.group(1) sources = re.compile( "<source.+?src\s*=\s*['\"](.+?)['\"].+?data-res\s*=\s*['\"](.+?)['\"].*?/>" ).findall(r) if sources: if len(sources) == 1: stream_url = sources[0][0] elif len(sources) > 1: vid_list = [] for source, quality in sources: vid_list.extend(["Uptobox - %s" % quality]) if self.get_setting("auto_pick") == "true": stream_url = sources[-1][0] else: result = xbmcgui.Dialog().select("Choose Quality", vid_list) if result != -1: stream_url = sources[result][0] else: raise UrlResolver.ResolverError("No quality selected") if stream_url: return stream_url else: raise UrlResolver.ResolverError("File not found") def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += ( '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % (self.__class__.__name__) ) return xml
##xxxstreams Module by mediafountain 2016-02 import urllib, urllib2, re, xbmcplugin, xbmcgui, xbmcaddon, sys, main, xbmc, os, cgi import urlresolver from t0mm0.common.net import Net net = Net() artwork = main.artwork base_url = 'http://xxxstreams.org' settings = main.settings net.set_user_agent( 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0' ) def CATEGORIES(): main.addDir('Search', 'none', 'xxxstreamsSearch', artwork + '/main/search.png') main.addDir('Newest Videos', base_url + '/new-p**n-streaming/page/0', 'xxxstreamsIndex', artwork + '/main/recentvideos.png') main.addDir('Full Movies', base_url + '/full-p**n-movie-stream/page/0', 'xxxstreamsIndex', artwork + '/main/recentvideos.png') main.addDir('HD', base_url + '/tag/hd/page/0', 'xxxstreamsIndex', artwork + '/main/recentvideos.png') link = net.http_GET(base_url).content match1 = re.compile( 'menu-item menu-item-type-(taxonomy|custom).*?<a href=[\'|"](http://xxxstreams.org.+?)[\'|"]\s*>(.+?)<', re.S).findall(link) if len(match1) > 0: cat = [] for (x, Url, Title) in match1:
class AaaaGoogleResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_googlevideo" domains = ["googlevideo.com", "picasaweb.google.com", "googleusercontent.com", "plus.google.com", "googledrive.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.pattern = 'http[s]*://(.*?(?:\.googlevideo|(?:picasaweb|plus)\.google|google(?:usercontent|drive))\.com)/(.*?(?:videoplayback\?|\?authkey|host/)*.+)' self.net = Net() self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'https://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = '' vid_sel = web_url if ('picasaweb.' in host) or ('plus.' in host): vid_sel = '' videos = [] vid_id = re.search('(?:.*?#|.+/)(.+?)(?:\?|$)', web_url) if vid_id: vid_id = vid_id.group(1) resp = self.net.http_GET(web_url, headers=self.headers) if 'picasaweb.' in host: html = re.search('\["shared_group_' + re.escape(vid_id) + '"\](.+?),"ccOverride":"false"}', resp.content, re.DOTALL) if html: videos = re.compile(',{"url":"(https://.+?\.google(?:video|usercontent)\.com/.+?)","height":([0-9]+?),"width":([0-9]+?),"type":"video/.+?"}').findall(html.group(1)) elif 'plus.' in host: html = re.search('"' + re.escape(vid_id) + '",\[\](.+?),"https://video.googleusercontent.com/.*?"', resp.content, re.DOTALL) if html: temp = re.compile('\[(\d+),(\d+),(\d+),"(.+?)"\]').findall(html.group(1)) if temp: for i, w, h, v in temp: videos.append([str(v).replace('\\u003d', '='), int(h)]) vid_list = [] url_list = [] best = 0 quality = 0 if videos: if len(videos) > 1: for index, video in enumerate(videos): if int(video[1]) > quality: best = index quality = int(video[1]) vid_list.extend(['GoogleVideo - %sp' % quality]) url_list.extend([video[0]]) if len(videos) == 1: vid_sel = videos[0][0] else: if self.get_setting('auto_pick') == 'true': vid_sel = url_list[best] else: result = xbmcgui.Dialog().select('Choose a link', vid_list) if result != -1: vid_sel = url_list[result] else: raise UrlResolver.ResolverError('No link selected') if vid_sel: if ('redirector.' in vid_sel) or ('googleusercontent' in vid_sel): stream_url = urllib2.urlopen(vid_sel).geturl() elif 'google' in vid_sel: stream_url = vid_sel if stream_url: return self.__add_headers_for_kodi(stream_url) raise UrlResolver.ResolverError('File not found') def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % (self.__class__.__name__) return xml def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)
class UpToBoxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uptobox" domains = ["uptobox.com", "uptostream.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http[s]*://(upto(?:box|stream)\.com)/([a-zA-Z0-9]+)' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): """ return url for uptostream, less country restrictions and no time limit on link generation (90%+ of random links tested had streaming links) check if file has not been made available for streaming in get_media_url and fail-back to uptobox if necessary """ return 'http://uptostream.com/%s' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) stream_url = None self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'This file is not available to stream yet' in html: web_url = 'http://uptobox.com/%s' % media_id self.headers['Referer'] = web_url html = self.net.http_GET(web_url, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') if 'Uptobox.com is not available in your country' in html: raise UrlResolver.ResolverError('Uptobox.com is not available in your country') else: r = re.search('(You have to wait (?:[0-9]+ minute[s]*, )*[0-9]+ second[s]*)', html) if r: raise UrlResolver.ResolverError(r.group(1)) r = re.search('<form\sname\s*=[\'"]F1[\'"].+?>(.+?)<br\s*/*>', html, re.DOTALL) if r: r = r.group(1) form_data = {} form_inputs = re.compile('input\stype\s*=\s*[\'"]hidden[\'"]\sname\s*=\s*[\'"](.+?)[\'"]\svalue\s*=\s*[\'"](.+?)[\'"]\s*>').findall(r) if form_inputs: for key, value in form_inputs: form_data[key] = value html = self.net.http_POST(web_url, form_data=form_data, headers=self.headers).content if isinstance(html, unicode): html = html.encode('utf-8', 'ignore') r = re.search('<a\shref\s*=[\'"](.+?)[\'"]\s*>\s*<span\sclass\s*=\s*[\'"]button_upload green[\'"]\s*>', html) if r: stream_url = r.group(1) else: r = re.search('<video\sid.+?>(.+?)</video>', html, re.DOTALL) if r: r = r.group(1) sources = re.compile('<source.+?src\s*=\s*[\'"](.+?)[\'"].+?data-res\s*=\s*[\'"](.+?)[\'"].*?/>').findall(r) if sources: if len(sources) == 1: stream_url = sources[0][0] elif len(sources) > 1: vid_list = [] for source, quality in sources: vid_list.extend(['Uptobox - %s' % quality]) if self.get_setting('auto_pick') == 'true': stream_url = sources[-1][0] else: result = xbmcgui.Dialog().select('Choose Quality', vid_list) if result != -1: stream_url = sources[result][0] else: raise UrlResolver.ResolverError('No quality selected') if stream_url: return stream_url else: raise UrlResolver.ResolverError('File not found') def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '<setting id="%s_auto_pick" type="bool" label="Automatically pick best quality" default="false" visible="true"/>' % (self.__class__.__name__) return xml
import urllib,urllib2,re,xbmcplugin,xbmcgui,xbmc, xbmcaddon, os, sys import downloader import extract import time import shutil from resources.modules import main addon_id = 'plugin.video.supaboxupdater' try: from t0mm0.common.addon import Addon except: from t0mm0_common_addon import Addon addon = main.addon try: from t0mm0.common.net import Net except: from t0mm0_common_net import Net net = Net() settings = xbmcaddon.Addon(id=addon_id) net.set_user_agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'); #==========================Help updater===================================================================================================== def HELPCATEGORIES(): if ((XBMCversion['Ver'] in ['','']) or (int(XBMCversion['two']) < 12)) and (settings.getSetting('bypass-xbmcversion')=='false'): eod(); addon.show_ok_dialog(["Compatibility Issue: Outdated Supabox Setup","Please upgrade to a newer version of Supabox first!","Visit Supaboxtv.COM for Support!"], title="XBMC "+XBMCversion['Ver'], is_error=False); DoA('Back'); else: link=OPEN_URL('http://andersonflagg.com/updater.txt').replace('\n','').replace('\r','') match=re.compile('name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?escription="(.+?)".+?ype="(.+?)".+?uth="(.+?)"').findall(link) for name,url,iconimage,fanart,description,filetype,auth in match: #if 'status' in filetype: #main.addHELPDir(name,url,'updaterstatus',iconimage,fanart,description,filetype) #else: if auth == 'ok' or xxxcheck() is False:
class AaaaZeroCastResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "si_zerocast" domains = ["zerocast.tv"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() self.pattern = 'http://.*?(zerocast\.tv)/((?:embed|(?:channels/)*chan(?:nel)*)\.php\?.*(?:a=[0-9]+|chan=[a-zA-Z0-9]+).*)' self.user_agent = common.IE_USER_AGENT self.net.set_user_agent(self.user_agent) self.headers = {'User-Agent': self.user_agent} def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() else: return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match(self.pattern, url) or host in self.domains def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) self.headers['Referer'] = web_url stream_url = None if 'chan=' in web_url: html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('<script\stype=[\'"]text/javascript[\'"]\ssrc=[\'"](.+?)[\'"]>', html) if r: web_url = r.group(1) r = re.search('.+?a=([0-9]+).+', web_url) if r: web_url = 'http://zerocast.tv/embed.php?a=%s&id=&width=640&height=480&autostart=true&strech=' % r.group(1) html = self.net.http_GET(web_url, headers=self.headers).content r = re.search('file\s*:\s*["\'](.+?)["\']', html) if r: stream_url = r.group(1) else: r = re.search('curl\s*=\s*[\'"](.+?)[\'"]', html) if r: try: stream_url = r.group(1).decode('base64', 'strict') except Exception: raise UrlResolver.ResolverError('Failed to decode url') if stream_url: if stream_url.startswith('http'): stream_url = self.__add_headers_for_kodi(stream_url) return stream_url else: raise UrlResolver.ResolverError('File not found') def __add_headers_for_kodi(self, url): _referer = urllib.quote_plus('http://%s/' % self.domains[0]) _user_agent = urllib.quote_plus(self.net._user_agent) _connection_timeout = '60' _cookies = '' for _cookie in self.net._cj: _cookies += urllib.quote_plus('%s=%s;' % (_cookie.name, _cookie.value)) if _cookies: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s&Cookie=%s' % \ (url, _referer, _user_agent, _connection_timeout, _cookies) else: return '%s|Referer=%s&User-Agent=%s&Connection-Timeout=%s' % \ (url, _referer, _user_agent, _connection_timeout)