From 059ffcfbe19d0d56e6a2aba25e2b0e2017b203d6 Mon Sep 17 00:00:00 2001 From: Rogerthis <> Date: Tue, 14 Feb 2012 17:27:43 -0500 Subject: [PATCH 0001/1360] Gorillavid.com resolver by Rogerthis --- lib/urlresolver/plugins/gorillavid.py | 85 +++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 lib/urlresolver/plugins/gorillavid.py diff --git a/lib/urlresolver/plugins/gorillavid.py b/lib/urlresolver/plugins/gorillavid.py new file mode 100644 index 00000000..3d5e9f96 --- /dev/null +++ b/lib/urlresolver/plugins/gorillavid.py @@ -0,0 +1,85 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common + +# Custom imports +import re + + +class GorillavidResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "gorillavid" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://gorillavid.com/vb80o1esx2eb + self.pattern = 'http://((?:www.)?gorillavid.com)/([0-9a-zA-Z]+)' + + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + """ Human Verification """ + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + print post_url + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + print 'form_values' + print form_values + + html = self.net.http_POST(post_url, form_data=form_values).content + #print html + + except urllib2.URLError, e: + common.addon.log_error('gorillavid: got http error %d fetching %s' % + (e.code, web_url)) + return False + + + r = re.search('{ file: "(.+?)", type:"video/flv" }', html) + print r + if r: + return r.group(1) + + return False + + def get_url(self, host, media_id): + return 'http://gorillavid.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.match(self.pattern, url) or self.name in host \ No newline at end of file From de24818b1b8a35cf621aa5f73312d633e1124e1b Mon Sep 17 00:00:00 2001 From: Rogerthis Date: Wed, 15 Feb 2012 17:25:21 -0500 Subject: [PATCH 0002/1360] New resolvers by Rogerthis --- lib/urlresolver/plugins/daclips.py | 89 +++++++++++ lib/urlresolver/plugins/filebox.py | 84 +++++++++++ lib/urlresolver/plugins/filenuke.py | 142 ++++++++++++++++++ lib/urlresolver/plugins/movpod.py | 85 +++++++++++ .../lib/urlresolver/plugins/ufliq.py | 83 ++++++++++ 5 files changed, 483 insertions(+) create mode 100644 lib/urlresolver/plugins/daclips.py create mode 100644 lib/urlresolver/plugins/filebox.py create mode 100644 lib/urlresolver/plugins/filenuke.py create mode 100644 lib/urlresolver/plugins/movpod.py create mode 100644 script.module.urlresolver/lib/urlresolver/plugins/ufliq.py diff --git a/lib/urlresolver/plugins/daclips.py b/lib/urlresolver/plugins/daclips.py new file mode 100644 index 00000000..57f047fa --- /dev/null +++ b/lib/urlresolver/plugins/daclips.py @@ -0,0 +1,89 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common + +# Custom imports +import re + + +class DaclipsResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "daclips" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://daclips.com/vb80o1esx2eb + self.pattern = 'http://((?:www.)?daclips.com)/([0-9a-zA-Z]+)' + + + def get_media_url(self, host, media_id): + + web_url = self.get_url(host, media_id) + #print web_url + + """ Human Verification """ + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + #print post_url + + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + + html = self.net.http_POST(post_url, form_data=form_values).content + print html + + except urllib2.URLError, e: + common.addon.log_error('daclips: got http error %d fetching %s' % + (e.code, web_url)) + return False + + + r = re.search('file:"(.+?)"', html) + + if r: + return r.group(1)+'.flv' + + return False + + def get_url(self, host, media_id): + #return 'http://(daclips|daclips).(in|com)/%s' % (media_id) + return 'http://daclips.in/%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.match(self.pattern, url) or self.name in host \ No newline at end of file diff --git a/lib/urlresolver/plugins/filebox.py b/lib/urlresolver/plugins/filebox.py new file mode 100644 index 00000000..d13c94c1 --- /dev/null +++ b/lib/urlresolver/plugins/filebox.py @@ -0,0 +1,84 @@ + +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common +from lib import jsunpack + +# Custom imports +import re + + +class FileboxResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "filebox" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://www.filebox.com/embed-rw52re7f5aul.html + self.pattern = 'http://((?:www.)?filebox.com)/(?:embed-)?([0-9a-zA-Z]+)' + + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + print post_url + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(post_url, form_data=form_values).content + + + except urllib2.URLError, e: + common.addon.log_error('gorillavid: got http error %d fetching %s' % + (e.code, web_url)) + return False + + r = re.search('url: \'(.+?)\', autoPlay: false,onBeforeFinish:', html) + print r + if r: + return r.group(1) + + return False + + def get_url(self, host, media_id): + return 'http://www.filebox.com/embed-%s.html' % (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 self.name in host diff --git a/lib/urlresolver/plugins/filenuke.py b/lib/urlresolver/plugins/filenuke.py new file mode 100644 index 00000000..b31a89e1 --- /dev/null +++ b/lib/urlresolver/plugins/filenuke.py @@ -0,0 +1,142 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common +from lib import jsunpack + +# Custom imports +import re + + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "filenuke" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://www.filenuke.com/embed-rw52re7f5aul.html + self.pattern = 'http://((?:www.)?filenuke.com)/([0-9a-zA-Z]+)' + + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + print post_url + + form_values = {} + + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + form_values[u'usr_login'] = u'' + form_values[u'referer'] = u'' + form_values[u'op'] = u'download1' + print form_values + + + html = self.net.http_POST(post_url, form_data=form_values).content + + + except urllib2.URLError, e: + common.addon.log_error('filenuke: got http error %d fetching %s' % + (e.code, web_url)) + return False + + r = re.findall('return p}\(\'(.+?);\',\d+,\d+,\'(.+?)\'\.split',html) + if r: + p = r[1][0] + k = r[1][1] + else: + common.addon.log_error('filenuke: stream url not found') + return False + + decrypted_data = unpack_js(p, k) + print decrypted_data + print + + #First checks for a flv url, then the if statement is for the avi url + r = re.search('file.\',.\'(.+?).\'', decrypted_data) + if not r: + r = re.search('src="(.+?)"', decrypted_data) + if r: + stream_url = r.group(1) + else: + common.addon.log_error('filenuke: stream url not found') + return False + + return stream_url + + def get_url(self, host, media_id): + return 'http://www.filenuke.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.match(self.pattern, url) or self.name in host + +def unpack_js(p, k): + '''emulate js unpacking code''' + k = k.split('|') + for x in range(len(k) - 1, -1, -1): + if k[x]: + p = re.sub('\\b%s\\b' % base36encode(x), k[x], p) + return p + + +def base36encode(number, alphabet='0123456789abcdefghijklmnopqrstuvwxyz'): + """Convert positive integer to a base36 string. (from wikipedia)""" + if not isinstance(number, (int, long)): + raise TypeError('number must be an integer') + + # Special case for zero + if number == 0: + return alphabet[0] + + base36 = '' + + sign = '' + if number < 0: + sign = '-' + number = - number + + while number != 0: + number, i = divmod(number, len(alphabet)) + base36 = alphabet[i] + base36 + + return sign + base36 + diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py new file mode 100644 index 00000000..4865fb5f --- /dev/null +++ b/lib/urlresolver/plugins/movpod.py @@ -0,0 +1,85 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common + +# Custom imports +import re + + +class MovpodResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "movpod" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://movpod.com/vb80o1esx2eb + self.pattern = 'http://((?:www.)?movpod.net)/([0-9a-zA-Z]+)' + + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + #print web_url + + """ Human Verification """ + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + #print post_url + + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(post_url, form_data=form_values).content + + except urllib2.URLError, e: + common.addon.log_error('movpod: got http error %d fetching %s' % + (e.code, web_url)) + return False + + + r = re.search('file:"(.+?)"', html) + if r: + return r.group(1)+'.flv' + + return False + + def get_url(self, host, media_id): + #return 'http://(movpod|movpod).(in|com)/%s' % (media_id) + return 'http://movpod.in/%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.match(self.pattern, url) or self.name in host \ No newline at end of file diff --git a/script.module.urlresolver/lib/urlresolver/plugins/ufliq.py b/script.module.urlresolver/lib/urlresolver/plugins/ufliq.py new file mode 100644 index 00000000..b4c4f474 --- /dev/null +++ b/script.module.urlresolver/lib/urlresolver/plugins/ufliq.py @@ -0,0 +1,83 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common +from lib import jsunpack + +# Custom imports +import re + + +class UfliqResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "ufliq" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://www.ufliq.com/embed-rw52re7f5aul.html + self.pattern = 'http://((?:www.)?ufliq.com)/(?:embed-)?([0-9a-zA-Z]+)' + + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + print post_url + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(post_url, form_data=form_values).content + + + except urllib2.URLError, e: + common.addon.log_error('gorillavid: got http error %d fetching %s' % + (e.code, web_url)) + return False + + r = re.search('url: \'(.+?)\', autoPlay: false,onBeforeFinish:', html) + print r + if r: + return r.group(1) + + return False + + def get_url(self, host, media_id): + return 'http://www.ufliq.com/embed-%s.html' % (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 self.name in host From f886bdc32fe59fb9c14fd1610a7f7cbcdf941af5 Mon Sep 17 00:00:00 2001 From: Zach Guzman Date: Wed, 15 Feb 2012 17:29:46 -0500 Subject: [PATCH 0003/1360] Remove bad ufliq import --- .../lib/urlresolver/plugins/ufliq.py | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 script.module.urlresolver/lib/urlresolver/plugins/ufliq.py diff --git a/script.module.urlresolver/lib/urlresolver/plugins/ufliq.py b/script.module.urlresolver/lib/urlresolver/plugins/ufliq.py deleted file mode 100644 index b4c4f474..00000000 --- a/script.module.urlresolver/lib/urlresolver/plugins/ufliq.py +++ /dev/null @@ -1,83 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -from t0mm0.common.net import Net -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import urllib2 -from urlresolver import common -from lib import jsunpack - -# Custom imports -import re - - -class UfliqResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "ufliq" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - #e.g. http://www.ufliq.com/embed-rw52re7f5aul.html - self.pattern = 'http://((?:www.)?ufliq.com)/(?:embed-)?([0-9a-zA-Z]+)' - - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - try: - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() - print post_url - - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2) - - html = self.net.http_POST(post_url, form_data=form_values).content - - - except urllib2.URLError, e: - common.addon.log_error('gorillavid: got http error %d fetching %s' % - (e.code, web_url)) - return False - - r = re.search('url: \'(.+?)\', autoPlay: false,onBeforeFinish:', html) - print r - if r: - return r.group(1) - - return False - - def get_url(self, host, media_id): - return 'http://www.ufliq.com/embed-%s.html' % (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 self.name in host From 2967ebe893be5a940f4abef0ab5e0a926d3db839 Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Sat, 18 Feb 2012 16:18:26 -0500 Subject: [PATCH 0004/1360] Added real-debrid.com support --- lib/urlresolver/plugins/realdebrid.py | 145 ++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 lib/urlresolver/plugins/realdebrid.py diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py new file mode 100644 index 00000000..350b1b9b --- /dev/null +++ b/lib/urlresolver/plugins/realdebrid.py @@ -0,0 +1,145 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import os +import random +import re +import urllib, urllib2 + +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import SiteAuth +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from urlresolver import common +import xbmc +import cookielib + + +class RealDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): + implements = [UrlResolver, SiteAuth, PluginSettings] + name = "realdebrid" + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, '%s.cookies' % name) + media_url = None + allHosters = None + + def __init__(self): + p = self.get_setting('priority') or 1 + self.priority = int(p) + try: + os.makedirs(os.path.dirname(self.cookie_file)) + except OSError: + pass + + def GetURL(self, url): + #print 'processing url: '+url + + # use cookie, if logged in. + if self.cookie_file is not None and os.path.exists(self.cookie_file): + cj = cookielib.LWPCookieJar() + cj.load(self.cookie_file) + req = urllib2.Request(url) + req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') + opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) + response = opener.open(req) + + #check if we might have been redirected (megapremium Direct Downloads...) + finalurl = response.geturl() + + #if we weren't redirected, return the page source + if finalurl is url: + link=response.read() + response.close() + return link + + #if we have been redirected, return the redirect url + elif finalurl is not url: + return finalurl + + + #UrlResolver methods + def get_media_url(self, host, media_id): + print 'in get_media_url %s' % media_id + url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id + source = self.GetURL(url) + print '************* %s' % source + if source == 'Your file is unavailable on the hoster.': + return None + if re.search('This hoster is not included in our free offer', source): + return None + link =re.compile('ok"> Date: Sun, 19 Feb 2012 23:23:26 -0500 Subject: [PATCH 0005/1360] Fixed login bug issue --- lib/urlresolver/plugins/realdebrid.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 350b1b9b..4008622c 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -114,18 +114,28 @@ def valid_url(self, url, host): def checkLogin(self): url = 'http://real-debrid.com/lib/api/account.php' source = self.GetURL(url) - if re.search('expiration', source): + if source is not None and re.search('expiration', source): return False else: return True #SiteAuth methods def login(self): - if self.checkLogin(): - login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : self.get_setting('password')}) + if self.checkLogin(): + cj = cookielib.LWPCookieJar() + login_data = urllib.urlencode({'user' : self.username, 'pass' : self.password}) url = 'https://real-debrid.com/ajax/login.php?' + login_data - print url - source = self.GetURL(url) + req = urllib2.Request(url) + req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') + cj = cookielib.LWPCookieJar() + opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) + + #do the login and get the response + response = opener.open(req) + source = response.read() + response.close() + cj.save(self.cookie_file) + print source if re.search('OK', source): return True else: From 28b3a74f54fba44396f942f8990e187491ed24f1 Mon Sep 17 00:00:00 2001 From: anilkuj Date: Tue, 21 Feb 2012 10:45:28 -0500 Subject: [PATCH 0006/1360] Fixed boundary conditions for valid_url method --- lib/urlresolver/plugins/realdebrid.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 4008622c..ab3d184b 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -103,6 +103,8 @@ def get_all_hosters(self): def valid_url(self, url, host): print 'in valid_url %s : %s' % (url, host) tmp = re.compile('//(.+?)/').findall(url) + if len(tmp) == 0: + return False print 'r is %s ' % tmp[0] domain = tmp[0].replace('www.', '') print 'domain is %s ' % domain From 1f38cbf16e23fab437a51efaf6acca7cabf5de5e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 25 Feb 2012 05:48:34 -0500 Subject: [PATCH 0007/1360] Added veoh support --- lib/urlresolver/plugins/veoh.py | 91 +++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 lib/urlresolver/plugins/veoh.py diff --git a/lib/urlresolver/plugins/veoh.py b/lib/urlresolver/plugins/veoh.py new file mode 100644 index 00000000..5d696905 --- /dev/null +++ b/lib/urlresolver/plugins/veoh.py @@ -0,0 +1,91 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 anilkuj + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from t0mm0.common.net import Net +import urllib2 +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin + +class VeohResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "veoh" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + + def get_media_url(self, host, media_id): + + print 'host %s media_id %s' %(host, media_id) +## url = 'http://www.veoh.com/rest/video/'+media_id+'/details' +## html = net.http_GET(url).content +## if html == "" +## print 'coult not obtain video url' +## return False +## file = re.compile('fullPreviewHashLowPath="(.+?)"').findall(html) +## if len(file) == 0 +## print 'coult not obtain video url' +## return False + + html = net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse") + if re.search('This video is not available on mobile', html): + print 'could not obtain video url' + return False + + re.compile("watchNow\('(.+?)'").findall(html) + if (len(re) > 0 ): + return re[0] + + print 'could not obtain video url' + return False + + + def get_url(self, host, media_id): + return 'http://veoh.com/watch/%s' % media_id + + + def get_host_and_id(self, url): + r = None + video_id = None + + if re.search('permalinkId=', url) + r = re.compile('permalinkId=(.+?)').findall(url) + elif re.search('watch/', url) + r = re.compile('watch/(.+?)').findall(url) + + if r is not None and len(r) > 0: + video_id = r[0] + + if video_id: + return ('veoh.com', video_id) + else: + common.addon.log_error('veoh: video id not found') + return False + + def valid_url(self, url, host): + return re.match('http://(.+)?veoh.com/[0-9]+', + url) or 'veoh' in host + + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += '\n' + return xml From 4be492cc08cd6a67ace3804dd22087f7c1a3fcdb Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 26 Feb 2012 12:02:17 -0500 Subject: [PATCH 0008/1360] Added support for veoh. Disabled hostingbulk (isValid returnd false ) and added vidpe which handles hostingbulk, hostingcup and vidpe --- lib/urlresolver/plugins/hostingbulk.py | 78 ++++++++++++++++++ lib/urlresolver/plugins/veoh.py | 15 ++-- lib/urlresolver/plugins/vidpe.py | 105 +++++++++++++++++++++++++ 3 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 lib/urlresolver/plugins/hostingbulk.py create mode 100644 lib/urlresolver/plugins/vidpe.py diff --git a/lib/urlresolver/plugins/hostingbulk.py b/lib/urlresolver/plugins/hostingbulk.py new file mode 100644 index 00000000..395af285 --- /dev/null +++ b/lib/urlresolver/plugins/hostingbulk.py @@ -0,0 +1,78 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 anilkuj + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from t0mm0.common.net import Net +import urllib2 +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin + +class hostingbulkResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + + def get_media_url(self, host, media_id): + + print 'host %s media_id %s' %(host, media_id) + html = net.http_GET("http://www.hostingbulk.com/" + media_id + ".html").content + m = re.match('addParam|(?P)|(?P)|(?P)|(?P)|(?P).+?video|(?P)|',html) + if (len(m) > 0 ): + videoLink = 'http://'+m.group("ip1")+'.'+m.group("ip2")+'.'+m.group("ip3")+'.'+m.group("ip4")+':'+m.group("port")+'/d/'+m.group("file")+'/video.flv?start=0' + print 'video id is %' % videoLink + return videoLink + + print 'could not obtain video url' + return False + + + def get_url(self, host, media_id): + return 'http://hostingbulk.com/%s' % media_id + + + def get_host_and_id(self, url): + r = None + video_id = None + + if re.search('embed-', url): + r = re.compile('embed-(.+?).html').findall(url) + elif re.search('watch/', url): + r = re.compile('.com/(.+?).html').findall(url) + + if r is not None and len(r) > 0: + video_id = r[0] + + if video_id: + return ('hostingbulk.com', video_id) + else: + common.addon.log_error('hostingbulk: video id not found') + return False + + def valid_url(self, url, host): + #return re.match('http://(.+)?hostingbulk.com/[0-9]+', url) or 'hostingbulk' in host + return False + + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += '\n' + return xml diff --git a/lib/urlresolver/plugins/veoh.py b/lib/urlresolver/plugins/veoh.py index 5d696905..c70175f1 100644 --- a/lib/urlresolver/plugins/veoh.py +++ b/lib/urlresolver/plugins/veoh.py @@ -31,6 +31,7 @@ class VeohResolver(Plugin, UrlResolver, PluginSettings): def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) + self.net = Net() def get_media_url(self, host, media_id): @@ -45,14 +46,14 @@ def get_media_url(self, host, media_id): ## print 'coult not obtain video url' ## return False - html = net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse") + html = self.net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse").content if re.search('This video is not available on mobile', html): print 'could not obtain video url' return False - re.compile("watchNow\('(.+?)'").findall(html) - if (len(re) > 0 ): - return re[0] + r = re.compile("watchNow\('(.+?)'").findall(html) + if (len(r) > 0 ): + return r[0] print 'could not obtain video url' return False @@ -66,9 +67,9 @@ def get_host_and_id(self, url): r = None video_id = None - if re.search('permalinkId=', url) - r = re.compile('permalinkId=(.+?)').findall(url) - elif re.search('watch/', url) + if re.search('permalinkId=', url): + r = re.compile('permalinkId=(.+?)(&)').findall(url) + elif re.search('watch/', url): r = re.compile('watch/(.+?)').findall(url) if r is not None and len(r) > 0: diff --git a/lib/urlresolver/plugins/vidpe.py b/lib/urlresolver/plugins/vidpe.py new file mode 100644 index 00000000..427d9837 --- /dev/null +++ b/lib/urlresolver/plugins/vidpe.py @@ -0,0 +1,105 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 anilkuj + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from t0mm0.common.net import Net +import urllib2 +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from vidxden import unpack_js + + +class vidpeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + + def __init__(self): + p = self.get_setting('priority') or 100 + self.net = Net() + self.priority = int(p) + + def get_media_url(self, host, media_id): + print '******* vidpe: in get_media_url' + web_url = self.get_url(host, media_id) + try: + html = self.net.http_GET(web_url).content + except urllib2.URLError, e: + common.addon.log_error(self.name + '- got http error %d fetching %s' % + (e.code, web_url)) + return False + + page = ''.join(html.splitlines()).replace('\t','') + r = re.search("return p\}\(\'(.+?)\',\d+,\d+,\'(.+?)\'", page) + if r: + p, k = r.groups() + else: + common.addon.log_error(self.name + '- packed javascript embed code not found') + return False + + decrypted_data = unpack_js(p, k) + r = re.search('file.\',.\'(.+?).\'', decrypted_data) + if not r: + r = re.search('src="(.+?)"', decrypted_data) + if r: + stream_url = r.group(1) + else: + common.addon.log_error(self.name + '- stream url not found') + return False + + return stream_url + + + def get_url(self, host, media_id): + return 'http://'+host+'/%s' % media_id + + + def get_host_and_id(self, url): + r = None + video_id = None + + if re.search('embed-', url): + r = re.compile('embed-(.+?).html').findall(url) + elif re.search('.com/', url): + r = re.compile('.com/(.+?).html').findall(url) + + if r is not None and len(r) > 0: + video_id = r[0] + print 'video id is %s' % video_id + if video_id: + return (self.get_domain(url), video_id) + else: + common.addon.log_error('host: video id not found') + return False + + def get_domain(self, url): + tmp = re.compile('//(.+?)/').findall(url) + if len(tmp) == 0: + return False + domain = tmp[0].replace('www.', '') + print 'domain is %s ' % domain + return domain + + def valid_url(self, url, host): + return re.match('http://(.+)?(vidpe|hostingcup|hostingbulk).com/[0-9]+', url) or 'vidpe' in host or 'hostingbulk' in host or 'hostingcup' in host + + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += '\n' + return xml From db7af69b5b38c4c1ebbf58ab3fc6db7506bab55a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 26 Feb 2012 23:48:02 -0500 Subject: [PATCH 0009/1360] Changes to handle embedded video url's --- lib/urlresolver/plugins/veoh.py | 11 +++++------ lib/urlresolver/plugins/vidpe.py | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/urlresolver/plugins/veoh.py b/lib/urlresolver/plugins/veoh.py index c70175f1..39bcb20d 100644 --- a/lib/urlresolver/plugins/veoh.py +++ b/lib/urlresolver/plugins/veoh.py @@ -34,7 +34,7 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - + print 'veoh resolver: in get_media_url' print 'host %s media_id %s' %(host, media_id) ## url = 'http://www.veoh.com/rest/video/'+media_id+'/details' ## html = net.http_GET(url).content @@ -66,11 +66,11 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = None video_id = None - + print 'veoh resolver: in get_host_and_id %s ' % url if re.search('permalinkId=', url): - r = re.compile('permalinkId=(.+?)(&)').findall(url) + r = re.compile('permalinkId=(.+)').findall(url) elif re.search('watch/', url): - r = re.compile('watch/(.+?)').findall(url) + r = re.compile('watch/(.+)').findall(url) if r is not None and len(r) > 0: video_id = r[0] @@ -82,8 +82,7 @@ def get_host_and_id(self, url): return False def valid_url(self, url, host): - return re.match('http://(.+)?veoh.com/[0-9]+', - url) or 'veoh' in host + return re.search('www.veoh.com/watch/.+',url) or re.search('www.veoh.com/.+?permalinkId=.+',url) or 'veoh' in host def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) diff --git a/lib/urlresolver/plugins/vidpe.py b/lib/urlresolver/plugins/vidpe.py index 427d9837..9615f2fe 100644 --- a/lib/urlresolver/plugins/vidpe.py +++ b/lib/urlresolver/plugins/vidpe.py @@ -70,17 +70,17 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): + print 'vidpe resolver: in get_host_and_id %s' % url r = None video_id = None if re.search('embed-', url): - r = re.compile('embed-(.+?).html').findall(url) + r = re.compile('embed-(.+?)-|.html').findall(url) elif re.search('.com/', url): r = re.compile('.com/(.+?).html').findall(url) if r is not None and len(r) > 0: video_id = r[0] - print 'video id is %s' % video_id if video_id: return (self.get_domain(url), video_id) else: @@ -96,7 +96,7 @@ def get_domain(self, url): return domain def valid_url(self, url, host): - return re.match('http://(.+)?(vidpe|hostingcup|hostingbulk).com/[0-9]+', url) or 'vidpe' in host or 'hostingbulk' in host or 'hostingcup' in host + return re.search('http://(.+)?(vidpe|hostingcup|hostingbulk).com/.+?.html',url) or 'vidpe' in host or 'hostingbulk' in host or 'hostingcup' in host def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) From 91397d8e67ccb485dfb1fb6374e00bd84bd872fa Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 27 Feb 2012 22:10:49 -0500 Subject: [PATCH 0010/1360] Handled more veoh links --- lib/urlresolver/plugins/veoh.py | 35 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/urlresolver/plugins/veoh.py b/lib/urlresolver/plugins/veoh.py index 39bcb20d..a3fbbeac 100644 --- a/lib/urlresolver/plugins/veoh.py +++ b/lib/urlresolver/plugins/veoh.py @@ -36,28 +36,24 @@ def __init__(self): def get_media_url(self, host, media_id): print 'veoh resolver: in get_media_url' print 'host %s media_id %s' %(host, media_id) -## url = 'http://www.veoh.com/rest/video/'+media_id+'/details' -## html = net.http_GET(url).content -## if html == "" -## print 'coult not obtain video url' -## return False -## file = re.compile('fullPreviewHashLowPath="(.+?)"').findall(html) -## if len(file) == 0 -## print 'coult not obtain video url' -## return False html = self.net.http_GET("http://www.veoh.com/iphone/views/watch.php?id=" + media_id + "&__async=true&__source=waBrowse").content - if re.search('This video is not available on mobile', html): - print 'could not obtain video url' + if not re.search('This video is not available on mobile', html): + r = re.compile("watchNow\('(.+?)'").findall(html) + if (len(r) > 0 ): + return r[0] + + url = 'http://www.veoh.com/rest/video/'+media_id+'/details' + print 'url is %s' %url + html = self.net.http_GET(url).content + file = re.compile('fullPreviewHashPath="(.+?)"').findall(html) + + if len(file) == 0: + print 'coult not obtain video url' return False - r = re.compile("watchNow\('(.+?)'").findall(html) - if (len(r) > 0 ): - return r[0] - - print 'could not obtain video url' - return False - + print 'video link is %s' % file[0] + return file[0] def get_url(self, host, media_id): return 'http://veoh.com/watch/%s' % media_id @@ -68,13 +64,12 @@ def get_host_and_id(self, url): video_id = None print 'veoh resolver: in get_host_and_id %s ' % url if re.search('permalinkId=', url): - r = re.compile('permalinkId=(.+)').findall(url) + r = re.compile('veoh.com.+?permalinkId=(\w+)&*.*$').findall(url) elif re.search('watch/', url): r = re.compile('watch/(.+)').findall(url) if r is not None and len(r) > 0: video_id = r[0] - if video_id: return ('veoh.com', video_id) else: From 0025f50b5ab6ab11d70e2bf867c733817817616e Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Tue, 28 Feb 2012 13:26:48 -0500 Subject: [PATCH 0011/1360] fixed no sources issue --- lib/urlresolver/plugins/realdebrid.py | 65 ++++++++------------------- 1 file changed, 19 insertions(+), 46 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index ab3d184b..8e064be7 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -28,6 +28,7 @@ from urlresolver import common import xbmc import cookielib +from t0mm0.common.net import Net class RealDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): @@ -41,47 +42,24 @@ class RealDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): def __init__(self): p = self.get_setting('priority') or 1 self.priority = int(p) + self.net = Net() try: os.makedirs(os.path.dirname(self.cookie_file)) except OSError: pass - def GetURL(self, url): - #print 'processing url: '+url - - # use cookie, if logged in. - if self.cookie_file is not None and os.path.exists(self.cookie_file): - cj = cookielib.LWPCookieJar() - cj.load(self.cookie_file) - req = urllib2.Request(url) - req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') - opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) - response = opener.open(req) - - #check if we might have been redirected (megapremium Direct Downloads...) - finalurl = response.geturl() - - #if we weren't redirected, return the page source - if finalurl is url: - link=response.read() - response.close() - return link - - #if we have been redirected, return the redirect url - elif finalurl is not url: - return finalurl - - #UrlResolver methods def get_media_url(self, host, media_id): print 'in get_media_url %s' % media_id url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id - source = self.GetURL(url) + source = self.net.http_GET(url).content print '************* %s' % source if source == 'Your file is unavailable on the hoster.': return None if re.search('This hoster is not included in our free offer', source): return None + if re.search('No server is available for this hoster.', source): + return None link =re.compile('ok"> Date: Tue, 28 Feb 2012 14:20:56 -0500 Subject: [PATCH 0012/1360] returning valid error message to the user, Need to test this. --- lib/urlresolver/plugins/realdebrid.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 8e064be7..d454b12f 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -26,7 +26,7 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -import xbmc +import xbmc,xbmcplugin,xbmcgui,xbmcaddon, datetime import cookielib from t0mm0.common.net import Net @@ -53,12 +53,16 @@ def get_media_url(self, host, media_id): print 'in get_media_url %s' % media_id url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id source = self.net.http_GET(url).content + dialog = xbmcgui.Dialog() print '************* %s' % source if source == 'Your file is unavailable on the hoster.': + dialog.ok(' Real-Debrid ', ' Your file is unavailable on the hoster ', '', '') return None if re.search('This hoster is not included in our free offer', source): + dialog.ok(' Real-Debrid ', ' This hoster is not included in our free offer ', '', '') return None if re.search('No server is available for this hoster.', source): + dialog.ok(' Real-Debrid ', ' No server is available for this hoster ', '', '') return None link =re.compile('ok"> Date: Tue, 28 Feb 2012 20:00:29 -0500 Subject: [PATCH 0013/1360] Added Error Notifications --- lib/urlresolver/plugins/realdebrid.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index d454b12f..09da2729 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -53,8 +53,8 @@ def get_media_url(self, host, media_id): print 'in get_media_url %s' % media_id url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id source = self.net.http_GET(url).content - dialog = xbmcgui.Dialog() print '************* %s' % source + dialog = xbmcgui.Dialog() if source == 'Your file is unavailable on the hoster.': dialog.ok(' Real-Debrid ', ' Your file is unavailable on the hoster ', '', '') return None @@ -111,7 +111,6 @@ def login(self): if self.checkLogin(): login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : self.get_setting('password')}) url = 'https://real-debrid.com/ajax/login.php?' + login_data - print url source = self.net.http_GET(url).content if re.search('OK', source): self.net.save_cookies(self.cookie_file) From 29a6b0ac98ba3b5bed59fbcacd57b6b6de0778d6 Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Tue, 28 Feb 2012 21:00:54 -0500 Subject: [PATCH 0014/1360] handled non real-debrid users --- lib/urlresolver/plugins/realdebrid.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 09da2729..80cf618b 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -55,6 +55,10 @@ def get_media_url(self, host, media_id): source = self.net.http_GET(url).content print '************* %s' % source dialog = xbmcgui.Dialog() + + if re.search('Upgrade your account now to generate a link', source): + dialog.ok(' Real-Debrid ', ' Upgrade your account now to generate a link ', '', '') + return None if source == 'Your file is unavailable on the hoster.': dialog.ok(' Real-Debrid ', ' Your file is unavailable on the hoster ', '', '') return None @@ -83,6 +87,9 @@ def get_all_hosters(self): return self.allHosters def valid_url(self, url, host): + + if self.get_setting('login') == 'false': + return False print 'in valid_url %s : %s' % (url, host) tmp = re.compile('//(.+?)/').findall(url) print 'r is %s ' % tmp[0] From fb1fa0372a26096a76d8b218d35e4d82b65dd259 Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Tue, 28 Feb 2012 23:40:15 -0500 Subject: [PATCH 0015/1360] Handled boundary conditions and added better error messages --- lib/urlresolver/plugins/realdebrid.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 80cf618b..5388561a 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -50,7 +50,7 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): - print 'in get_media_url %s' % media_id + print 'in get_media_url %s : %s' % (host, media_id) url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id source = self.net.http_GET(url).content print '************* %s' % source @@ -92,11 +92,13 @@ def valid_url(self, url, host): return False print 'in valid_url %s : %s' % (url, host) tmp = re.compile('//(.+?)/').findall(url) - print 'r is %s ' % tmp[0] - domain = tmp[0].replace('www.', '') - print 'domain is %s ' % domain + domain = '' + if len(tmp) > 0 : + print 'r is %s ' % tmp[0] + domain = tmp[0].replace('www.', '') + print 'domain is %s ' % domain print 'allHosters is %s ' % self.get_all_hosters() - if re.search(domain, self.get_all_hosters()) is not None: + if (re.search(domain, self.get_all_hosters()) is not None) or (host in self.get_all_hosters()): print 'in if' return True else: From 9ab6e405db00f1e44fa759b0531668ca622fcee6 Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Wed, 29 Feb 2012 09:15:10 -0500 Subject: [PATCH 0016/1360] Handled the case where host is empty --- lib/urlresolver/plugins/realdebrid.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 5388561a..b0840052 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -94,11 +94,10 @@ def valid_url(self, url, host): tmp = re.compile('//(.+?)/').findall(url) domain = '' if len(tmp) > 0 : - print 'r is %s ' % tmp[0] domain = tmp[0].replace('www.', '') print 'domain is %s ' % domain print 'allHosters is %s ' % self.get_all_hosters() - if (re.search(domain, self.get_all_hosters()) is not None) or (host in self.get_all_hosters()): + if (domain in self.get_all_hosters()) or (len(host) > 0 and host in self.get_all_hosters()): print 'in if' return True else: From f887ebcda3628930e3c2cf639bcd44586d415b4b Mon Sep 17 00:00:00 2001 From: anilkuj Date: Wed, 29 Feb 2012 12:17:20 -0500 Subject: [PATCH 0017/1360] added isUniversal to indicate if a resolver is a universal resolver --- lib/urlresolver/plugnplay/interfaces.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/urlresolver/plugnplay/interfaces.py b/lib/urlresolver/plugnplay/interfaces.py index 49dcf557..fb9888a8 100644 --- a/lib/urlresolver/plugnplay/interfaces.py +++ b/lib/urlresolver/plugnplay/interfaces.py @@ -294,4 +294,14 @@ def get_setting(self, key): value = common.addon.get_setting('%s_%s' % (self.__class__.__name__, key)) return value + + + def isUniversal(): + ''' + You need to override this to return True, if you are implementing a univeral resolver + like real-debrid etc., which handles multiple hosts. + ''' + + return False + From 7ae2f60c1d160a764e660f5b5ad5b9010f88da72 Mon Sep 17 00:00:00 2001 From: anilkuj Date: Wed, 29 Feb 2012 12:19:20 -0500 Subject: [PATCH 0018/1360] overriding isUniversal to indicate that real-debrid is a universal resolver --- lib/urlresolver/plugins/realdebrid.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index b0840052..b66c6d57 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -139,3 +139,8 @@ def get_settings_xml(self): xml += ' Date: Wed, 29 Feb 2012 12:21:28 -0500 Subject: [PATCH 0019/1360] Added isUniversal to the UrlResolver interface to indicate if a resolver is an universal resolver --- lib/urlresolver/plugnplay/interfaces.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/urlresolver/plugnplay/interfaces.py b/lib/urlresolver/plugnplay/interfaces.py index fb9888a8..df8c66e7 100644 --- a/lib/urlresolver/plugnplay/interfaces.py +++ b/lib/urlresolver/plugnplay/interfaces.py @@ -179,6 +179,15 @@ def filter_urls(self, web_urls): if valid: ret_val.append(web_url) return + + + def isUniversal(self): + ''' + You need to override this to return True, if you are implementing a univeral resolver + like real-debrid etc., which handles multiple hosts. + ''' + + return False @@ -293,15 +302,4 @@ def get_setting(self, key): ''' value = common.addon.get_setting('%s_%s' % (self.__class__.__name__, key)) - return value - - - def isUniversal(): - ''' - You need to override this to return True, if you are implementing a univeral resolver - like real-debrid etc., which handles multiple hosts. - ''' - - return False - - + return value \ No newline at end of file From 07eccea5401887fc1a540cd0f0fa551a8f16952f Mon Sep 17 00:00:00 2001 From: anilkuj Date: Wed, 29 Feb 2012 14:19:42 -0500 Subject: [PATCH 0020/1360] Handling get_url for universal resolvers like real-debrid , when the host and media_id are passed --- lib/urlresolver/types.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 0aad4f26..83a1bcbb 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -75,13 +75,20 @@ def __init__(self, url='', host='', media_id='', title=''): if url and self._resolvers: self._host, self._media_id = self._resolvers[0].get_host_and_id(url) elif self._resolvers: - self._url = self._resolvers[0].get_url(host, media_id) + if self._resolvers[0].isUniversal(): + print 'HostedMedia isUniversal: In if' + if len(self._resolvers) > 1: + print 'HostedMedia isUniversal: In else' + self._url = self._resolvers[1].get_url(host, media_id) + else: + self._url = self._resolvers[0].get_url(host, media_id) if title: self.title = title else: self.title = self._host + def get_url(self): ''' From 8bd6ae9d97cd12a0d907ac08445e4155001d0744 Mon Sep 17 00:00:00 2001 From: anilkuj Date: Wed, 29 Feb 2012 14:22:00 -0500 Subject: [PATCH 0021/1360] Boundary condition check --- lib/urlresolver/types.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 83a1bcbb..02bf5de5 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -80,6 +80,7 @@ def __init__(self, url='', host='', media_id='', title=''): if len(self._resolvers) > 1: print 'HostedMedia isUniversal: In else' self._url = self._resolvers[1].get_url(host, media_id) + self._host, self._media_id = self._resolvers[0].get_host_and_id(self._url) else: self._url = self._resolvers[0].get_url(host, media_id) From 137d46c2c394d43e0fd8fb84b2e3a06567c63b24 Mon Sep 17 00:00:00 2001 From: anilkuj Date: Wed, 29 Feb 2012 15:11:17 -0500 Subject: [PATCH 0022/1360] Update lib/urlresolver/types.py --- lib/urlresolver/types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 02bf5de5..6a614e4a 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -83,7 +83,6 @@ def __init__(self, url='', host='', media_id='', title=''): self._host, self._media_id = self._resolvers[0].get_host_and_id(self._url) else: self._url = self._resolvers[0].get_url(host, media_id) - if title: self.title = title From a5b26451c13062b388b2987e34ad2987e82111f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Feb 2012 18:55:22 -0500 Subject: [PATCH 0023/1360] Handled case where real-debrid is the only resolver and the client addon only passes host and media id such resolvers will have to be removed since there is no way to reconstruct the host video url --- lib/urlresolver/plugins/realdebrid.py | 2 -- lib/urlresolver/plugnplay/interfaces.py | 4 ++-- lib/urlresolver/types.py | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index b66c6d57..dd07f2d4 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -98,10 +98,8 @@ def valid_url(self, url, host): print 'domain is %s ' % domain print 'allHosters is %s ' % self.get_all_hosters() if (domain in self.get_all_hosters()) or (len(host) > 0 and host in self.get_all_hosters()): - print 'in if' return True else: - print 'in else' return False def checkLogin(self): diff --git a/lib/urlresolver/plugnplay/interfaces.py b/lib/urlresolver/plugnplay/interfaces.py index df8c66e7..961a4ece 100644 --- a/lib/urlresolver/plugnplay/interfaces.py +++ b/lib/urlresolver/plugnplay/interfaces.py @@ -184,7 +184,7 @@ def filter_urls(self, web_urls): def isUniversal(self): ''' You need to override this to return True, if you are implementing a univeral resolver - like real-debrid etc., which handles multiple hosts. + like real-debrid etc., which handles multiple hosts ''' return False @@ -302,4 +302,4 @@ def get_setting(self, key): ''' value = common.addon.get_setting('%s_%s' % (self.__class__.__name__, key)) - return value \ No newline at end of file + return value diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 6a614e4a..85d727fb 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -76,11 +76,11 @@ def __init__(self, url='', host='', media_id='', title=''): self._host, self._media_id = self._resolvers[0].get_host_and_id(url) elif self._resolvers: if self._resolvers[0].isUniversal(): - print 'HostedMedia isUniversal: In if' if len(self._resolvers) > 1: - print 'HostedMedia isUniversal: In else' self._url = self._resolvers[1].get_url(host, media_id) self._host, self._media_id = self._resolvers[0].get_host_and_id(self._url) + else: + self._resolvers = [] else: self._url = self._resolvers[0].get_url(host, media_id) From 6595f4377175ea14fc8aa3258f145c8768bf0a4c Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Thu, 1 Mar 2012 23:47:01 -0500 Subject: [PATCH 0024/1360] Workaround for real-debrid serever timeout issues by manipulating which server is used for the generated link --- lib/urlresolver/plugins/realdebrid.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index dd07f2d4..fa1124a1 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -71,6 +71,17 @@ def get_media_url(self, host, media_id): link =re.compile('ok"> 1 and num < 10: + server = "s0" + str(num) + '.' + elif num < 19: + server = 's' + str(num) + '.' + link[0] = re.sub('s.+?\.', server, link[0], count = 1) + print 'link is %s' % link[0] return link[0] def get_url(self, host, media_id): @@ -136,6 +147,10 @@ def get_settings_xml(self): xml += 'type="text" label="username" default=""/>\n' xml += ' Date: Fri, 2 Mar 2012 09:04:43 -0500 Subject: [PATCH 0025/1360] Added an avoid server list for real-debrid instead of choosing a sever. --- lib/urlresolver/plugins/realdebrid.py | 40 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index fa1124a1..5942c749 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -69,19 +69,34 @@ def get_media_url(self, host, media_id): dialog.ok(' Real-Debrid ', ' No server is available for this hoster ', '', '') return None link =re.compile('ok"> 1 and num < 10: - server = "s0" + str(num) + '.' - elif num < 19: - server = 's' + str(num) + '.' - link[0] = re.sub('s.+?\.', server, link[0], count = 1) - print 'link is %s' % link[0] + server = re.compile('//(.+?)\.').findall(link[0]) + if len(server) > 0: + avoid = (self.get_setting('server')).split(',') + if server[0] in avoid: + check = True + while check: + check = False + new = '' + gen = random.randint(1, 18) + if len(str(gen)) == 1: + new = 's0' + str(gen) + else: + new = 's' + str(gen) + + if new in avoid: + check = True + + link[0] = re.sub('//.+?\.', '//' +new + '.', link[0], count = 1) + print 'link is %s' % link[0] return link[0] def get_url(self, host, media_id): @@ -107,7 +122,6 @@ def valid_url(self, url, host): if len(tmp) > 0 : domain = tmp[0].replace('www.', '') print 'domain is %s ' % domain - print 'allHosters is %s ' % self.get_all_hosters() if (domain in self.get_all_hosters()) or (len(host) > 0 and host in self.get_all_hosters()): return True else: @@ -147,10 +161,10 @@ def get_settings_xml(self): xml += 'type="text" label="username" default=""/>\n' xml += ' Date: Wed, 7 Mar 2012 07:35:02 -0500 Subject: [PATCH 0026/1360] added stagevu support --- lib/urlresolver/plugins/stagevu.py | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 lib/urlresolver/plugins/stagevu.py diff --git a/lib/urlresolver/plugins/stagevu.py b/lib/urlresolver/plugins/stagevu.py new file mode 100644 index 00000000..96b2b5a0 --- /dev/null +++ b/lib/urlresolver/plugins/stagevu.py @@ -0,0 +1,65 @@ +''' +Stagevu urlresolver plugin +Copyright (C) 2011 anilkuj + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +import urllib2 +from urlresolver import common +import os + +class StagevuResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "stagevu" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + print 'stagevu: in get_media_url %s %s' % (host, media_id) + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + p=re.compile(' Date: Mon, 12 Mar 2012 13:27:23 -0400 Subject: [PATCH 0027/1360] Added new resolvers stageVu and veeHD on behalf of voinage fixed dailymotion --- lib/urlresolver/plugins/dailymotion.py | 33 +++---- lib/urlresolver/plugins/stagevu.py | 1 - lib/urlresolver/plugins/veeHD.py | 129 +++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 20 deletions(-) create mode 100644 lib/urlresolver/plugins/veeHD.py diff --git a/lib/urlresolver/plugins/dailymotion.py b/lib/urlresolver/plugins/dailymotion.py index 61d9498e..f5ee8205 100644 --- a/lib/urlresolver/plugins/dailymotion.py +++ b/lib/urlresolver/plugins/dailymotion.py @@ -37,29 +37,24 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) try: - html = self.net.http_GET(web_url).content + link = self.net.http_GET(web_url).content except urllib2.URLError, e: common.addon.log_error(self.name + '- got http error %d fetching %s' % (e.code, web_url)) return False - - fragment = re.search('"sequence", "(.+?)"', html) - decoded_frag = urllib.unquote(fragment.group(1)).decode('utf8').replace('\\/','/') - r = re.search('"hqURL":"(.+?)"', decoded_frag) - if r: - stream_url = r.group(1) + sequence = re.compile('"sequence", "(.+?)"').findall(link) + newseqeunce = urllib.unquote(sequence[0]).decode('utf8').replace('\\/', '/') + imgSrc = re.compile('og:image" content="(.+?)"').findall(link) + if(len(imgSrc) == 0): + imgSrc = re.compile('/jpeg" href="(.+?)"').findall(link) + dm_low = re.compile('"sdURL":"(.+?)"').findall(newseqeunce) + dm_high = re.compile('"hqURL":"(.+?)"').findall(newseqeunce) + videoUrl = '' + if(len(dm_high) == 0): + videoUrl = dm_low[0] else: - message = self.name + '- 1st attempt at finding the stream_url failed' - common.addon.log_debug(message) - r = re.search('"sdURL":"(.+?)"', decoded_frag) - if r: - stream_url = r.group(1) - else: - message = self.name + '- Giving up on finding the stream_url' - common.addon.log_error(message) - return False - return stream_url - + videoUrl = dm_high[0] + return videoUrl def get_url(self, host, media_id): return 'http://www.dailymotion.com/video/%s' % media_id @@ -79,4 +74,4 @@ def get_host_and_id(self, url): def valid_url(self, url, host): return re.match('http://(www.)?dailymotion.com/video/[0-9A-Za-z]+', url) or \ - re.match('http://(www.)?dailymotion.com/swf/[0-9A-Za-z]+', url) or self.name in host \ No newline at end of file + re.match('http://(www.)?dailymotion.com/swf/[0-9A-Za-z]+', url) or self.name in host diff --git a/lib/urlresolver/plugins/stagevu.py b/lib/urlresolver/plugins/stagevu.py index 96b2b5a0..33e65589 100644 --- a/lib/urlresolver/plugins/stagevu.py +++ b/lib/urlresolver/plugins/stagevu.py @@ -59,7 +59,6 @@ def get_host_and_id(self, url): def valid_url(self, url, host): - print 'stagevu: in valid_url %s %s' % (url, host) return (re.match('http://(www.)?stagevu.com/video/' + '[0-9A-Za-z]+', url) or 'stagevu' in host) diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py new file mode 100644 index 00000000..bba66ae5 --- /dev/null +++ b/lib/urlresolver/plugins/veeHD.py @@ -0,0 +1,129 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import os +import random +import re +import urllib, urllib2 +import xbmc +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import SiteAuth +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from urlresolver import common +import xbmc,xbmcplugin,xbmcgui,xbmcaddon, datetime +import cookielib +from t0mm0.common.net import Net + + + +class veeHDResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): + implements = [UrlResolver, SiteAuth, PluginSettings] + name = "veeHD" + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, '%s.cookies' % name) + + def __init__(self): + p = self.get_setting('priority') or 1 + self.priority = int(p) + self.net = Net() + try: + os.makedirs(os.path.dirname(self.cookie_file)) + except OSError: + pass + + #UrlResolver methods + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + try: + html = self.net.http_GET(web_url).content + except urllib2.URLError, e: + common.addon.log_error(self.name + '- got http error %d fetching %s' % + (e.code, web_url)) + return False + + fragment = re.search('playeriframe".+?attr.+?src : "(.+?)"', html) + frag = 'http://%s%s'%(host,fragment.group(1)) + xbmc.log(frag) + try: + html = self.net.http_GET(frag).content + except urllib2.URLError, e: + common.addon.log_error(self.name + '- got http error %d fetching %s' % + (e.code, web_url)) + return False + r = re.search('"video/divx" src="(.+?)"', html) + if r: + stream_url = r.group(1) + else: + message = self.name + '- 1st attempt at finding the stream_url failed probably an Mp4, finding Mp4' + common.addon.log_debug(message) + a = re.search('"url":"(.+?)"', html) + r=urllib.unquote(a.group(1)) + if r: + stream_url = r + else: + message = self.name + '- Giving up on finding the stream_url' + common.addon.log_error(message) + return False + return stream_url + + + def get_url(self, host, media_id): + return 'http://veehd.com/video/%s' % media_id + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/video/([0-9A-Za-z]+)', url) + if r: + return r.groups() + else: + return False + + def valid_url(self, url, host): + + if self.get_setting('login') == 'false': + return False + return re.match('http://veehd.com/video/[0-9A-Za-z]+', url) or \ + self.name in host + + #SiteAuth methods + def login(self): + data=(('ref', 'http://veehd.com/dashboard'), ('uname', self.get_setting('username')), ('pword', self.get_setting('password')), ('submit', 'Login'), ('terms', 'on')) + source = self.net.http_POST('http://veehd.com/login',data).content + if re.search('My Dashboard', source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + return True + else: + return False + + #PluginSettings methods + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += ' Date: Mon, 12 Mar 2012 13:29:28 -0400 Subject: [PATCH 0028/1360] commented out avoid server feature since real-debrid fixed the loophole --- lib/urlresolver/plugins/realdebrid.py | 66 +++++++++++++++------------ 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 5942c749..d76d7032 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -16,7 +16,7 @@ along with this program. If not, see . """ -import os +import os, sys import random import re import urllib, urllib2 @@ -51,10 +51,17 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): print 'in get_media_url %s : %s' % (host, media_id) - url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id - source = self.net.http_GET(url).content - print '************* %s' % source dialog = xbmcgui.Dialog() + try: + url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id + source = self.net.http_GET(url).content + except Exception, e: + exc_type, exc_obj, exc_tb = sys.exc_info() + fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + print(exc_type, fname, exc_tb.tb_lineno) + dialog.ok(' Real-Debrid ', ' Real-Debrid server timed out ', '', '') + return None + print '************* %s' % source if re.search('Upgrade your account now to generate a link', source): dialog.ok(' Real-Debrid ', ' Upgrade your account now to generate a link ', '', '') @@ -76,27 +83,28 @@ def get_media_url(self, host, media_id): print 'link is %s' % link[0] self.media_url = link[0] - if self.get_setting('avoidserver') == 'true': - print 'in chooseserver' - server = re.compile('//(.+?)\.').findall(link[0]) - if len(server) > 0: - avoid = (self.get_setting('server')).split(',') - if server[0] in avoid: - check = True - while check: - check = False - new = '' - gen = random.randint(1, 18) - if len(str(gen)) == 1: - new = 's0' + str(gen) - else: - new = 's' + str(gen) - - if new in avoid: - check = True - - link[0] = re.sub('//.+?\.', '//' +new + '.', link[0], count = 1) - print 'link is %s' % link[0] + # avoid servers as configured in the settings to get better playback of your video on XBMC +## if self.get_setting('avoidserver') == 'true': +## print 'in chooseserver' +## server = re.compile('//(.+?)\.').findall(link[0]) +## if len(server) > 0: +## avoid = (self.get_setting('server')).split(',') +## if server[0] in avoid: +## check = True +## while check: +## check = False +## new = '' +## gen = random.randint(1, 18) +## if len(str(gen)) == 1: +## new = 's0' + str(gen) +## else: +## new = 's' + str(gen) +## +## if new in avoid: +## check = True +## +## link[0] = re.sub('//.+?\.', '//' +new + '.', link[0], count = 1) +## print 'link is %s' % link[0] return link[0] def get_url(self, host, media_id): @@ -161,10 +169,10 @@ def get_settings_xml(self): xml += 'type="text" label="username" default=""/>\n' xml += ' Date: Sat, 17 Mar 2012 05:49:13 -0400 Subject: [PATCH 0029/1360] upadted daclips and movpod to handle multiple domains --- lib/urlresolver/plugins/daclips.py | 4 ++-- lib/urlresolver/plugins/movpod.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/plugins/daclips.py b/lib/urlresolver/plugins/daclips.py index 57f047fa..5a3b98a8 100644 --- a/lib/urlresolver/plugins/daclips.py +++ b/lib/urlresolver/plugins/daclips.py @@ -36,7 +36,7 @@ def __init__(self): self.priority = int(p) self.net = Net() #e.g. http://daclips.com/vb80o1esx2eb - self.pattern = 'http://((?:www.)?daclips.com)/([0-9a-zA-Z]+)' + self.pattern = 'http://((?:www.)?daclips.(?:in|com))/([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): @@ -86,4 +86,4 @@ def get_host_and_id(self, url): def valid_url(self, url, host): - return re.match(self.pattern, url) or self.name in host \ No newline at end of file + return re.match(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py index 4865fb5f..16ed02fa 100644 --- a/lib/urlresolver/plugins/movpod.py +++ b/lib/urlresolver/plugins/movpod.py @@ -36,7 +36,7 @@ def __init__(self): self.priority = int(p) self.net = Net() #e.g. http://movpod.com/vb80o1esx2eb - self.pattern = 'http://((?:www.)?movpod.net)/([0-9a-zA-Z]+)' + self.pattern = 'http://((?:www.)?movpod.(?:net|in))/([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): @@ -82,4 +82,4 @@ def get_host_and_id(self, url): def valid_url(self, url, host): - return re.match(self.pattern, url) or self.name in host \ No newline at end of file + return re.match(self.pattern, url) or self.name in host From b9ff319166f826b4da00b4ddc9000d9c4926ac92 Mon Sep 17 00:00:00 2001 From: "anilkuj@gmail.com" Date: Sat, 17 Mar 2012 08:46:46 -0400 Subject: [PATCH 0030/1360] added 180upload and ovfile --- lib/urlresolver/plugins/180upload.py | 78 +++++++++++++++++++++++ lib/urlresolver/plugins/ovfile.py | 94 ++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 lib/urlresolver/plugins/180upload.py create mode 100644 lib/urlresolver/plugins/ovfile.py diff --git a/lib/urlresolver/plugins/180upload.py b/lib/urlresolver/plugins/180upload.py new file mode 100644 index 00000000..2a0f84ba --- /dev/null +++ b/lib/urlresolver/plugins/180upload.py @@ -0,0 +1,78 @@ +''' +180upload urlresolver plugin +Copyright (C) 2011 anilkuj + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +import urllib2 +from urlresolver import common +import os + +class OneeightyuploadResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "180upload" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + print '180upload: in get_media_url %s %s' % (host, media_id) + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(web_url, form_data=form_values).content + match = re.search('.+?', html,re.DOTALL) + if not match: + print 'could not find video' + return False + return match.group(1) + + + def get_url(self, host, media_id): + print '180upload: in get_url %s %s' % (host, media_id) + return 'http://www.180upload.com/%s' % media_id + + + def get_host_and_id(self, url): + print '180upload: in get_host_and_id %s' % (url) + + r = re.search('http://(.+?)/embed-([\w]+)-', url) + if r: + return r.groups() + else: + r = re.search('//(.+?)/([\w]+)', url) + if r: + return r.groups() + else: + return False + + + def valid_url(self, url, host): + return (re.match('http://(www.)?180upload.com/' + + '[0-9A-Za-z]+', url) or + '180upload' in host) diff --git a/lib/urlresolver/plugins/ovfile.py b/lib/urlresolver/plugins/ovfile.py new file mode 100644 index 00000000..05751eeb --- /dev/null +++ b/lib/urlresolver/plugins/ovfile.py @@ -0,0 +1,94 @@ +''' +ovfile urlresolver plugin +Copyright (C) 2011 anilkuj + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +import urllib2 +from urlresolver import common +import os + +class OvfileResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "ovile" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + print 'ovfile: in get_media_url %s %s' % (host, media_id) + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(web_url, form_data=form_values).content + + match = re.search('s1\|(.+?)\|var', html, re.DOTALL | re.MULTILINE ) + + if not match: + print 'could not find video' + return False + arrayString = match.group(1) + arrayString = arrayString.replace('||', '|') + print arrayString + if 'http|' in arrayString: + match = re.search( 'http\|(.+?)\|add', arrayString, re.DOTALL | re.MULTILINE) + ip = match.group(1).split('|') + print ip + server = "" + if len(ip) == 5 : + server = "http://" + ip[4] + "." + ip[1] + "." + ip[0] + print server + match = re.search( 'addParam\|(.+?)\|flvplayer', arrayString, re.DOTALL | re.MULTILINE) + videoData = match.group(1).split('|') + print videoData + vidURL = server + ':' + videoData[4] + '/d/' + videoData[3] + '/video.' + videoData[1] + print vidURL + else: + print 'could not find video' + return False + return vidURL + + + def get_url(self, host, media_id): + print 'ovfile: in get_url %s %s' % (host, media_id) + return 'http://www.ovfile.com/%s' % media_id + + + def get_host_and_id(self, url): + print 'ovfile: in get_host_and_id %s' % (url) + r = re.search('//(.+?)/([0-9a-zA-Z/]+)', url) + if r: + return r.groups() + else: + return False + + + def valid_url(self, url, host): + return (re.match('http://(www.)?ovfile.com/' + + '[0-9A-Za-z]+', url) or + 'ovfile' in host) From 9f76c5969580a3b6755f8251b6002c20f1f474bf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Mar 2012 23:44:36 -0400 Subject: [PATCH 0031/1360] Error handling --- lib/urlresolver/plugins/filebox.py | 10 +++++- lib/urlresolver/plugins/ovfile.py | 50 ++++++++++++++++-------------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/lib/urlresolver/plugins/filebox.py b/lib/urlresolver/plugins/filebox.py index d13c94c1..c25adbb2 100644 --- a/lib/urlresolver/plugins/filebox.py +++ b/lib/urlresolver/plugins/filebox.py @@ -24,6 +24,7 @@ import urllib2 from urlresolver import common from lib import jsunpack +import xbmcgui # Custom imports import re @@ -48,8 +49,15 @@ def get_media_url(self, host, media_id): resp = self.net.http_GET(web_url) html = resp.content post_url = resp.get_url() - print post_url + dialog = xbmcgui.Dialog() + + if "video is not available for streaming right now. It's still converting..." in html: + dialog.ok('UrlResolver', "video is not available for streaming right now.", "It's still converting...", '') + + if "File was deleted" in html: + dialog.ok( 'UrlResolver', 'File was deleted', '', '') + form_values = {} for i in re.finditer('', html): form_values[i.group(1)] = i.group(2) diff --git a/lib/urlresolver/plugins/ovfile.py b/lib/urlresolver/plugins/ovfile.py index 05751eeb..63096a99 100644 --- a/lib/urlresolver/plugins/ovfile.py +++ b/lib/urlresolver/plugins/ovfile.py @@ -23,7 +23,9 @@ import re import urllib2 from urlresolver import common -import os +import os, xbmcgui +from vidxden import unpack_js + class OvfileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -41,37 +43,37 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content + dialog = xbmcgui.Dialog() + + if 'file has been removed' in html: + dialog.ok(' UrlResolver ', ' File has been removed. ', '', '') + return False + form_values = {} for i in re.finditer('', html): form_values[i.group(1)] = i.group(2) html = self.net.http_POST(web_url, form_data=form_values).content - - match = re.search('s1\|(.+?)\|var', html, re.DOTALL | re.MULTILINE ) - - if not match: - print 'could not find video' + + page = ''.join(html.splitlines()).replace('\t','') + r = re.compile("return p\}\(\'(.+?)\',\d+,\d+,\'(.+?)\'").findall(page) + if r: + p = r[1][0] + k = r[1][1] + else: + common.addon.log_error(self.name + '- packed javascript embed code not found') return False - arrayString = match.group(1) - arrayString = arrayString.replace('||', '|') - print arrayString - if 'http|' in arrayString: - match = re.search( 'http\|(.+?)\|add', arrayString, re.DOTALL | re.MULTILINE) - ip = match.group(1).split('|') - print ip - server = "" - if len(ip) == 5 : - server = "http://" + ip[4] + "." + ip[1] + "." + ip[0] - print server - match = re.search( 'addParam\|(.+?)\|flvplayer', arrayString, re.DOTALL | re.MULTILINE) - videoData = match.group(1).split('|') - print videoData - vidURL = server + ':' + videoData[4] + '/d/' + videoData[3] + '/video.' + videoData[1] - print vidURL + decrypted_data = unpack_js(p, k) + r = re.search('file.\',.\'(.+?).\'', decrypted_data) + if not r: + r = re.search('src="(.+?)"', decrypted_data) + if r: + stream_url = r.group(1) else: - print 'could not find video' + common.addon.log_error(self.name + '- stream url not found') return False - return vidURL + + return stream_url def get_url(self, host, media_id): From 8b9892c1ed7d8987255da30c12b1cc0941f3a2e6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Mar 2012 23:45:11 -0400 Subject: [PATCH 0032/1360] Error handling --- lib/urlresolver/plugins/realdebrid.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index d76d7032..7b2dd2a2 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -60,25 +60,25 @@ def get_media_url(self, host, media_id): fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno) dialog.ok(' Real-Debrid ', ' Real-Debrid server timed out ', '', '') - return None + return False print '************* %s' % source if re.search('Upgrade your account now to generate a link', source): dialog.ok(' Real-Debrid ', ' Upgrade your account now to generate a link ', '', '') - return None + return False if source == 'Your file is unavailable on the hoster.': dialog.ok(' Real-Debrid ', ' Your file is unavailable on the hoster ', '', '') - return None + return False if re.search('This hoster is not included in our free offer', source): dialog.ok(' Real-Debrid ', ' This hoster is not included in our free offer ', '', '') - return None + return False if re.search('No server is available for this hoster.', source): dialog.ok(' Real-Debrid ', ' No server is available for this hoster ', '', '') - return None + return False link =re.compile('ok"> Date: Wed, 21 Mar 2012 08:45:02 -0400 Subject: [PATCH 0033/1360] added jumbofiles --- lib/urlresolver/plugins/jumbofiles.py | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 lib/urlresolver/plugins/jumbofiles.py diff --git a/lib/urlresolver/plugins/jumbofiles.py b/lib/urlresolver/plugins/jumbofiles.py new file mode 100644 index 00000000..ee5235d1 --- /dev/null +++ b/lib/urlresolver/plugins/jumbofiles.py @@ -0,0 +1,81 @@ +''' +jumbofiles urlresolver plugin +Copyright (C) 2011 anilkuj + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +import urllib2 +from urlresolver import common +import os, xbmcgui +from vidxden import unpack_js + + +class JumbofilesResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "jumbofiles" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + print 'jumbofiles: in get_media_url %s %s' % (host, media_id) + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + dialog = xbmcgui.Dialog() + + if 'file has been removed' in html: + dialog.ok(' UrlResolver ', ' File has been removed. ', '', '') + return False + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(web_url, form_data=form_values).content + match = re.search('ACTION="(.+?)"', html) + if match: + return match.group(1) + else: + return False + + + def get_url(self, host, media_id): + print 'jumbofiles: in get_url %s %s' % (host, media_id) + return 'http://www.jumbofiles.com/%s' % media_id + + + def get_host_and_id(self, url): + print 'jumbofiles: in get_host_and_id %s' % (url) + r = re.search('//(.+?)/([0-9a-zA-Z/]+)', url) + if r: + return r.groups() + else: + return False + + + def valid_url(self, url, host): + return (re.match('http://(www.)?jumbofiles.com/' + + '[0-9A-Za-z]+', url) or + 'jumbofiles' in host) From a299e2200426c5a81bec530d929c8b9ce5608449 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Mar 2012 06:29:13 -0400 Subject: [PATCH 0034/1360] Error handling --- lib/urlresolver/plugins/realdebrid.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 7b2dd2a2..cfdca417 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -38,6 +38,8 @@ class RealDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): cookie_file = os.path.join(profile_path, '%s.cookies' % name) media_url = None allHosters = None + dialog = xbmcgui.Dialog() + def __init__(self): p = self.get_setting('priority') or 1 @@ -51,7 +53,6 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): print 'in get_media_url %s : %s' % (host, media_id) - dialog = xbmcgui.Dialog() try: url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id source = self.net.http_GET(url).content @@ -147,14 +148,18 @@ def checkLogin(self): #SiteAuth methods def login(self): - if self.checkLogin(): - login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : self.get_setting('password')}) - url = 'https://real-debrid.com/ajax/login.php?' + login_data - source = self.net.http_GET(url).content - if re.search('OK', source): - self.net.save_cookies(self.cookie_file) - self.net.set_cookies(self.cookie_file) - return True + if self.checkLogin(): + try: + login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : self.get_setting('password')}) + url = 'https://real-debrid.com/ajax/login.php?' + login_data + source = self.net.http_GET(url).content + if re.search('OK', source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + return True + except: + print 'error with http_GET' + dialog.ok(' Real-Debrid ', ' Unexpected error, Please try again.', '', '') else: return False else: From f0906d6372e8565c0ac502946df5b0b5b7f8611d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Mar 2012 07:20:49 -0400 Subject: [PATCH 0035/1360] Error handling --- lib/urlresolver/plugins/realdebrid.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index cfdca417..f7aea829 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -38,7 +38,6 @@ class RealDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): cookie_file = os.path.join(profile_path, '%s.cookies' % name) media_url = None allHosters = None - dialog = xbmcgui.Dialog() def __init__(self): @@ -53,6 +52,8 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): print 'in get_media_url %s : %s' % (host, media_id) + dialog = xbmcgui.Dialog() + try: url = 'http://real-debrid.com/ajax/deb.php?lang=en&sl=1&link=%s' % media_id source = self.net.http_GET(url).content @@ -159,6 +160,7 @@ def login(self): return True except: print 'error with http_GET' + dialog = xbmcgui.Dialog() dialog.ok(' Real-Debrid ', ' Unexpected error, Please try again.', '', '') else: return False From f7082bfb2f251fa45e597d796476c5f4e0eb9c23 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Mar 2012 01:00:47 -0400 Subject: [PATCH 0036/1360] Handled embedded urls, fixed real-debrid login issue --- lib/urlresolver/plugins/ovfile.py | 8 ++++-- lib/urlresolver/plugins/realdebrid.py | 5 ++++ lib/urlresolver/plugins/vidpe.py | 40 +++++++++++++++------------ 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/lib/urlresolver/plugins/ovfile.py b/lib/urlresolver/plugins/ovfile.py index 63096a99..705174f2 100644 --- a/lib/urlresolver/plugins/ovfile.py +++ b/lib/urlresolver/plugins/ovfile.py @@ -83,11 +83,15 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): print 'ovfile: in get_host_and_id %s' % (url) - r = re.search('//(.+?)/([0-9a-zA-Z/]+)', url) + r = re.search('http://(.+?)/embed-([\w]+)-', url) if r: return r.groups() else: - return False + r = re.search('//(.+?)/([\w]+)', url) + if r: + return r.groups() + else: + return False def valid_url(self, url, host): diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index f7aea829..20ba942c 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -141,16 +141,21 @@ def checkLogin(self): url = 'http://real-debrid.com/lib/api/account.php' if not os.path.exists(self.cookie_file): return True + self.net.set_cookies(self.cookie_file) source = self.net.http_GET(url).content + print source if re.search('expiration', source): + print 'checkLogin returning False' return False else: + print 'checkLogin returning True' return True #SiteAuth methods def login(self): if self.checkLogin(): try: + print 'Need to login since session is invalid' login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : self.get_setting('password')}) url = 'https://real-debrid.com/ajax/login.php?' + login_data source = self.net.http_GET(url).content diff --git a/lib/urlresolver/plugins/vidpe.py b/lib/urlresolver/plugins/vidpe.py index 9615f2fe..a3dc6427 100644 --- a/lib/urlresolver/plugins/vidpe.py +++ b/lib/urlresolver/plugins/vidpe.py @@ -35,7 +35,7 @@ def __init__(self): self.priority = int(p) def get_media_url(self, host, media_id): - print '******* vidpe: in get_media_url' + print '******* vidpe: in get_media_url %s %s' %(host, media_id) web_url = self.get_url(host, media_id) try: html = self.net.http_GET(web_url).content @@ -43,8 +43,9 @@ def get_media_url(self, host, media_id): common.addon.log_error(self.name + '- got http error %d fetching %s' % (e.code, web_url)) return False - + page = ''.join(html.splitlines()).replace('\t','') + print ' *************************** %s' % page r = re.search("return p\}\(\'(.+?)\',\d+,\d+,\'(.+?)\'", page) if r: p, k = r.groups() @@ -66,27 +67,30 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): - return 'http://'+host+'/%s' % media_id + if 'vidpe' in host or 'hostingcup' in host: + return 'http://'+host+'/%s.html' % media_id + else: + return 'http://'+host+'/%s' % media_id def get_host_and_id(self, url): print 'vidpe resolver: in get_host_and_id %s' % url - r = None - video_id = None - - if re.search('embed-', url): - r = re.compile('embed-(.+?)-|.html').findall(url) - elif re.search('.com/', url): - r = re.compile('.com/(.+?).html').findall(url) - - if r is not None and len(r) > 0: - video_id = r[0] - if video_id: - return (self.get_domain(url), video_id) - else: - common.addon.log_error('host: video id not found') - return False + r = re.search('http://(.+?)/embed-([\w]+)-', url) + if r: + return r.groups() + else: + r = re.search('http://(.+?)/embed-([\w]+).html', url) + if r: + return r.groups() + else: + r = re.search('//(.+?)/([\w]+)', url) + if r: + return r.groups() + else: + return False + + def get_domain(self, url): tmp = re.compile('//(.+?)/').findall(url) if len(tmp) == 0: From fefe401faacc4731a8718a5555241d151ac9b7d4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 24 Mar 2012 10:52:41 -0400 Subject: [PATCH 0037/1360] Fixed embed urls for videoweed, vidpe, hostingbulk and hostingcup FIxed urlresolver issues where some of the resolvers where returning boolean instead of host and mediaId iterator --- lib/urlresolver/plugins/videoweed.py | 12 ++++++++---- lib/urlresolver/plugins/vidpe.py | 1 - lib/urlresolver/types.py | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/urlresolver/plugins/videoweed.py b/lib/urlresolver/plugins/videoweed.py index f6cf73d3..bda8d43e 100644 --- a/lib/urlresolver/plugins/videoweed.py +++ b/lib/urlresolver/plugins/videoweed.py @@ -23,6 +23,7 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin +import xbmcgui class VideoweedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -35,6 +36,8 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + dialog = xbmcgui.Dialog() + #grab stream details try: html = self.net.http_GET(web_url).content @@ -52,7 +55,7 @@ def get_media_url(self, host, media_id): api_call = ('%s/api/player.api.php?user=undefined&codes=1&file=%s' + '&pass=undefined&key=%s') % (domain, fileid, filekey) else: - common.addon.log_error('videoweed: api url not found') + dialog.ok(' Videoweed ', ' The video no longer exists ', '', '') return False try: @@ -77,7 +80,8 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): - r = re.search('//(.+?)/file/([0-9a-z]+)', url) + r = re.search('//(?:embed.)?(.+?)/(?:video/|embed.php\?v=)' + + '([0-9a-z]+)', url) if r: return r.groups() else: @@ -85,6 +89,6 @@ def get_host_and_id(self, url): def valid_url(self, url, host): - return re.match('http://(www.)?videoweed.(es|com)/file/[0-9a-z]+', - url) or 'videoweed' in host + return re.match('http://(www.|embed.)?videoweed.(?:es|com)/(video/|embed.php\?)' + + '(?:[0-9a-z]+|width)', url) or 'videoweed' in host diff --git a/lib/urlresolver/plugins/vidpe.py b/lib/urlresolver/plugins/vidpe.py index a3dc6427..970b24fd 100644 --- a/lib/urlresolver/plugins/vidpe.py +++ b/lib/urlresolver/plugins/vidpe.py @@ -45,7 +45,6 @@ def get_media_url(self, host, media_id): return False page = ''.join(html.splitlines()).replace('\t','') - print ' *************************** %s' % page r = re.search("return p\}\(\'(.+?)\',\d+,\d+,\'(.+?)\'", page) if r: p, k = r.groups() diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 85d727fb..44224e5e 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -72,7 +72,7 @@ def __init__(self, url='', host='', media_id='', title=''): self._media_id = media_id self._resolvers = self._find_resolvers() - if url and self._resolvers: + if url and self._resolvers and self._resolvers[0].get_host_and_id(url): self._host, self._media_id = self._resolvers[0].get_host_and_id(url) elif self._resolvers: if self._resolvers[0].isUniversal(): From 7591a46afde760db8288580e8e985a6544c186b7 Mon Sep 17 00:00:00 2001 From: anilkuj Date: Fri, 30 Mar 2012 08:42:25 -0400 Subject: [PATCH 0038/1360] megashare fix for real-debrid resolver --- lib/urlresolver/plugins/realdebrid.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 20ba942c..0755b14f 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -131,6 +131,10 @@ def valid_url(self, url, host): domain = '' if len(tmp) > 0 : domain = tmp[0].replace('www.', '') + if 'megashares' in domain: + domain = 'megashares.com' + elif 'megashare' in domain: + domain = 'megashare.com' print 'domain is %s ' % domain if (domain in self.get_all_hosters()) or (len(host) > 0 and host in self.get_all_hosters()): return True From 35e7253cc66bbc172046bfb6237287ddb665ff44 Mon Sep 17 00:00:00 2001 From: prono Date: Mon, 2 Apr 2012 16:48:59 -0500 Subject: [PATCH 0039/1360] update script to support the changes made to movdivx.com --- lib/urlresolver/plugins/movdivx.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index 611f8bf1..578b799c 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -72,14 +72,21 @@ def get_media_url(self, host, media_id): (e.code, web_url)) return False # get url from packed javascript - sPattern = '
' - r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) +# sPattern = '
' + sPattern = '' - sPattern = '' + + r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) -# r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) - r = re.search(sPattern, html, re.IGNORECASE) if r: sJavascript = r.group(1) + ")))" # print("1") # print(sJavascript) sUnpacked = jsunpack.unpack(sJavascript) print(sUnpacked) -# sPattern = 'type="video/divx"src="(.+?)"custommode=' - sPattern = "'file','([^']*)'"; + sPattern = 'type="video/divx"src="(.+?)"custommode=' +# sPattern = "'file','([^']*)'"; r = re.search(sPattern, sUnpacked) if r: return r.group(1) - + else: + sPattern = '", html, re.DOTALL + re.IGNORECASE) - if r: - sJavascript = r[1] - sUnpacked = jsunpack.unpack(sJavascript) - sPattern = ' Date: Thu, 6 Sep 2012 13:36:06 -0300 Subject: [PATCH 0051/1360] Putlocker PRO support --- lib/urlresolver/plugins/putlocker.py | 261 +++++++++++++++++++-------- 1 file changed, 181 insertions(+), 80 deletions(-) diff --git a/lib/urlresolver/plugins/putlocker.py b/lib/urlresolver/plugins/putlocker.py index f7aa93dc..820ec57c 100644 --- a/lib/urlresolver/plugins/putlocker.py +++ b/lib/urlresolver/plugins/putlocker.py @@ -17,93 +17,194 @@ """ import re +import os +import xbmcgui +import xbmc from t0mm0.common.net import Net import urllib2 +import urllib from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin +from threading import Thread class PutlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] - name = "putlocker/sockshare" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - #find session_hash - try: - html = self.net.http_GET(web_url).content - except urllib2.URLError, e: - common.addon.log_error('putlocker: got http error %d fetching %s' % - (e.code, web_url)) - return False - r = re.search('value="([0-9a-f]+?)" name="hash"', html) - if r: - session_hash = r.group(1) - else: - common.addon.log_error('putlocker: session hash not found') - return False - - #post session_hash - try: - html = self.net.http_POST(web_url, form_data={'hash': session_hash, - 'confirm': 'Continue as Free User'}).content - except urllib2.URLError, e: - common.addon.log_error('putlocker: got http error %d posting %s' % - (e.code, web_url)) - return False - - #find playlist code - r = re.search('\?stream=(.+?)\'', html) - if r: - playlist_code = r.group(1) - else: - common.addon.log_error('putlocker: playlist code not found') - return False - - #find download link - xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) - xml_url += playlist_code - try: - html = self.net.http_GET(xml_url).content - except urllib2.URLError, e: - common.addon.log_error('putlocker: got http error %d fetching %s' % - (e.code, xml_url)) - return False - - r = re.search('url="(.+?)"', html) - if r: - flv_url = r.group(1) - else: - common.addon.log_error('putlocker: stream url not found') - return False - flv_url = flv_url.replace('&','&') #ghizzu - return flv_url - - def get_url(self, host, media_id): - if 'putlocker' in host: - host = 'www.putlocker.com' - else: - host = 'www.sockshare.com' - return 'http://%s/file/%s' % (host, media_id) - - - def get_host_and_id(self, url): - r = re.search('//(.+?)/(?:file|embed)/([0-9A-Z]+)', url) - if r: - return r.groups() - else: - return False - - def valid_url(self, url, host): - return (re.match('http://(www.)?(putlocker|sockshare).com/' + - '(file|embed)/[0-9A-Z]+', url) or - 'putlocker' in host or 'sockshare' in host) - + name = "putlocker/sockshare" + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, 'putlocker.cookies') + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + if self.get_setting('login') == 'true': + if self.login_stale(): + self.login() + self.net.set_cookies(self.cookie_file) + web_url = self.get_url(host, media_id) + + + #find session_hash + try: + html = self.net.http_GET(web_url).content + except urllib2.URLError, e: + common.addon.log_error('putlocker: got http error %d fetching %s' % + (e.code, web_url)) + return False + + #Shortcut for logged in users + pattern = 'Download File' + link = re.search(pattern, html) + if link: + print 'Direct link found: %s' %link.group(1) + return 'http://www.putlocker.com%s' %link.group(1) + + r = re.search('value="([0-9a-f]+?)" name="hash"', html) + if r: + session_hash = r.group(1) + else: + common.addon.log_error('putlocker: session hash not found') + return False + + #post session_hash + try: + html = self.net.http_POST(web_url, form_data={'hash': session_hash, + 'confirm': 'Continue as Free User'}).content + except urllib2.URLError, e: + common.addon.log_error('putlocker: got http error %d posting %s' % + (e.code, web_url)) + return False + + #find playlist code + r = re.search('\?stream=(.+?)\'', html) + if r: + playlist_code = r.group(1) + else: + common.addon.log_error('putlocker: playlist code not found') + return False + + #find download link + xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) + xml_url += playlist_code + try: + html = self.net.http_GET(xml_url).content + except urllib2.URLError, e: + common.addon.log_error('putlocker: got http error %d fetching %s' % + (e.code, xml_url)) + return False + + r = re.search('url="(.+?)"', html) + if r: + flv_url = r.group(1) + else: + common.addon.log_error('putlocker: stream url not found') + return False + flv_url = flv_url.replace('&','&') #ghizzu + return flv_url + + def get_url(self, host, media_id): + if 'putlocker' in host: + host = 'www.putlocker.com' + else: + host = 'www.sockshare.com' + return 'http://%s/file/%s' % (host, media_id) + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:file|embed)/([0-9A-Z]+)', url) + if r: + return r.groups() + else: + return False + + def valid_url(self, url, host): + return (re.match('http://(www.)?(putlocker|sockshare).com/' + + '(file|embed)/[0-9A-Z]+', url) or + 'putlocker' in host or 'sockshare' in host) + def login_stale(self): + url = 'http://www.putlocker.com/cp.php' + if not os.path.exists(self.cookie_file): + return True + self.net.set_cookies(self.cookie_file) + source = self.net.http_GET(url).content + if re.search('(?:\( Pro \)|\( Free \))', source): + common.addon.log('Putlocker account appears to be logged in.') + return False + else: + return True + + #SiteAuth methods + def login(self): + if self.login_stale(): + # try: + print 'Need to login since session is invalid' + url = 'http://www.putlocker.com/authenticate.php?login' + source = self.net.http_GET(url).content + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + captcha_img = re.search('CAPTCHA.+?
', source, re.DOTALL).group(1) + captcha_img = 'http://www.putlocker.com%s' %re.sub('&','&',captcha_img) + local_captcha = os.path.join(common.profile_path, "captcha.img" ) + localFile = open(local_captcha, "wb") + localFile.write(self.net.http_GET(captcha_img).content) + localFile.close() + solver = InputWindow(captcha=local_captcha) + solution = solver.get() + if solution: + common.addon.log('Solution provided: %s' %solution) + data = {'user':self.get_setting('username'), 'pass':self.get_setting('password'), 'captcha_code':solution, 'remember':1, 'login_submit':'Login'} + response = self.net.http_POST(url, form_data=data) + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + print response.get_url() + else: + common.addon.log('Dialog was canceled') + return False + + + + if re.search('OK', source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + xbmc.executebuiltin("Notification(' Putlocker Pro ', ' Login successful')") + return True + # except: + # print 'error with http_GET' + # dialog = xbmcgui.Dialog() + # dialog.ok(' Putlocker Pro ', ' Error logging in.', '', '') + else: return False + else: return True + + #PluginSettings methods + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += ' Date: Tue, 6 Nov 2012 12:49:49 -0500 Subject: [PATCH 0052/1360] alldebrid.com resolver added by hawke from XBMCHub forums... modifications to fix recent error by driftin8ez (also from the forums) http://www.xbmchub.com/forums/1channel-plugin/340-alldebrid-com-urlresolver.html --- lib/urlresolver/plugins/alldebrid.py | 166 +++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 lib/urlresolver/plugins/alldebrid.py diff --git a/lib/urlresolver/plugins/alldebrid.py b/lib/urlresolver/plugins/alldebrid.py new file mode 100644 index 00000000..5432b4eb --- /dev/null +++ b/lib/urlresolver/plugins/alldebrid.py @@ -0,0 +1,166 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import os, sys +import random +import re +import urllib, urllib2 + +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import SiteAuth +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from urlresolver import common +import xbmc,xbmcplugin,xbmcgui,xbmcaddon, datetime +import cookielib +from t0mm0.common.net import Net + + +class AllDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): + implements = [UrlResolver, SiteAuth, PluginSettings] + name = "AllDebrid" + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, '%s.cookies' % name) + media_url = None + allHosters = None + + + def __init__(self): + p = self.get_setting('priority') or 1 + self.priority = int(p) + self.net = Net() + try: + os.makedirs(os.path.dirname(self.cookie_file)) + except OSError: + pass + + #UrlResolver methods + def get_media_url(self, host, media_id): + print 'in get_media_url %s : %s' % (host, media_id) + dialog = xbmcgui.Dialog() + + try: + url = 'http://www.alldebrid.com/service.php?link=%s' % media_id + + source = self.net.http_GET(url).content + except Exception, e: + exc_type, exc_obj, exc_tb = sys.exc_info() + fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + print(exc_type, fname, exc_tb.tb_lineno) + dialog.ok(' all-Debrid ', ' all-Debrid server timed out ', '', '') + return False + print '************* %s' % source + + if re.search('login', source): + dialog.ok(' All Debrid Message ', ' Your account may have Expired, please check by going to the website ', '', '') + return False + if re.search('Hoster unsupported or under maintenance', source): + dialog.ok(' All Debrid Message ', ' Sorry this hoster is not supported, change the priority level in resolver settings for this host ', '', '') + return False + link =re.compile("href='(.+?)'").findall(source) + + if len(link) == 0: + return False + + print 'link is %s' % link[0] + self.media_url = link[0] + + return link[0] + + def get_url(self, host, media_id): + return media_id + + + def get_host_and_id(self, url): + return 'www.alldebrid.com', url + + def get_all_hosters(self): + if self.allHosters is None: + url = 'http://alldebrid.com/api.php?action=get_host' + self.allHosters = self.net.http_GET(url).content + return self.allHosters + + def valid_url(self, url, host): + + if self.get_setting('login') == 'false': + return False + print 'in valid_url %s : %s' % (url, host) + tmp = re.compile('//(.+?)/').findall(url) + domain = '' + if len(tmp) > 0 : + domain = tmp[0].replace('www.', '') + if 'megashares' in domain: + domain = 'megashares.com' + elif 'megashare' in domain: + domain = 'megashare.com' + print 'domain is %s ' % domain + if (domain in self.get_all_hosters()) or (len(host) > 0 and host in self.get_all_hosters()): + return True + else: + return False + + def checkLogin(self): + url = 'http://alldebrid.com/service.php' + if not os.path.exists(self.cookie_file): + return True + self.net.set_cookies(self.cookie_file) + source = self.net.http_GET(url).content + print source + if re.search('login', source): + print 'checkLogin returning False' + return False + else: + print 'checkLogin returning True' + return True + + #SiteAuth methods + def login(self): + if self.checkLogin(): + try: + print 'Need to login since session is invalid' + login_data = urllib.urlencode({'action' : 'login','login_login' : self.get_setting('username'), 'login_password' : self.get_setting('password')}) + url = 'http://alldebrid.com/register/?' + login_data + source = self.net.http_GET(url).content + if re.search('Control panel', source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + return True + except: + print 'error with http_GET' + dialog = xbmcgui.Dialog() + dialog.ok(' Real-Debrid ', ' Unexpected error, Please try again.', '', '') + else: + return False + else: + return True + + #PluginSettings methods + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += ' Date: Thu, 3 Jan 2013 12:49:54 -0500 Subject: [PATCH 0053/1360] Putlocker and Vidxden updated --- lib/urlresolver/plugins/putlocker.py | 232 +++++++++++++++++++-------- lib/urlresolver/plugins/vidxden.py | 71 +++++--- 2 files changed, 215 insertions(+), 88 deletions(-) diff --git a/lib/urlresolver/plugins/putlocker.py b/lib/urlresolver/plugins/putlocker.py index ec568e4d..deeca6bc 100644 --- a/lib/urlresolver/plugins/putlocker.py +++ b/lib/urlresolver/plugins/putlocker.py @@ -17,93 +17,185 @@ """ import re +import os +import xbmcgui +import xbmc from t0mm0.common.net import Net import urllib2 +import urllib from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin +from threading import Thread class PutlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "putlocker/sockshare" + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, 'putlocker.cookies') def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - + def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - #find session_hash - try: - html = self.net.http_GET(web_url).content - except urllib2.URLError, e: - common.addon.log_error('putlocker: got http error %d fetching %s' % - (e.code, web_url)) - return False - r = re.search('value="([0-9a-f]+?)" name="hash"', html) - if r: - session_hash = r.group(1) - else: - common.addon.log_error('putlocker: session hash not found') - return False + if self.get_setting('login') == 'true': + if self.login_stale(): + self.login() + self.net.set_cookies(self.cookie_file) + web_url = self.get_url(host, media_id) - #post session_hash - try: - html = self.net.http_POST(web_url, form_data={'hash': session_hash, - 'confirm': 'Continue as Free User'}).content - except urllib2.URLError, e: - common.addon.log_error('putlocker: got http error %d posting %s' % - (e.code, web_url)) - return False - - #find playlist code - r = re.search('\?stream=(.+?)\'', html) - if r: - playlist_code = r.group(1) - else: - common.addon.log_error('putlocker: playlist code not found') - return False - - #find download link - xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) - xml_url += playlist_code - try: - html = self.net.http_GET(xml_url).content - except urllib2.URLError, e: - common.addon.log_error('putlocker: got http error %d fetching %s' % - (e.code, xml_url)) - return False - r = re.search('url="(.+?)"', html) - if r: - flv_url = r.group(1) - else: - common.addon.log_error('putlocker: stream url not found') - return False - - return flv_url - - def get_url(self, host, media_id): - if 'putlocker' in host: - host = 'www.putlocker.com' - else: - host = 'www.sockshare.com' - return 'http://%s/file/%s' % (host, media_id) - - - def get_host_and_id(self, url): - r = re.search('//(.+?)/(?:file|embed)/([0-9A-Z]+)', url) - if r: - return r.groups() - else: - return False + #find session_hash + try: + html = self.net.http_GET(web_url).content + except urllib2.URLError, e: + common.addon.log_error('putlocker: got http error %d fetching %s' % (e.code, web_url)) + return False + + #Shortcut for logged in users + pattern = 'Download File' + link = re.search(pattern, html) + if link: + print 'Direct link found: %s' %link.group(1) + return 'http://www.putlocker.com%s' %link.group(1) + + r = re.search('value="([0-9a-f]+?)" name="hash"', html) + if r: + session_hash = r.group(1) + else: + common.addon.log_error('putlocker: session hash not found') + return False + + #post session_hash + try: + html = self.net.http_POST(web_url, form_data={'hash': session_hash, + 'confirm': 'Continue as Free User'}).content + except urllib2.URLError, e: + common.addon.log_error('putlocker: got http error %d posting %s' %(e.code, web_url)) + return False + + #find playlist code + r = re.search('\?stream=(.+?)\'', html) + if r: + playlist_code = r.group(1) + else: + common.addon.log_error('putlocker: playlist code not found') + return False + + #find download link + xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) + xml_url += playlist_code + try: + html = self.net.http_GET(xml_url).content + except urllib2.URLError, e: + common.addon.log_error('putlocker: got http error %d fetching %s'(e.code, xml_url)) + return False + + r = re.search('url="(.+?)"', html) + if r: + flv_url = r.group(1) + else: + common.addon.log_error('putlocker: stream url not found') + return False + + return "%s|User-Agent=%s"%(flv_url.replace('&','&'),'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - def valid_url(self, url, host): - return (re.match('http://(www.)?(putlocker|sockshare).com/' + - '(file|embed)/[0-9A-Z]+', url) or - 'putlocker' in host or 'sockshare' in host) - + def get_url(self, host, media_id): + if 'putlocker' in host: + host = 'www.putlocker.com' + else: + host = 'www.sockshare.com' + return 'http://%s/file/%s' % (host, media_id) + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:file|embed)/([0-9A-Z]+)', url) + if r: + return r.groups() + else: + return False + + def valid_url(self, url, host): + return (re.match('http://(www.)?(putlocker|sockshare).com/' + '(file|embed)/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host) + + def login_stale(self): + url = 'http://www.putlocker.com/cp.php' + if not os.path.exists(self.cookie_file): + return True + self.net.set_cookies(self.cookie_file) + source = self.net.http_GET(url).content + if re.search('(?:\( Pro \)|\( Free \))', source): + common.addon.log('Putlocker account appears to be logged in.') + return False + else: + return True + + #SiteAuth methods + def login(self): + if self.login_stale(): + print 'Need to login since session is invalid' + url = 'http://www.putlocker.com/authenticate.php?login' + source = self.net.http_GET(url).content + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + captcha_img = re.search('CAPTCHA.+?
', source, re.DOTALL).group(1) + captcha_img = 'http://www.putlocker.com%s' %re.sub('&','&',captcha_img) + local_captcha = os.path.join(common.profile_path, "captcha.img" ) + localFile = open(local_captcha, "wb") + localFile.write(self.net.http_GET(captcha_img).content) + localFile.close() + solver = InputWindow(captcha=local_captcha) + solution = solver.get() + if solution: + common.addon.log('Solution provided: %s' %solution) + data = {'user':self.get_setting('username'), 'pass':self.get_setting('password'), 'captcha_code':solution, 'remember':1, 'login_submit':'Login'} + response = self.net.http_POST(url, form_data=data) + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + print response.get_url() + else: + common.addon.log('Dialog was canceled') + return False + + + if re.search('OK', source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + xbmc.executebuiltin("Notification(' Putlocker Pro ', ' Login successful')") + return True + else: return False + else: return True + + #PluginSettings methods + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += '').findall(html)[0] + noscript=re.compile('",html) + if r: + return urlresolver.HostedMediaFile(r.group(1)).resolve() + + except BaseException, e: + common.addon.log_error(self.name + ' - Exception: %s' % e) + return self.unresolvable(code=0, msg='Exception: %s' % e) + + + def get_url(self, host, media_id): + #return 'http://www.desitvforums.net/video.php?id=%s' % media_id + return host + media_id + + + def get_host_and_id(self, url): + r = re.search('(http://www.(?:desitvforums.net)/(?:media/video|video|media/dtfdownload).php\?id=)([0-9a-z]+)',url) + #r = re.search('//(.+?)/(?:media/video.php\?id=|video.php\?id=|media/dtfdownload.php\?id=)' + + # '([0-9a-z]+)', url) + if r: + return r.groups() + else: + return False + + + def valid_url(self, url, host): + #return re.match('http://www.desitvforums.net/(media/video|video|media/dtfdownload).php\?id=' + + # '(?:[0-9a-z]+|width)', url) or 'desitvforums' in host + return re.match('http://www.(?:desitvforums.net)/(?:media/video|video|media/dtfdownload).php\?id=' + + '(?:[0-9a-z]+|width)', url) or 'desitvforums' in host + diff --git a/lib/urlresolver/plugins/indiahdtv.py b/lib/urlresolver/plugins/indiahdtv.py new file mode 100644 index 00000000..c8242a43 --- /dev/null +++ b/lib/urlresolver/plugins/indiahdtv.py @@ -0,0 +1,81 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from t0mm0.common.net import Net +import urllib2 +import urllib +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import xbmcgui +import urlresolver +import xbmc +import os + +logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +class VideoweedResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "indiahdtv.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + try: + resp = self.net.http_GET(web_url) + html = resp.content + if html.find('File Not Found') >= 0: + err_title = 'Content not available.' + err_message = 'The requested video was not found.' + common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + return self.unresolvable(1, err_message) + + r = re.search('data-publisher-id="(.+?)" data-video-id="(.+?)">',html) + if r: + # get video url + cdnUrl = "http://cdn.playwire.com/%s/embed/%s.js" % (r.groups()) + return urlresolver.HostedMediaFile(cdnUrl).resolve() + + except BaseException, e: + common.addon.log_error(self.name + ' - Exception: %s' % e) + return self.unresolvable(code=0, msg='Exception: %s' % e) + + + def get_url(self, host, media_id): + return '%s/video.php?id=%s' % (host,media_id) + + + def get_host_and_id(self, url): + r = re.search('(http://(?:www.)(?:.+?))/video.php\?id=([0-9A-Za-z]+)', url) + if r: + return r.groups() + else: + return False + + + def valid_url(self, url, host): + return re.match('http://(www.)?indiahdtv.com/(video.php\?id=)(?:[0-9a-z]+|width)', url) or 'indiahdtv' in host + diff --git a/lib/urlresolver/plugins/upbulk.py b/lib/urlresolver/plugins/upbulk.py new file mode 100644 index 00000000..0c59f9a7 --- /dev/null +++ b/lib/urlresolver/plugins/upbulk.py @@ -0,0 +1,84 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from t0mm0.common.net import Net +import urllib2 +import urllib +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import xbmcgui +import urlresolver +import xbmc +import os + +logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +class VideoweedResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "upbulk.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + try: + resp = self.net.http_GET(web_url) + html = resp.content + if html.find('File Not Found') >= 0: + err_title = 'Content not available.' + err_message = 'The requested video was not found.' + common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + return self.unresolvable(1, err_message) + + r = re.search("",html) + if r: + return urlresolver.HostedMediaFile(r.group(1)).resolve() + else: + r = re.search('',html) + if r: + return urlresolver.HostedMediaFile(r.group(1)).resolve() + + + except BaseException, e: + common.addon.log_error(self.name + ' - Exception: %s' % e) + return self.unresolvable(code=0, msg='Exception: %s' % e) + + + def get_url(self, host, media_id): + return host + media_id + + + def get_host_and_id(self, url): + r = re.search('(http://(?:www.|embed.)?(?:upbulk.com)/(?:media/video|video).php\?id=)([0-9a-z]+)',url) + if r: + return r.groups() + else: + return False + + + def valid_url(self, url, host): + return re.match('(http://(?:www.|embed.)?(?:upbulk.com)/(?:media/video|video).php\?id=)([0-9a-z]+)',url) or 'upbulk' in host + From 0e3815db1d9e6d740bc95fe7f3e723e5be5d8c40 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Wed, 6 Nov 2013 21:55:59 +0000 Subject: [PATCH 0387/1360] added jsunpack --- lib/urlresolver/plugins/movzap.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/urlresolver/plugins/movzap.py b/lib/urlresolver/plugins/movzap.py index 963194b6..541a7e37 100644 --- a/lib/urlresolver/plugins/movzap.py +++ b/lib/urlresolver/plugins/movzap.py @@ -21,11 +21,15 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin import urllib2 +import urllib from urlresolver import common from lib import jsunpack import xbmcgui import re import time +from lib import jsunpack +import xbmc +import os class MovzapZuzVideoResolver(Plugin, UrlResolver, PluginSettings): @@ -44,9 +48,19 @@ def get_media_url(self, host, media_id): resp = self.net.http_GET(web_url) html = resp.content - r = re.search('file: "(.+?)",', html) + # search for packed function + sPattern="" + r = re.search(sPattern, html, re.DOTALL) if r: - return r.group(1) + sUnpacked = jsunpack.unpack(r.group(1)) + r = re.search('file:"(.+?)",', sUnpacked) + if r: + return r.group(1) + else: + # search for file reference if present + r = re.search('file: "(.+?)",', html) + if r: + return r.group(1) raise Exception ('movzap|zuzvideo: could not obtain video url') @@ -63,19 +77,16 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): - return host + media_id + return '%s/%s' % (host,media_id) def get_host_and_id(self, url): - #r = re.search('http://(?:www.)?(.+?)/([0-9A-Za-z]+)', url) - r = re.search('(http://(?:www.|)(?:.+?)/)([0-9A-Za-z]+)', url) + r = re.search('(http://(?:www.|)(?:.+?))/([0-9A-Za-z]+)', 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('http://(?:www.|)(?:movzap|zuzvideo).com/[0-9A-Za-z]+', url) or 'movzap' in host or 'zuzvideo' in host - From 05b05b3173742eb2cf45f4927e8ac50689356aa2 Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Thu, 7 Nov 2013 02:47:58 +0100 Subject: [PATCH 0388/1360] update youwatch stream url no more appears in source --> create and add exec_javascript function to build stream url --- lib/urlresolver/plugins/youwatch.py | 58 +++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/lib/urlresolver/plugins/youwatch.py b/lib/urlresolver/plugins/youwatch.py index 16bb3f3a..b23295de 100644 --- a/lib/urlresolver/plugins/youwatch.py +++ b/lib/urlresolver/plugins/youwatch.py @@ -27,7 +27,40 @@ #SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - +class Base36: + + def __init__(self,ls=False): + self.ls = False + if ls : + self.ls = ls + + def base36encode(self,number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'): + """Converts an integer to a base36 string.""" + if not isinstance(number, (int, long)): + raise TypeError('number must be an integer') + base36 = '' + sign = '' + if number < 0: + sign = '-' + number = -number + if 0 <= number < len(alphabet): + return sign + alphabet[number] + while number != 0: + number, i = divmod(number, len(alphabet)) + base36 = alphabet[i] + base36 + return sign + base36 + + def base36decode(self,number): + return int(number, 36) + + def param36decode(self,match_object) : + if self.ls : + param = int(match_object.group(0), 36) + return str(self.ls[param]) + else : + return False + + class YouwatchResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "youwatch" @@ -40,14 +73,20 @@ def __init__(self): def get_media_url(self, host, media_id): base_url = 'http://'+host+'.org/embed-'+media_id+'.html' try: - soup = self.net.http_GET(base_url).content - r = re.findall('file: "(.+)?",',soup.decode('utf-8')) - if r : - stream_url = r[0].encode('utf-8') + soup = self.net.http_GET(base_url).content + html = soup.decode('utf-8') + jscript = re.findall("""function\(p,a,c,k,e,d\).*return p\}(.*)\)""",html) + if jscript : + lsParam = eval(jscript[0].encode('utf-8')) + flashvars = self.exec_javascript(lsParam) + r = re.findall('file:"(.*)",provider',flashvars) + if r : + stream_url = r[0].encode('utf-8') + else : + raise Exception ('File Not Found or removed') else : - raise Exception ('File Not Found or removed') - return stream_url - + raise Exception ('File Not Found or removed') + return stream_url except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) @@ -73,6 +112,9 @@ def get_host_and_id(self, url): else : return False + def exec_javascript(self,lsParam) : + return re.sub('[a-zA-Z0-9]+',Base36(lsParam[3]).param36decode,str(lsParam[0])) + def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False From 0d8a8f8ee6065d57ce5f0a109e959f149370f9a6 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:21:03 -0600 Subject: [PATCH 0389/1360] ChooseStream.com --- lib/urlresolver/plugins/cheesestream.py | 80 +++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 lib/urlresolver/plugins/cheesestream.py diff --git a/lib/urlresolver/plugins/cheesestream.py b/lib/urlresolver/plugins/cheesestream.py new file mode 100644 index 00000000..9b71e37b --- /dev/null +++ b/lib/urlresolver/plugins/cheesestream.py @@ -0,0 +1,80 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "cheesestream.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://cheesestream.com/embed_ext/videoweed/4f4d5748c8f56&width=600&height=438 + #self.pattern = 'http://((?:embed.)?cheesestream.com)/embed[_ext]*/([0-9a-zA-Z/\?=]+)[\&]*' + self.pattern = 'http://((?:www.)?cheesestream.com)/embed[_ext]*/([0-9a-zA-Z/\?=]+)[\&]*' + self.pattern2 = 'http://(embed.cheesestream.com)/([0-9a-zA-Z/\?=]+)[\&]*' + #self.pattern = 'http://((?:www.)?cheesestream.com)/embed/(.+?)' + + def get_url(self, host, media_id): + # http://embed.cheesestream.com/f0O8nd?client_file_id=349851 + if '/' in media_id: + return 'http://cheesestream.com/embed_ext/%s' % (media_id) + elif '?client_file_id=' in media_id: + #return 'http://embed.cheesestream.com/%s?client_file_id=%s' % (media_id.split("?client_file_id=")[0],media_id.split("?client_file_id=")[1]) + return 'http://embed.cheesestream.com/%s' % (media_id) + else: + return 'http://embed.cheesestream.com/%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + if 'embed.cheesestream.com/' in url: self.pattern=self.pattern2 + 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) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search("'file'\s*:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From dfb192db9a3d0502c11bc4623d96e2652fbfe161 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:21:13 -0600 Subject: [PATCH 0390/1360] Play44.net --- lib/urlresolver/plugins/play44_net.py | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 lib/urlresolver/plugins/play44_net.py diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py new file mode 100644 index 00000000..7d10e546 --- /dev/null +++ b/lib/urlresolver/plugins/play44_net.py @@ -0,0 +1,71 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "play44.net" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://play44.net/embed.php?w=718&h=438&vid=og/saint_seiya_omega_-_69.mp4 + self.pattern = 'http://((?:www.)?play44.net)/embed\.php?.*?vid=([0-9a-zA-Z_\-\./]+)[\?&]*' + #self.pattern = 'http://((?:www.)?videofun.me)/embed/(.+?)' + + def get_url(self, host, media_id): + return 'http://play44.net/embed.php?&vid=%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search("playlist:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + print stream_url + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From bd61b8514732e19584ad7db77c77f7ac97e3097f Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:21:23 -0600 Subject: [PATCH 0391/1360] UploadCrazy.net --- lib/urlresolver/plugins/uploadcrazynet.py | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 lib/urlresolver/plugins/uploadcrazynet.py diff --git a/lib/urlresolver/plugins/uploadcrazynet.py b/lib/urlresolver/plugins/uploadcrazynet.py new file mode 100644 index 00000000..ccaf21a2 --- /dev/null +++ b/lib/urlresolver/plugins/uploadcrazynet.py @@ -0,0 +1,72 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "uploadcrazy.net" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://video.vidcrazy.net/nvs.php?file=tenkai-knights06&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg + # http://video.vidcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg + # http://embeds.uploadcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/H1dqUbf.jpg + self.pattern = 'http://((?:embeds.)?uploadcrazy.net)/\D+.php\?file=([0-9a-zA-Z\-_]+)[&]*' + #self.pattern = 'http://((?:www.)?vidcrazy.net)/embed/(.+?)' + + def get_url(self, host, media_id): + return 'http://embeds.uploadcrazy.net/nvs.php?file=%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + #print html + r = re.search("'file'\s*:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From d9902fe8c140332f0b725f157d03afa12c979b62 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:21:34 -0600 Subject: [PATCH 0392/1360] VidCrazy.net --- lib/urlresolver/plugins/vidcrazynet.py | 71 ++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 lib/urlresolver/plugins/vidcrazynet.py diff --git a/lib/urlresolver/plugins/vidcrazynet.py b/lib/urlresolver/plugins/vidcrazynet.py new file mode 100644 index 00000000..53c5d9c6 --- /dev/null +++ b/lib/urlresolver/plugins/vidcrazynet.py @@ -0,0 +1,71 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "vidcrazy.net" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://video.vidcrazy.net/nvs.php?file=tenkai-knights06&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg + # http://video.vidcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg + self.pattern = 'http://((?:video.)?vidcrazy.net)/\D+.php\?file=([0-9a-zA-Z\-_]+)[&]*' + #self.pattern = 'http://((?:www.)?vidcrazy.net)/embed/(.+?)' + + def get_url(self, host, media_id): + return 'http://video.vidcrazy.net/nvs.php?file=%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + #print html + r = re.search("'file'\s*:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From 3615d9db35c561adb70d36a513bf7d2d1f4dfdbb Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:21:48 -0600 Subject: [PATCH 0393/1360] Video44.net --- lib/urlresolver/plugins/video44.py | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 lib/urlresolver/plugins/video44.py diff --git a/lib/urlresolver/plugins/video44.py b/lib/urlresolver/plugins/video44.py new file mode 100644 index 00000000..0ca1fb9b --- /dev/null +++ b/lib/urlresolver/plugins/video44.py @@ -0,0 +1,72 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common + +# Custom imports +import re + + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "video44.net" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://www.video44.net/gogo/?w=718&h=438&file=sakasama_no_patema_-_01.flv&sv=1 + self.pattern = 'http://((?:www.)?video44.net)/gogo/.*?file=([0-9a-zA-Z\-_\.]+).*?' + + def get_url(self, host, media_id): + return 'http://www.video44.net/gogo/?sv=1&file=%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search('file\s*:\s*"(.+?)"', html) + if r: + stream_url = r.group(1) #stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From dce7c36db1447a29559c352ff58e0ef8e601721f Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:22:11 -0600 Subject: [PATCH 0394/1360] VideoFun.me --- lib/urlresolver/plugins/videofun.py | 73 +++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 lib/urlresolver/plugins/videofun.py diff --git a/lib/urlresolver/plugins/videofun.py b/lib/urlresolver/plugins/videofun.py new file mode 100644 index 00000000..716d67df --- /dev/null +++ b/lib/urlresolver/plugins/videofun.py @@ -0,0 +1,73 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common + +# Custom imports +import re + + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "videofun.me" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://videofun.me/embed/d39d7848c33919c1c86fdc9a16603d28?w=718&h=438 + self.pattern = 'http://((?:www.)?videofun.me)/embed/([0-9a-zA-Z]+)[\?]*' + #self.pattern = 'http://((?:www.)?videofun.me)/embed/(.+?)' + + def get_url(self, host, media_id): + return 'http://videofun.me/embed/%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search('url\s*:\s*"(.+?)",\s*autoPlay:\s*false', html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From a8f16ee916e73e33c89dc7d4027907cf301ab080 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:22:18 -0600 Subject: [PATCH 0395/1360] VidUp.org --- lib/urlresolver/plugins/vidup_org.py | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 lib/urlresolver/plugins/vidup_org.py diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py new file mode 100644 index 00000000..6665e455 --- /dev/null +++ b/lib/urlresolver/plugins/vidup_org.py @@ -0,0 +1,71 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common + +# Custom imports +import re + + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "vidup.org" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://vidup.org/embed.php?file=f50163b6&w=550&h=420&bg=http://www.animestatic.tv/images/animestatic.jpg + self.pattern = 'http://((?:www.)?vidup.org)/embed.php?.*?file=([0-9a-zA-Z\-_\.]+).*?' + + def get_url(self, host, media_id): + return 'http://vidup.org/embed.php?file=%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search('clip:\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*"(.+?)",\s*\n*\s*provider:', html) + if r: + stream_url = r.group(1) #stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From f13000a430fc4bf3ca290ec1a3ecff2655dea41f Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:22:29 -0600 Subject: [PATCH 0396/1360] VidZur.com --- lib/urlresolver/plugins/vidzur.py | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lib/urlresolver/plugins/vidzur.py diff --git a/lib/urlresolver/plugins/vidzur.py b/lib/urlresolver/plugins/vidzur.py new file mode 100644 index 00000000..0ca64c9c --- /dev/null +++ b/lib/urlresolver/plugins/vidzur.py @@ -0,0 +1,70 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "vidzur.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://vidzur.com/embed.php?w=718&h=438&vid=og1/zetsuen_no_tempest_-_24.flv + self.pattern = 'http://.*?(vidzur.com)/embed\.php\?.*?vid=([0-9a-zA-Z/_\-\.]*)[\?&]*' + #self.pattern = 'http://((?:www.)?videofun.me)/embed/(.+?)' + + def get_url(self, host, media_id): + return 'http://vidzur.com/embed.php?vid=%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: return r.groups() + else: return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return self.unresolvable() #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) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search("playlist\s*:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\n*\s*url:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable() #return False + return stream_url + \ No newline at end of file From 81a1046f1d0bdd800e9455dc4a739845de09b70e Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 6 Nov 2013 20:22:47 -0600 Subject: [PATCH 0397/1360] YourUpload.com --- lib/urlresolver/plugins/yourupload.py | 120 ++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 lib/urlresolver/plugins/yourupload.py diff --git a/lib/urlresolver/plugins/yourupload.py b/lib/urlresolver/plugins/yourupload.py new file mode 100644 index 00000000..e01518f0 --- /dev/null +++ b/lib/urlresolver/plugins/yourupload.py @@ -0,0 +1,120 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "yourupload.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + # http://yourupload.com/embed/a67563063236469c65a94a1dfbbb129b&width=718&height=438 + # http://yourupload.com/embed_ext/videoweed/4f4d574ed3266&width=718&height=438 + # http://embed.yourupload.com/2o6B1y?client_file_id=380101&width=600&height=438 + self.pattern = 'http://((?:www.)?yourupload.com)/embed/([0-9a-zA-Z]+)[\?&]*' + self.pattern2 = 'http://((?:www.)?yourupload.com)/embed_ext/[0-9A-Za-z]+/([0-9a-zA-Z]+)[\?&]*' + #self.pattern3 = 'http://embed.(yourupload.com)/([0-9a-zA-Z]+\?.*?client_file_id=[0-9a-zA-Z]+)[&]*' + #self.pattern3 = 'http://((?:embed.)?yourupload.com)/(.+?client_file_id.+?)' + self.pattern3 = 'http://embed.(yourupload.com)/(.+?)' + #self.pattern = 'http://((?:www.)?yourupload.com)/embed/(.+?)' + + def get_url(self, host, media_id): + common.addon.log(host+' - media_id: %s' % media_id) + if len(media_id) > 5: common.addon.log_notice('1st 4 digits: '+media_id[:4]) + if media_id[:4]=='ext_': + common.addon.log_notice(media_id[4:]+': media_id is for an external video source') + return 'http://yourupload.com/embed_ext/videoweed/%s' % (media_id[4:]) + elif ('___' in media_id): + r=media_id.split('___')[0] + s=media_id.split('___')[1] + common.addon.log_notice(media_id+': media_id is for 2 ID types') + return 'http://embed.yourupload.com/%s?client_file_id=%s' % (r,s) + elif ('client_file_id' in media_id): + common.addon.log_notice(media_id+': media_id is for 2 ID types') + return 'http://embed.yourupload.com/%s' % (media_id) + elif ('=' in media_id) or ('&' in media_id) or ('?' in media_id) or ('client' in media_id): + common.addon.log_notice(media_id+': media_id is for 2 ID types') + return 'http://embed.yourupload.com/%s' % (media_id) + else: return 'http://yourupload.com/embed/%s' % (media_id) + + def get_host_and_id(self, url): + common.addon.log_notice('get host and id from: %s' % url) + if 'yourupload.com/embed_ext' in url: r = re.search(self.pattern2, url); s='ext_' + elif ('embed.yourupload.com' in url): + r = re.search('/([0-9a-zA-Z]+)\?', url).group(1) + s = re.search('client_file_id=([0-9a-zA-Z]+)', url).group(1) + return [r+'___'+s,'embed.yourupload.com'] + elif ('embed.yourupload.com/' in url): + r = url.split('yourupload.com/')[1]; s='' + return [r,'embed.yourupload.com'] + elif ('embed.yourupload.com' in url): r = re.search(self.pattern3, url); s='' + else: r = re.search(self.pattern, url); s='' + #if r: return s+r.groups() + if r: return [r.group(1),s+r.group(2)] + else: + common.addon.log_notice('failed to get host and id: %s' % url) + #return 'failed to get host and id: %s' + return self.unresolvable() #return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False + elif ('yourupload.com' in url) or ('yourupload.com' in host): return True + elif ('yourupload.com' in url) and ('embed' in url): return True + elif 'yourupload.com/embed' in url: return True + elif 'embed.yourupload.com' in url: return True + elif 'yourupload.com/embed_ext/' in url: return re.match(self.pattern2, url) or self.name in host + elif ('http://embed.yourupload.com/' in url) and ('client_file_id' in url): return re.match(self.pattern3, url) or self.name in host + else: return re.match(self.pattern, url) or self.name in host + + def get_media_url(self, host, media_id): + common.addon.log_notice(host+' - media_id: %s' % media_id) + web_url = self.get_url(host, media_id) + post_url = web_url + hostname = self.name + common.addon.log_notice(hostname+' - web_url: %s' % web_url) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable() #return False + try: + if ' Date: Thu, 7 Nov 2013 20:40:26 +0000 Subject: [PATCH 0398/1360] added isenabled check on valid_url call --- lib/urlresolver/plugins/cdnplaywire.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/plugins/cdnplaywire.py b/lib/urlresolver/plugins/cdnplaywire.py index 798fd9b9..ec80c26d 100644 --- a/lib/urlresolver/plugins/cdnplaywire.py +++ b/lib/urlresolver/plugins/cdnplaywire.py @@ -81,5 +81,6 @@ def get_host_and_id(self, url): def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False return re.match('http://cdn.playwire.com/(.+?)/embed/(.+?).js',url) From 124fe0498140ad8c1c7159483b0ffa69ee4a2846 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Thu, 7 Nov 2013 20:40:31 +0000 Subject: [PATCH 0399/1360] added isenabled check on valid_url call --- lib/urlresolver/plugins/desitvforums.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/desitvforums.py b/lib/urlresolver/plugins/desitvforums.py index cbf598f1..29665956 100644 --- a/lib/urlresolver/plugins/desitvforums.py +++ b/lib/urlresolver/plugins/desitvforums.py @@ -75,8 +75,7 @@ def get_host_and_id(self, url): def valid_url(self, url, host): - #return re.match('http://www.desitvforums.net/(media/video|video|media/dtfdownload).php\?id=' + - # '(?:[0-9a-z]+|width)', url) or 'desitvforums' in host + if self.get_setting('enabled') == 'false': return False return re.match('http://www.(?:desitvforums.net)/(?:media/video|video|media/dtfdownload).php\?id=' + '(?:[0-9a-z]+|width)', url) or 'desitvforums' in host From 4c5cd47d6deb32876812c11960771e5ada838310 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Thu, 7 Nov 2013 20:40:36 +0000 Subject: [PATCH 0400/1360] added isenabled check on valid_url call --- lib/urlresolver/plugins/indiahdtv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/plugins/indiahdtv.py b/lib/urlresolver/plugins/indiahdtv.py index c8242a43..e1aa267b 100644 --- a/lib/urlresolver/plugins/indiahdtv.py +++ b/lib/urlresolver/plugins/indiahdtv.py @@ -77,5 +77,6 @@ def get_host_and_id(self, url): def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False return re.match('http://(www.)?indiahdtv.com/(video.php\?id=)(?:[0-9a-z]+|width)', url) or 'indiahdtv' in host From 95c037782ba0243c6ce62bee40cc62ffc9d56e57 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Thu, 7 Nov 2013 20:40:41 +0000 Subject: [PATCH 0401/1360] added isenabled check on valid_url call --- lib/urlresolver/plugins/upbulk.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/plugins/upbulk.py b/lib/urlresolver/plugins/upbulk.py index 0c59f9a7..7fe1cd24 100644 --- a/lib/urlresolver/plugins/upbulk.py +++ b/lib/urlresolver/plugins/upbulk.py @@ -80,5 +80,6 @@ def get_host_and_id(self, url): def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False return re.match('(http://(?:www.|embed.)?(?:upbulk.com)/(?:media/video|video).php\?id=)([0-9a-z]+)',url) or 'upbulk' in host From bc686905812329937b1e51fa1146af733667ff88 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Thu, 7 Nov 2013 22:23:07 +0000 Subject: [PATCH 0402/1360] added missing error_logo initialization --- lib/urlresolver/plugins/movzap.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/urlresolver/plugins/movzap.py b/lib/urlresolver/plugins/movzap.py index 541a7e37..a4a3053e 100644 --- a/lib/urlresolver/plugins/movzap.py +++ b/lib/urlresolver/plugins/movzap.py @@ -31,6 +31,8 @@ import xbmc import os +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class MovzapZuzVideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] From 02155b49a7e59c39caafbf1da473d246a04e34b8 Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Thu, 7 Nov 2013 22:25:54 +0000 Subject: [PATCH 0403/1360] added missing error_logo initialization --- lib/urlresolver/plugins/cdnplaywire.py | 5 +++-- lib/urlresolver/plugins/desitvforums.py | 5 ++++- lib/urlresolver/plugins/indiahdtv.py | 5 +++-- lib/urlresolver/plugins/upbulk.py | 5 +++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/urlresolver/plugins/cdnplaywire.py b/lib/urlresolver/plugins/cdnplaywire.py index ec80c26d..e448866b 100644 --- a/lib/urlresolver/plugins/cdnplaywire.py +++ b/lib/urlresolver/plugins/cdnplaywire.py @@ -29,7 +29,8 @@ import xbmc import os -logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class VideoweedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -50,7 +51,7 @@ def get_media_url(self, host, media_id): err_title = 'Content not available.' err_message = 'The requested video was not found.' common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') return self.unresolvable(1, err_message) # get the video location diff --git a/lib/urlresolver/plugins/desitvforums.py b/lib/urlresolver/plugins/desitvforums.py index 29665956..b5dd580a 100644 --- a/lib/urlresolver/plugins/desitvforums.py +++ b/lib/urlresolver/plugins/desitvforums.py @@ -28,6 +28,9 @@ import xbmc import os +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + class DesitvforumsResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "desitvforums.net" @@ -47,7 +50,7 @@ def get_media_url(self, host, media_id): err_title = 'Content not available.' err_message = 'The requested video was not found.' common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') return self.unresolvable(1, err_message) r = re.search("",html) diff --git a/lib/urlresolver/plugins/indiahdtv.py b/lib/urlresolver/plugins/indiahdtv.py index e1aa267b..14af7df0 100644 --- a/lib/urlresolver/plugins/indiahdtv.py +++ b/lib/urlresolver/plugins/indiahdtv.py @@ -29,7 +29,8 @@ import xbmc import os -logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class VideoweedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -50,7 +51,7 @@ def get_media_url(self, host, media_id): err_title = 'Content not available.' err_message = 'The requested video was not found.' common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') return self.unresolvable(1, err_message) r = re.search('data-publisher-id="(.+?)" data-video-id="(.+?)">',html) diff --git a/lib/urlresolver/plugins/upbulk.py b/lib/urlresolver/plugins/upbulk.py index 7fe1cd24..670e4287 100644 --- a/lib/urlresolver/plugins/upbulk.py +++ b/lib/urlresolver/plugins/upbulk.py @@ -29,7 +29,8 @@ import xbmc import os -logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class VideoweedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -50,7 +51,7 @@ def get_media_url(self, host, media_id): err_title = 'Content not available.' err_message = 'The requested video was not found.' common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') return self.unresolvable(1, err_message) r = re.search("",html) From e198130410776b3fd4071520c16a81a3449cb034 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Thu, 7 Nov 2013 19:12:52 -0600 Subject: [PATCH 0404/1360] anime and cartoon host plugin package --- lib/urlresolver/plugins/cheesestream.py | 6 +++--- lib/urlresolver/plugins/play44_net.py | 7 +++---- lib/urlresolver/plugins/uploadcrazynet.py | 6 +++--- lib/urlresolver/plugins/vidcrazynet.py | 6 +++--- lib/urlresolver/plugins/video44.py | 6 +++--- lib/urlresolver/plugins/videofun.py | 6 +++--- lib/urlresolver/plugins/vidup_org.py | 7 +++---- lib/urlresolver/plugins/vidzur.py | 6 +++--- lib/urlresolver/plugins/yourupload.py | 6 +++--- 9 files changed, 27 insertions(+), 29 deletions(-) diff --git a/lib/urlresolver/plugins/cheesestream.py b/lib/urlresolver/plugins/cheesestream.py index 9b71e37b..2cb502d4 100644 --- a/lib/urlresolver/plugins/cheesestream.py +++ b/lib/urlresolver/plugins/cheesestream.py @@ -51,10 +51,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + if self.get_setting('enabled') == 'false': return False if 'embed.cheesestream.com/' in url: self.pattern=self.pattern2 return re.match(self.pattern, url) or self.name in host @@ -75,6 +75,6 @@ def get_media_url(self, host, media_id): stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url \ No newline at end of file diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py index 7d10e546..5f3262b4 100644 --- a/lib/urlresolver/plugins/play44_net.py +++ b/lib/urlresolver/plugins/play44_net.py @@ -42,10 +42,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -66,6 +66,5 @@ def get_media_url(self, host, media_id): print stream_url else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url - \ No newline at end of file diff --git a/lib/urlresolver/plugins/uploadcrazynet.py b/lib/urlresolver/plugins/uploadcrazynet.py index ccaf21a2..a012a1f2 100644 --- a/lib/urlresolver/plugins/uploadcrazynet.py +++ b/lib/urlresolver/plugins/uploadcrazynet.py @@ -44,10 +44,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -67,6 +67,6 @@ def get_media_url(self, host, media_id): stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url \ No newline at end of file diff --git a/lib/urlresolver/plugins/vidcrazynet.py b/lib/urlresolver/plugins/vidcrazynet.py index 53c5d9c6..2a895d82 100644 --- a/lib/urlresolver/plugins/vidcrazynet.py +++ b/lib/urlresolver/plugins/vidcrazynet.py @@ -43,10 +43,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -66,6 +66,6 @@ def get_media_url(self, host, media_id): stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url \ No newline at end of file diff --git a/lib/urlresolver/plugins/video44.py b/lib/urlresolver/plugins/video44.py index 0ca1fb9b..2f4513dc 100644 --- a/lib/urlresolver/plugins/video44.py +++ b/lib/urlresolver/plugins/video44.py @@ -44,10 +44,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -67,6 +67,6 @@ def get_media_url(self, host, media_id): stream_url = r.group(1) #stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url \ No newline at end of file diff --git a/lib/urlresolver/plugins/videofun.py b/lib/urlresolver/plugins/videofun.py index 716d67df..82c866ef 100644 --- a/lib/urlresolver/plugins/videofun.py +++ b/lib/urlresolver/plugins/videofun.py @@ -45,10 +45,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -68,6 +68,6 @@ def get_media_url(self, host, media_id): stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url \ No newline at end of file diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index 6665e455..7343213a 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -44,10 +44,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -66,6 +66,5 @@ def get_media_url(self, host, media_id): stream_url = r.group(1) #stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url - \ No newline at end of file diff --git a/lib/urlresolver/plugins/vidzur.py b/lib/urlresolver/plugins/vidzur.py index 0ca64c9c..1091b975 100644 --- a/lib/urlresolver/plugins/vidzur.py +++ b/lib/urlresolver/plugins/vidzur.py @@ -42,10 +42,10 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: return r.groups() - else: return self.unresolvable() #return False + else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return self.unresolvable() #return False + 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): @@ -65,6 +65,6 @@ def get_media_url(self, host, media_id): stream_url = urllib.unquote_plus(r.group(1)) else: common.addon.log_error(hostname+': stream url not found') - return self.unresolvable() #return False + return self.unresolvable(code=0, msg='no file located') #return False return stream_url \ No newline at end of file diff --git a/lib/urlresolver/plugins/yourupload.py b/lib/urlresolver/plugins/yourupload.py index e01518f0..4e0a4e09 100644 --- a/lib/urlresolver/plugins/yourupload.py +++ b/lib/urlresolver/plugins/yourupload.py @@ -79,7 +79,7 @@ def get_host_and_id(self, url): else: common.addon.log_notice('failed to get host and id: %s' % url) #return 'failed to get host and id: %s' - return self.unresolvable() #return False + return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False @@ -103,7 +103,7 @@ def get_media_url(self, host, media_id): html = resp.content except urllib2.URLError, e: common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable() #return False + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False try: if ' Date: Fri, 8 Nov 2013 08:16:41 +0000 Subject: [PATCH 0405/1360] bug fix to regex a url --- lib/urlresolver/plugins/upbulk.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/upbulk.py b/lib/urlresolver/plugins/upbulk.py index 670e4287..e682008b 100644 --- a/lib/urlresolver/plugins/upbulk.py +++ b/lib/urlresolver/plugins/upbulk.py @@ -54,13 +54,13 @@ def get_media_url(self, host, media_id): xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') return self.unresolvable(1, err_message) - r = re.search("",html) + r = re.search("",html,re.DOTALL) if r: return urlresolver.HostedMediaFile(r.group(1)).resolve() else: - r = re.search('',html) + r = re.search('',html,re.DOTALL) if r: - return urlresolver.HostedMediaFile(r.group(1)).resolve() + return urlresolver.HostedMediaFile(re.sub('\s+','',r.group(1))).resolve() except BaseException, e: From 86c2ac112302e1b7802c64310fc17c59eb3b350c Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Fri, 8 Nov 2013 10:12:12 +0000 Subject: [PATCH 0406/1360] removed duplicate cdnplaywire.py --- lib/urlresolver/plugins/cdnplaywire.py | 87 -------------------------- 1 file changed, 87 deletions(-) delete mode 100644 lib/urlresolver/plugins/cdnplaywire.py diff --git a/lib/urlresolver/plugins/cdnplaywire.py b/lib/urlresolver/plugins/cdnplaywire.py deleted file mode 100644 index e448866b..00000000 --- a/lib/urlresolver/plugins/cdnplaywire.py +++ /dev/null @@ -1,87 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import re -from t0mm0.common.net import Net -import urllib2 -import urllib -from urlresolver import common -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import xbmcgui -import urlresolver -import xbmc -import os - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -class VideoweedResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "cdn.playwire.com" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - try: - resp = self.net.http_GET(web_url) - html = resp.content - if html.find('File Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') - return self.unresolvable(1, err_message) - - # get the video location - r = re.search('mp4:(.+?)',html) - if r: - videoId = r.group(1) - r = re.search('(.+?)/embed/(.+?)',media_id) - publisherId = r.group(1) - return 'http://cdn.playwire.com/%s/%s' % (publisherId,videoId) - - except BaseException, e: - common.addon.log_error(self.name + ' - Exception: %s' % e) - return self.unresolvable(code=0, msg='Exception: %s' % e) - - - def get_url(self, host, media_id): - return '%s/%s.xml' % (host,media_id) - - - def get_host_and_id(self, url): - #r = re.search('(http://(?:.+?))/(.+?)/embed/(.+?).js', url) - r = re.search('(http://(?:.+?))/((?:.+?)/embed/(?:.+?)).js', url) - if r: - #return (r.group(1),(r.group(2),r.group(3))) - return r.groups() - else: - return False - - - def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': return False - return re.match('http://cdn.playwire.com/(.+?)/embed/(.+?).js',url) - From 6f9d6d1fee641012a79c39dd2f5596daddf80844 Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Fri, 8 Nov 2013 14:52:53 +0100 Subject: [PATCH 0407/1360] ecostream fixed --- lib/urlresolver/plugins/ecostream.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/ecostream.py b/lib/urlresolver/plugins/ecostream.py index b83229ff..d0170773 100644 --- a/lib/urlresolver/plugins/ecostream.py +++ b/lib/urlresolver/plugins/ecostream.py @@ -52,11 +52,15 @@ def get_media_url(self, host, media_id): % msg, delay=5000, image=error_logo) return self.unresolvable(code = 1, msg = msg) self.net.save_cookies(self.cookie_file) + r = re.search('data-tpm="([^"]+)"', html) + if not r: + raise Exception ('Formvalue not found') + tpm = r.group(1) # emulate click on button "Start Stream" postHeader = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'}) web_url = 'http://www.ecostream.tv/xhr/video/get' self.net.set_cookies(self.cookie_file) - html = self.net.http_POST(web_url,{'id':media_id}, headers = postHeader).content + html = self.net.http_POST(web_url,{'id':media_id, 'tpm':tpm}, headers = postHeader).content sPattern = '"url":"([^"]+)"' r = re.search(sPattern, html) if not r: From 86e0cc845942074c41e36aa314edf3dff07c80dd Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Fri, 8 Nov 2013 17:54:54 +0100 Subject: [PATCH 0408/1360] 2nd ecostream fix today --- lib/urlresolver/plugins/ecostream.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/ecostream.py b/lib/urlresolver/plugins/ecostream.py index d0170773..34a965e2 100644 --- a/lib/urlresolver/plugins/ecostream.py +++ b/lib/urlresolver/plugins/ecostream.py @@ -52,10 +52,15 @@ def get_media_url(self, host, media_id): % msg, delay=5000, image=error_logo) return self.unresolvable(code = 1, msg = msg) self.net.save_cookies(self.cookie_file) - r = re.search('data-tpm="([^"]+)"', html) + r = re.search("analytics='([^']+)'", html) if not r: raise Exception ('Formvalue not found') - tpm = r.group(1) + part1 = r.group(1) + r = re.search("adslotid='([^']+)';", html) + if not r: + raise Exception ('Formvalue not found') + part2 = r.group(1) + tpm = part1+part2 # emulate click on button "Start Stream" postHeader = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'}) web_url = 'http://www.ecostream.tv/xhr/video/get' From dd3ac115cca985a5d12baf97fad109822e5eaaed Mon Sep 17 00:00:00 2001 From: Jasmeet Singh Anand Date: Sun, 10 Nov 2013 22:36:36 +0000 Subject: [PATCH 0409/1360] updated regex search --- lib/urlresolver/plugins/indiahdtv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/indiahdtv.py b/lib/urlresolver/plugins/indiahdtv.py index 14af7df0..32ba04fe 100644 --- a/lib/urlresolver/plugins/indiahdtv.py +++ b/lib/urlresolver/plugins/indiahdtv.py @@ -54,10 +54,10 @@ def get_media_url(self, host, media_id): xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') return self.unresolvable(1, err_message) - r = re.search('data-publisher-id="(.+?)" data-video-id="(.+?)">',html) + r = re.search('data-publisher-id="(.+?)" data-video-id="(.+?)"> Date: Mon, 11 Nov 2013 11:35:53 +0100 Subject: [PATCH 0410/1360] fixed rd login rd now uses md5 for pass --- lib/urlresolver/plugins/realdebrid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 12a10ae9..8e1376f0 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -138,7 +138,8 @@ def login(self): if self.checkLogin(): try: common.addon.log_debug('Need to login since session is invalid') - login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : self.get_setting('password')}) + import hashlib + login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : hashlib.md5(self.get_setting('password')).hexdigest()}) url = 'https://real-debrid.com/ajax/login.php?' + login_data source = self.net.http_GET(url).content if re.search('OK', source): From d2b9735443ead3ee2ce6b5e52bf0eeb11b62e510 Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Mon, 11 Nov 2013 13:33:54 +0100 Subject: [PATCH 0411/1360] Update ecostream.py --- lib/urlresolver/plugins/ecostream.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/ecostream.py b/lib/urlresolver/plugins/ecostream.py index 34a965e2..84f54a93 100644 --- a/lib/urlresolver/plugins/ecostream.py +++ b/lib/urlresolver/plugins/ecostream.py @@ -63,7 +63,7 @@ def get_media_url(self, host, media_id): tpm = part1+part2 # emulate click on button "Start Stream" postHeader = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'}) - web_url = 'http://www.ecostream.tv/xhr/video/get' + web_url = 'http://www.ecostream.tv/xhr/video/getstream' self.net.set_cookies(self.cookie_file) html = self.net.http_POST(web_url,{'id':media_id, 'tpm':tpm}, headers = postHeader).content sPattern = '"url":"([^"]+)"' @@ -98,4 +98,4 @@ def get_host_and_id(self, url): 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 \ No newline at end of file + return re.match(self.pattern, url) or self.name in host From f47858563b91b3c7d7e4405f05a2918b4046d98d Mon Sep 17 00:00:00 2001 From: Eldorados Date: Mon, 11 Nov 2013 17:52:17 -0500 Subject: [PATCH 0412/1360] removed resolvers - not intended for urlresolver --- lib/urlresolver/plugins/desitvforums.py | 84 ------------------------- lib/urlresolver/plugins/indiahdtv.py | 83 ------------------------ 2 files changed, 167 deletions(-) delete mode 100644 lib/urlresolver/plugins/desitvforums.py delete mode 100644 lib/urlresolver/plugins/indiahdtv.py diff --git a/lib/urlresolver/plugins/desitvforums.py b/lib/urlresolver/plugins/desitvforums.py deleted file mode 100644 index b5dd580a..00000000 --- a/lib/urlresolver/plugins/desitvforums.py +++ /dev/null @@ -1,84 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import re -from t0mm0.common.net import Net -import urllib2 -from urlresolver import common -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import xbmcgui -import urlresolver -import xbmc -import os - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -class DesitvforumsResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "desitvforums.net" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - try: - resp = self.net.http_GET(web_url) - html = resp.content - if html.find('File Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') - return self.unresolvable(1, err_message) - - r = re.search("",html) - if r: - return urlresolver.HostedMediaFile(r.group(1)).resolve() - - except BaseException, e: - common.addon.log_error(self.name + ' - Exception: %s' % e) - return self.unresolvable(code=0, msg='Exception: %s' % e) - - - def get_url(self, host, media_id): - #return 'http://www.desitvforums.net/video.php?id=%s' % media_id - return host + media_id - - - def get_host_and_id(self, url): - r = re.search('(http://www.(?:desitvforums.net)/(?:media/video|video|media/dtfdownload).php\?id=)([0-9a-z]+)',url) - #r = re.search('//(.+?)/(?:media/video.php\?id=|video.php\?id=|media/dtfdownload.php\?id=)' + - # '([0-9a-z]+)', 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('http://www.(?:desitvforums.net)/(?:media/video|video|media/dtfdownload).php\?id=' + - '(?:[0-9a-z]+|width)', url) or 'desitvforums' in host - diff --git a/lib/urlresolver/plugins/indiahdtv.py b/lib/urlresolver/plugins/indiahdtv.py deleted file mode 100644 index 32ba04fe..00000000 --- a/lib/urlresolver/plugins/indiahdtv.py +++ /dev/null @@ -1,83 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import re -from t0mm0.common.net import Net -import urllib2 -import urllib -from urlresolver import common -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import xbmcgui -import urlresolver -import xbmc -import os - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -class VideoweedResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "indiahdtv.com" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - try: - resp = self.net.http_GET(web_url) - html = resp.content - if html.find('File Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') - return self.unresolvable(1, err_message) - - r = re.search('data-publisher-id="(.+?)" data-video-id="(.+?)"> Date: Tue, 12 Nov 2013 21:51:14 +0100 Subject: [PATCH 0413/1360] removed some logs in 180u --- lib/urlresolver/plugins/180upload.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/urlresolver/plugins/180upload.py b/lib/urlresolver/plugins/180upload.py index 3498d2b0..bbdffc49 100644 --- a/lib/urlresolver/plugins/180upload.py +++ b/lib/urlresolver/plugins/180upload.py @@ -123,13 +123,10 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): - common.addon.log('180upload: in get_url %s %s' % (host, media_id)) return 'http://www.180upload.com/%s' % media_id def get_host_and_id(self, url): - common.addon.log('180upload: in get_host_and_id %s' % (url)) - r = re.search('http://(.+?)/embed-([\w]+)-', url) if r: return r.groups() From a391e30750f349bd3e9e3773f2c0715b8359a558 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Fri, 15 Nov 2013 08:46:07 -0500 Subject: [PATCH 0414/1360] removed upbulk --- lib/urlresolver/plugins/upbulk.py | 86 ------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 lib/urlresolver/plugins/upbulk.py diff --git a/lib/urlresolver/plugins/upbulk.py b/lib/urlresolver/plugins/upbulk.py deleted file mode 100644 index e682008b..00000000 --- a/lib/urlresolver/plugins/upbulk.py +++ /dev/null @@ -1,86 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import re -from t0mm0.common.net import Net -import urllib2 -import urllib -from urlresolver import common -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import xbmcgui -import urlresolver -import xbmc -import os - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -class VideoweedResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "upbulk.com" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - try: - resp = self.net.http_GET(web_url) - html = resp.content - if html.find('File Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+error_logo+')') - return self.unresolvable(1, err_message) - - r = re.search("",html,re.DOTALL) - if r: - return urlresolver.HostedMediaFile(r.group(1)).resolve() - else: - r = re.search('',html,re.DOTALL) - if r: - return urlresolver.HostedMediaFile(re.sub('\s+','',r.group(1))).resolve() - - - except BaseException, e: - common.addon.log_error(self.name + ' - Exception: %s' % e) - return self.unresolvable(code=0, msg='Exception: %s' % e) - - - def get_url(self, host, media_id): - return host + media_id - - - def get_host_and_id(self, url): - r = re.search('(http://(?:www.|embed.)?(?:upbulk.com)/(?:media/video|video).php\?id=)([0-9a-z]+)',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('(http://(?:www.|embed.)?(?:upbulk.com)/(?:media/video|video).php\?id=)([0-9a-z]+)',url) or 'upbulk' in host - From c337797699aa0d131d58565192c27789566ee47e Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Sun, 24 Nov 2013 00:34:39 +0100 Subject: [PATCH 0415/1360] update purevid.py --- lib/urlresolver/plugins/purevid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/purevid.py b/lib/urlresolver/plugins/purevid.py index 9dcaf96d..4d2614c3 100644 --- a/lib/urlresolver/plugins/purevid.py +++ b/lib/urlresolver/plugins/purevid.py @@ -62,9 +62,9 @@ def get_media_url(self, host, media_id): raise Exception ('got http error %d fetching %s' % (e.code, web_url)) data = json.loads(html) if self.get_setting('quality') == '0' : - url = data['clip']['bitrates'][-1]['url'] - else : url = data['clip']['bitrates'][0]['url'] + else : + url = data['clip']['bitrates'][-1]['url'] params = '' for val in data['plugins']['lighttpd']['params'] : params += val['name'] + '=' + val['value'] + '&' From 9772bfddcce266c5858db7b09668eb37db6059b9 Mon Sep 17 00:00:00 2001 From: BagiraHun Date: Mon, 25 Nov 2013 13:01:24 +0100 Subject: [PATCH 0416/1360] divxstage: fixed regexp & conditions --- lib/urlresolver/plugins/divxstage.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/divxstage.py b/lib/urlresolver/plugins/divxstage.py index 798d818d..a1102829 100644 --- a/lib/urlresolver/plugins/divxstage.py +++ b/lib/urlresolver/plugins/divxstage.py @@ -71,12 +71,13 @@ def get_url(self, host, media_id): return 'http://www.divxstage.eu/video/%s' % media_id def get_host_and_id(self, url): - r = re.search('//(.+?)/(?:video/([0-9a-z]+)|[\?&]v=([^\?&]+))', url) - if r and 'embed' in r.group(1): - return r.group(1),r.group(3) + r = re.search('//(.+?)/(?:video/([0-9a-z]+)|embed.php\?v=([^\?&]+))', url) + if r: + if 'embed' in r.group(1): + return r.group(1),r.group(3) + else: + return r.group(1),r.group(2) else: - return r.group(1),r.group(2) - if not r: return False def valid_url(self, url, host): From 902886afa374fed9cc90395165d87c5f6ce93157 Mon Sep 17 00:00:00 2001 From: Irfan Charania Date: Wed, 25 Dec 2013 13:13:09 -0800 Subject: [PATCH 0417/1360] update vimeo to account for urls like vimeo.com/video/#### --- lib/urlresolver/plugins/vimeo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vimeo.py b/lib/urlresolver/plugins/vimeo.py index bc80f1bc..964bad7f 100644 --- a/lib/urlresolver/plugins/vimeo.py +++ b/lib/urlresolver/plugins/vimeo.py @@ -56,7 +56,7 @@ def get_host_and_id(self, url): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - return re.match('http://(.+)?vimeo.com/[0-9]+', + return re.match('http://(.+)?vimeo.com/(video\/)?[0-9]+', url) or 'vimeo' in host def get_settings_xml(self): From 1176727830b4154e9e4933cff2e0deb05d12a68f Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Thu, 23 Jan 2014 16:02:50 +0100 Subject: [PATCH 0418/1360] update Youwatch + add greeninch icon - Update Youwatch : add login possibility (faster, even with an free account) - Add greeninch icon/logo (used when checking if logged correctly) --- lib/urlresolver/plugins/youwatch.py | 61 +++++++++++++++++++++++++--- resources/images/greeninch.png | Bin 0 -> 45972 bytes 2 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 resources/images/greeninch.png diff --git a/lib/urlresolver/plugins/youwatch.py b/lib/urlresolver/plugins/youwatch.py index b23295de..2b355ef6 100644 --- a/lib/urlresolver/plugins/youwatch.py +++ b/lib/urlresolver/plugins/youwatch.py @@ -17,15 +17,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import urllib2, os, re +import urllib, urllib2, os, re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import SiteAuth from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common #SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') +#SET OK_LOGO# +ok_logo = os.path.join(common.addon_path, 'resources', 'images', 'greeninch.png') class Base36: @@ -61,15 +64,21 @@ def param36decode(self,match_object) : return False -class YouwatchResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] +class YouwatchResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): + implements = [UrlResolver, SiteAuth, PluginSettings] name = "youwatch" - + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, '%s.cookies' % name) + def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - + try: + os.makedirs(os.path.dirname(self.cookie_file)) + except OSError: + pass + def get_media_url(self, host, media_id): base_url = 'http://'+host+'.org/embed-'+media_id+'.html' try: @@ -82,6 +91,12 @@ def get_media_url(self, host, media_id): r = re.findall('file:"(.*)",provider',flashvars) if r : stream_url = r[0].encode('utf-8') + if self.get_setting('login') == 'true' : + cookies = {} + for cookie in self.net._cj: + cookies[cookie.name] = cookie.value + stream_url = stream_url + '|' + urllib.urlencode({'Cookie' :urllib.urlencode(cookies)}) + common.addon.log('stream_URL : '+stream_url) else : raise Exception ('File Not Found or removed') else : @@ -119,3 +134,39 @@ def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match('http://(www.)?youwatch.org/(embed-(.+?).html|[0-9A-Za-z]+)',url) or 'youwatch' in host + + def login(self): + if self.get_setting('login') == 'true': + try : + common.addon.log('login to youwatch') + url = 'http://youwatch.org' + data = {'op':'login', 'login' : self.get_setting('username'), 'password' : self.get_setting('password')} + source = self.net.http_POST(url,data).content + if re.search('Registred', source): + common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN [/COLOR][/B]', msg='[COLOR green]Logged[/COLOR]', delay=5000, image=ok_logo) + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + return True + elif re.search('Incorrect Login or Password', source) : + common.addon.log('**** Youwatch Error occured on login: Incorrect Login or Password') + common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN ERROR [/COLOR][/B]', msg='[COLOR red]Incorrect Login or Password[/COLOR]', delay=5000, image=error_logo) + return False + else: + common.addon.log('**** Youwatch Error occured on login: not logged') + common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN ERROR [/COLOR][/B]', msg='[COLOR red]not logged[/COLOR]', delay=5000, image=error_logo) + return False + except Exception, e : + common.addon.log('**** Youwatch Error occured on login: %s' % e) + common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN ERROR [/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) + else : + return True + + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += '004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8xfB;EEK~#9!?EOoxB-_^a2mQvJ5s{heR#kiNbDrn*YXg#@ z0X-yI&;W!4mdr&UAoU`|? zs&&arM9ev8%xgquuC=Nvv#R#qInK#lxiTXoW<<>R&vE&WF@zJ!&*Q(PKQ;d;`F}n9 zi~6+tnWybvc-s7h&Gr{|n_t=P?%9o7whBA3jAGFETRF)H1Q0|ms6o_#O8i{EaNifX z$ZtSI0R{1#ZqCQ2Qx(Pmv)f>X9xE2Rx}mv#!{X*gR=0oR=K62ATm8h_#ZUaFul^gS zd8{jGPPwy(-2?yD$A4KLcfYdkH*AKUopbcwGhpyy@zUZ^ycm21SfF17S{g5`B+!a` z6Di+b8@$I8`}1UWqZq&z2myM<;sTFf97xh`I8LjBs=++{y+aK z{kVJ2S4m$)NUwXl;i~K=EKn+Bf z2pCTDh$s6641y78L@*dcEQm$40W3m;rNzpE&RnrfHgvEEv*==7`%ZUj;%Nb@%R&6 z(zF5y4q-%O0DQFRFLIGTfM^1&CVTgOKJI?yez@n+J+am;Yeu%BY(>~%*wWCe zrT3Oz4Wl=xDxw}E9+OPC6N}&he*vqD{K2Gto=*E*C3Rr14ZF6bZyFGxb&kb2vh*V> z=UAv?A<9C8))*RNvC`0(1)W{7YHqk`?s&8KfghKD;-}@G_|N{s|N5&R)mKFc|9>C< zZ~CAGafbIjo`$xQ^Q)7N3T4oXFbBsE8at+ zj!qp7iaGhEP4~;>h~b6RaFO4&z^HrerB4GX7AOA1< z%l0okuK&u%r@!ZZ{TCiLzpx%Zvh$DZ*s(Jsy+W_Bb%r&bNAJ1!4Ub-V^p>@Uom#vH z>y<`5jm8VACvc2Q_>ZUnwo->Lde%k$Kq3;*B{-K(w_gqW_9_hO8N9*c*^VPy*R$4< zt$4Nuwg|VzGFr`rJmM6*;=SYl_>cbA`k()Y|Lqqa)@K3h-}vya z=`Wjq!o&Jk?$^I?zy6tr?XRrIdwREKkbz!C2J!U3#>12I+-1^7#2VRH;)7LWR4^X==-G^pUI%tK zHWoH&*ov|_{iElGO%Mb1A{n5QF>tO;c-x&M&)U=Y`kSl$6yw?W{EZnR1Ek5+z#A0 zBOQG1g{}6XhM-~D`0q*X*F`S!eT!C_m5jg`wXBouJpL=RV(H9+MjE{L^uw0zxMp-a z5JzJ@%SO0aG~9MAx3=L*EGsW`BQ%534$#rEuuE3m6<5nEuC8vmy?M+3;6M34e)efS zs$p#(|Bm(3-|@74&*ScqkNqPb+#?@#$CEg=qVz@>jGe{E-GjCl;%Q!8_K{@?aa* zZpTJ@dPa6A-odViC*xTOEHSK9xI(xx!WAGgV*Li&JB)5IZq2{&Z~Ra6&u{)?{B!@2 z|K7oe_aI>XJOAik)L%aQd+Z+nj$MDx#&22so(CQHU>qMrcoNG-V23bxaGLlRfrHUt zS=o-2S+Z)ET(wuM7FS#~ElV*h6k0g3(>>fEMXMWk!pU%vi+sbHD!JJx=n_aj^HxJPNl(*f7U@J0;p+CVmKL|EWax52wL zuHUd5l_yyp9l{=9{RhAP>-yotzsqj(3%l(v?8c{Hn;OTXI6exz7vWxnH4Qt};M!B6 zLFkO(s4iG)wN91viToH|>&}rsLW+ti-aw1i(5K8CO6_QIavPGPPXL>mt85 znJxEfL0h1WZjlp6P32OL=!o|NJ9RwhlJ`3DiyOEdw)|z>^6RkWe%$di?%4T}HHs0~ zs4%t$u@++tEy5x?<8>HNdK{Krcgz3o-}#^EKmVWjAMQP{6Tte%kN*#Sc={)-$9p#Z zku7VsX2%v~Bg$GlPbg0+JbJ^E!l1$Q>%`JE4Yy6lJJa&cbi6e!@0yM~({ODqtEORP zgq5)@O+zaNBZ4BRrbOj0xo?V!2ayPZr%n91$VI+SsX;3OmbQWMeqs?FLsVZqg9_I) z+z8xy&+T~4-O%&bVaw0EEx!&M?uRW;eqhiDTpA*VMwP}09m>*pRt;EHj2RimC!V(N z`IrCw|E2zO|Iw*wI60%o-3K1~4?MXCp6r%QJFxMNjR;#{>w;r_>tN>%gBO&B#&lep z1#g=rKea3V+%EaC?fAi3?yTVoSa?s1r@_;hk;Z@#3nC{ZA7~(rN{BqF)C8 z08ye}*n^H_9^#4iEjUnzQHK@iq~S^$?y$Ub@YCq|(=hOtX2aj@*8Ih;`DIvh@3su| zY}N76xd2!QOCwx0!fo4NC1_qFJD&Ov$Y!xOgbY~!?~ngi{qXd6eB8a~!}!QYw%ps1 z2jh4`*mz+l%Anv>z(M0JMjLLLj<x>I^I~rja3#pV#XeIBjQ8q z4B~KNIlbnS{8*rR9wz-oF7kbffO=pgpotFe$|G=;Ai4T6q1CB=wk80Qjjwh`OD>baNVWACozU4>X z@h5Hg8@2qTmLD)&i?S3?gG23rqsKF%Y7jr3&c@!mZzhlsSpsds zi^H1{jeym8N9P@_8@ciw3vK8ebXZnR#|qC<982T)Wpvz+13L%KJJzG;qZ&FIT4NAA zSB!`sF>XM`aMfM&ulHn?(G=Dezd-|~bE5CgF54d0d%KP=N{5;&!tu*|I;U{nSY4p4uMy|!P^d4&+YI+SsVO``8CW+;Kno1@4`H62vjX zp27Rzd><8dVETr}x3t=^Fbi5b7RF$$f+YmPyupp&2IWCLqxWn*2nIEd!8o>Fxp7t_mIcZ0QBRI&G5+M_9Ks*2ez`qEeuMFcaCukXgGL>Vrd1eZCEyN(=@!X z4R5XGjWOJ!tQcs=5pe;m)Qr%Kh;bMIZxGeU6FIf`>c*X8{}=f>^4x=V(V35nuQV+G z#d`xLR4!4lAq5beN1PAOG7c{e#i3@zm;o!6g;B0_}Fs}>O^xt?nVfeMnw&F1bk4Q8lzx6iZbF*Gl1blJC8gjPu(n`{oC~mGc@3#m z;>)W1o0a*kyR1PkOJ=>FK%{;vSZ}Zh_)yzU#6bfNM=wDs!5Bt?Q9Y^-s{>00Zmpv? z;B74bJqvBC~ zMQgZ#)%hh{=h&-g$^zD7+t(ubADMq%-$K0lJY&PyPQVi>JqX@u*>@~&z43HZs4yc;&G*dbmRjpD>3 z#zPZJ6`P=4sSsO22&##HbtWLukV|-JKXHDU*G3F?)F3iljFfsqo%}An7by>#?4>=F z-gv5^IGs*F>y*Kp-#B2MdGHe16G@zu++C6IN>8{)vFbz4pao+MO=B@8s54vdS^My; zdVx_4qg~((jK;B(p0$4Dar~8=;RDUn_JQ^8fnImecuZpuXYpf5YTiNUZetAA!pb(> zTEkldcj~zrdm0q=p0Uwb`(6rbf2}uu_w#I|rYi z8f=7+l_1Hv8$Kxe6q$gXst>QYB%O37X;SDe6KE=7Sy5HQM?z)}@~5j6kj$j}qU7#X zEudl$YY+@Q%KhkR1xzey?opfw&NO%n&h+%U!|D@T|G?I*X+}RVx&f~aY#f#kRneV> zmyfx5VuZ#Btr1$FRi)9;t86qQqt|TZg*m1eDd6GbiG_6OGpel@`Gz7%k7m*_xDu^C zD?FbXpz3`wL!@Yi#A>x#Z+8N@Xywm~L^BYLv<71WWg#ses*z3vjgaq?pjZ)_*dojt zuqJvAG+LN>OOul9a41d(MjaS+q>*ans`Ku`pd^1&MjW>g$-ht(ui#a~Jk&CQ0(~J3 zMDp(@a3>^>k{cASsnCo8y|n? z<75lfT7!0Fv;w%=M7V&}?@tn-q&ZW4KHY3;E9(67+4g(8lGABbX`jWfrU!gze{k8m zR|Q0}cBB&YYYB==z=lwX#Yaoc*EkdR7c}hZzAMG#*XiM#GL8g^39K~kV+vLx5^rXB z1@zPiRW0J>?Nt{39Pi*Ur?E{Ha6?e zsL>qsS;JBU2^y9MyzZHhS+v^GMSi1Fw^CE4+LP{YSIgdQ*8@1Glii)OYg>+3!i<{n z2cDnRb*9 zS=BGJ9N7E7wo2W#LWhkQCCU?-DG2VJ-bH?!QUR0}=WG6Mabg;jcj5H&S(*7yUdQ5S$UOCMpJaQgpQRe z2Fy^aG6_=BbBgQqKo6`xK1l7~0BonC1Gl}f*- z5hbij=!r(uOa!lJ5~>LUP>H1{IH+Nr(|LN4ZzPpDSi;sZe@x@QmFGN@+FzUq`ys{i zWJ?q?_A)p3B?A#u78Vo0sxe<9=b>m=hZUDl$u1iEhc0|P=tRTHV3pNAneFtz1W6`j ziW0^FO8uM3Ak(C+&gvq+14*eH)4$96%GAnfI59{Q5$h2A07x06FC0~734GJY^yP&L@LgGb!!!kAe$n=-mI@FxXQJGs>W%hzeWI*E%M zl=>d$pb3$(fZ(M7mx)0XkAwn$n3x2;AOA}TVFRtO|FWp) zd9Wql$LD`%)Q2ih(Q5(QH2ljv`Taz`$``e!UH;Z=DwHJoG%x06W%)B{_vd0` zUGfN@ljK7zCUZ6kHE3DEM;QRikW9h~JY)(e$;o6mvSuYkTw;`PmUs9piquqw?7ynn zT2cX3`kOkW8K?DrhR;RY`i;t5!%Fj@{-ijvr;gdgVD~kd6iRaQ#1l~*`*mXMNhMJ* zGSRg@!#}Rn_t@ljmDPk~97xKDkK0W(rMS%GEI)}rRXV_Dr+%hY6@Y5;aQ65!#RE0J zZ5g1diKE#7Eicuw1}0F-y+aY@5AI$abe(WJDaIEf|Br!OE7K%!70i_6_kC8q}z%@7JssB!yGsT5855`Ossze-}tL&2% zQ>cT76K_|Y-&K~vI!Rh`Zeh{L;{ZK7SJz+Vpjk(DV$ zX%1CB-@E;l`8iRyiVwAX87Ev_(|f9!rT3AqH3?l`hwZ-ng2Ok>dL*e(*~5H%%PPfTASI#_sG z)9YBzfw`tteNq(=EfuJ=L^{@*yJ9L%j+*~_ z@eKT4rCOG>G6&P-&LC5!u0gP3X-!AlbTqcb+7@dXL~H;u1m{Oa)6?4>&JVF6h2m84 ze#Co+&ze_K2NFYZ`lzT+?~{wdKrZupL90VjU%{ziSS=XIa;hz`1a3mE+AuArE=9}I z=-RJnFEI&_rq-5H^Q1ApT)gKULZgP(gK+`1959GrZ46st!YOz`9Ff9b2=|#xR$;MD zPWu91zg4LpZ4=u(l_nH6`Zr8qLdPCaibHUq9;1S2Ln8~W+dFPoKXBFF(KXjJW`&gw z6IFfhM@F}$cN+%RGy0Ly4{V1m>uqSb>D(4CBVs+6)KoXU;%I%n`db8x5u5$3UIOqz z9en@e%G~Lm{`J*@WGZ7XJLT0Ef3<+(afBX*J}xLCh5jJkM8au{>PRm8A|uEUiK9}q zDksW_XTalPG+?2I4p>O+gn=>|p|@aEFltb>Auiw(!fL+9ngf@0;4^kTxo}>7Um}VT zkC8wFbO@-$s|_{1CF}Bt4v2TC51M;J!)^DLKVSVbyj%T4uG$~zMH#|GH$5sI#33dH;6c5hUND%b#kGhCjuDcE z#=aZlk18dqTeAd;GGb~fi#kvj?sf8}n}{#!86)9bllh+jOAV-vL6(7_^$th^tf}o8 z%fv{~uzZA?MupA`tpj7iK0L}O!YD$cg7|bW&32~%YSKxh(pc}FYD;BN2%um;xj`b4iA zde^fV)^z-e+qG;P&p1La7S9f4i)V}`Vq7RwG%`I%KI%|vqKR?=sH0L*RSIauuO#)P z4C<@*TI@q1&H-@hg9#sgL<-gkLHUuy^b%VRNSISGHD}6PotKtLWU*A|CVioh3-+b( zP;!K#f|~T}!%DR#O^l24{kJOzXac!sU`-fJ=^N9+ka^~*VlXt)(KT1B+FP#LTNZMQ zWf3Ns2_}a14Mr^u3l?^uGgsg(yIs$=-=Rj?dP{Gf7{xPapSwC4t4MU@i#4c5Lq;X| zzI^QZ62oEnsrUoW&*w_pXR|uuO2QvsZ!rl0?iU~0i^ht88ZdzZb{k6?7be@ zs)_?nx7y3~nlrsFK=u2OGVwBr*n>}{I>J}k_pOJPLxr*=T10FBl{8@!^*lI5a=!s1 z24gyGYw_yX-E0_ii|IU%gJI)@jd!?l$LLHZH;NdHF^I9y7}QyGgwY3}_2N-;XvY6B z<RE`ena$Ohb`i)DqItAxA*>3>}d&0!=nwpVEN`V?gEe4B~1}kj@ ztrXgx(hd!R(Ew;xEMkO(z|CUBGa^>8Etri*85qV5!?3}72jWmKU_u1bh{YR;onJgY zl>m-ot9>>XsqL*pa+s`i3JO!YBhCDa8vJTaYXXWD%FL9ry-^-E1j}x8Z>Jae&5BfD zHU9!Z#G~FLi7pVid*NjN}UY4{yUdAgHX2&ul26m37|=S&yFWCpg_>SY3Dd3KcGgR;^9nxjgBp))`$ zk#p$r3=D3^cDH8JJTZ&|gMzv-R}{z`AtPW-EXw3A#O7o2sr?#HY*}Xw>p*r-1yps3 zh&YPMzRN*^nukB>7MoIY3f9RW6yT6X49=1h8`U~qtjp>5=pL!z-U9VH5f#y zew-JX$~RK5fI2m2I-Y3?v7%4;Cj}(HS6sY{jg^4o466fFUn}xGn$6Rz?D{XRa9bTr$?@Tn6gfXRL4AUTyQNd!d z($YvrBMTamcGZyb$x7FPxQA4|A!+$OE|8)KEmoit#W#+=+i|;i;Awf!rhj7Fuh|V- zMnB-357A8H1Lr5E5~?OL>7{SZT#_aAtqi2*(1*zcOm&v`GpT10$f}y;T(sDPISd4#ZRDYO4x0P8m`^{S*~!e{umRO(JF8udYgaUO ziILiWmC7h<$OS}DiHY_|$O7>(x~CDeFj3Q5(3ush=7y{8maD}b%l0F!U9fYTOkwq@ z*IrtMCG{$}I9m7R+iIOhG_2a|kkW0^`<&5Sc=sUm+%rvR17o6v5Gp`)_KH<^!>YSs z*DEp5m0ivY^7<5!AeVO7A%?-%l3-4Szx6JkXA2>8LSd08pNcJOC(Vt z*Hbdlk>A-Ri{^?|cg?cB4&XR05%IW~$nVtQVl~sC0Zx;kFY`0W;qJ^|OAZ58rC*7Z z*3`!%glQpthWjq5S%u_DIE_JG05&l zOKUq8?TSU0d{{Q@Xp&J8LxPjOQGwM?tYft&8Y?qI$9`+WtFbBd$7Xtjs)q71ntWpo zD#iS{L<_$U!uK<@hC`v~lwCikH5@-c&3s5jBXaW}{njyui=0w4uS+E}LSs1?Uxk

Gm0)OoW@Qc?ztxvX@cWY~YtJhv>4mO{J{gWqynu3U6US|3aBj>Kwwv3#e@_fwShga5k$QY zeya#pCiWjNYGUp0%WQpKUU6;eRM6Uaol*&oi5{8)N;9E=>7iX5iUSsPIx%Ys%cjuE z=547j^1aA2527UBV)7sH$x24*Zy9ouXFt|dP$rN%Tf3ySD>}QPHA}3tp&0})?F|^2 z=TgeoBt1STV96FtKo;jzSm_Y4_}H4D0gVwf_T2(tu+p z-P)<0AMiTTrx^rl^<18zC;8NGE*We_uqOJ2oMN2N(6F%AT-$ftHa~K0e_$zZXygh@ z2ND`aIQ2Le8lW1hG#bo5RY6@Lr;1o4kJndcE4hArn5zb-meDtizQt>Y&|zc%2D}c1 zzc49Af03z}yod$LO1Rr5X-Gnht|WhEaryLD>Y#$poM6x z+8`KD^jKM1I+o^|>-G)T-8)vz8#=kBVTqxI*uSoB6Be*Df>h>R#cHEsBITy0CP@6h z<_Ag@oC?khJ~h3d$+?T_F97wj)P`I@1E2af#8;`%QQSp&p^$a&og>UO?-cN-8rP|A-ARrI=9_rywm-b>uC4 zB}E&N`ZpB10ihkaQx_^TV6l;PzUZ!4EpAyYZs^*pP*#SL^eoZDFec^=N}Bp{oF+KX z)5DRxsAxSi)59`z)+hhG%&$vaZYz`aB8TLdZ|@M1Jm_Ai#D*kO68aq4igP|RY0bp) zcuS8)32Q3Md@fE$r3bO@BHyb>H0hEFn4HsfkR-Jt&urgJ^o2U#Aw}m>s5?v=Q!y8C z4i~z_$Eu<&UAJPnxMsDyX1TbgYnNElMqd=!M`p#uYM?QSCq9Bq0J2H>?pP~6_86O> zQ8IzOxbU6$SOVF{rW4VOOq{M9ZMevB(NF&N*(;hBxx6SI-v7(AhJ!(pnR#$DkdkKm zR71N=g>Ngtj4HmWgHkCh*_Ta2+&(mpi5Ge&~1Q-isnqvAC*E)9v!*IX@bxmw<_ z>TYP8CB{UvOj8+}ph;=uU>Qj*<^v1MWIr1fLA}pPSq*JZ+6(mZc6r=V7uYMC&0WkP|P%d4_Gzvz}Fr>%1FUwub1uLPPT2Vr#T zKPtc3e;+>}_3;afWlX_RkN2S$ppllYS+QE&a=m=R&EhSq?vBo0VQ7jure(o3A`zUT zCZq)zCwQ60pB{|Vv{gJFha>bX^fCs(G7;q_#jo}n+Fj%`MCT8BO_!R}5GXhC0PSi| zUQw;#^R4+wSUj(K7u5RJaxeuYFDyElaOwRqu$nmNMI*x|hGt^@VRb15XThSo;c9Wq z_2Lazi#M#=TRO8sq|IS)nJMtKx|iZnvsgh{l_%^PpS3H;fRi3CBPwICQN@*7U9*Sh zBG1Wjrure>OP|?K6_=Zugh%8ROm{i*{soC6KOAYg$oC=9U#0a6p36x%4qRn_q6$71 zOZViu?LoV`2|$&=%3cTVmABb-5Fsf`0u@ai2BeNvm)}&n7iF%6{)A3>*7?0qLM?{G3gm4oL{SIoMsWnW*4 z0_7*>pH}{#RCys0Hf1)c_O-O+tOxZz0D;%gdC){tu)E=EamQ+L$FjMhHLCzt#B`j> z_dVGyX;_*yxkE=MQfcj!lNPx{li1ZoitJNc(v;Cd z%F!pKHoeXmf4<_V#QM!~QF|5px8mI$Vo9VfJgSAsagnblB9hI#;;-_R891Mm<>8%z z*5Npi#{4|59z0lWX`3ah?waexT`&c^JG%B7YnBLY(XRIV8`Gm{wige%WFz_2B*t@~ zRCpYt4h(+F;I<5Yi_;xWd%V_;cqJv~#SIS%%=Q}pO}M|YfV-7`OH zp4~zEx8^p~J3T7(jXuCez3^PVnP^N~nVNw*1FWeAwXb3AyCMTEE7rbp;GJeuaMfIM zvv|YJ@-5ekw_J61EbKK_7O@?DAQe6bSn0#*LsDf`L`_gr#4+B>f&)U>|3Q}j zMQVA`(5n*BLFRwL?Dw^=U8>JMD@yn!XEiP0cZm{y&r;u(3G;mdT63VQejj7k8gf_> zXRx+oVXwJeyyb5719!_GxM|<8v^R9J!jck~3mJ7Etda&5@&>0gWsfG12?Q`g;14?R6_+*O^q{Z%itoPAf@eEa`~js_Z-=iTb=%pDKAhD zgW@Mf3BUZL4xGY8z6+@s?-Q^x**r}CF7IbNt;n92*y3Hh#dt$!S6nxD+%Db)uv)xj z)!eZ#A<5ZbW8JA);`IcuYL1j8JN9Q(2gy{2;CK(LEzhU}yK&2Qcw##|u^ZRLB-9bb zVFWa$-5QZ9QhJe3k_l~ZMjYLH=nHDq{VGWr7e_J;_5tfz)BOuNlGQ05l}qjdT;EEP z<`gLc(QKarR^4h|sY#{Y7r-j&do0N(4Xs(QYVNq{-g3MAf!oD9uG%*&?KKS{Z&1C7 zEcIB_FGnS{T4-yEg^9#a9|MXWJD)*uxL%Y|9fKd(jT<)o6YKtoe%vtnK7!R4qM2Gq z6j}lI#TYmu2b89Y;Lg;VlIdr)l&&RN!+e?~K^c7*%e#Y2R|Y_>sHC58N!?v1)E< zWr@`miD0EZCc&E6&oHLqR0NAOa6;;i&!9Dl2jzdmOmjF!9qIj!&9Gs;dt}o;vK!Vo z7XT|av`D8wVodD&=q?f@o8KJFlc07Rl+Wb({nc7@PC`8_$CIDaziHLe!y4VQk^uH- zp5X0TP>#xaiQpog^GVk&yM{T)1z&fd9dGPUyj}f?yTy-Ob#J4ieTk(FzN=7Uve0CzMiY~^ zOj?)Uj-#n57kh7lD}MANgWItiwrqzDn|{r1STnc~AygS*#+)xZzs%25iS8*nb3P1} z4>K-)pQ>RU2B?aMRegGNpggY#UM9tND%FiEpjCkCP&Col09H-guxOXu*f+duf8yQp z&)hA4mFJU2u!hwr`OyrUlnw*8jP zZq0VLX4h{R{0=8WNX-!+>cyl=F&Q!}u{svOMkhOx|3$#0X1-FE()t{{Dx>oZ!^kk~*!5d>{f6DJWsn|k zL*lcf)C=m`k2$sSjreFJ|gM>;>l9@JF~_dHo@zwP`$2a}5~@;%5r z?lH*+(}_VJ{n$xWpXE=8V2r_7i?t>IR=41KdBdBlcf9F-2<2nU3acHWHt?>J1|ucP z7#gFxO2aC%Iuy>8XuySIH#zrA@)`*--`az7%IHRhaby^J`hG`0>=^9;X3S1mF*>bk z8L!DjP9UG!CT%Z@0&`AWvwx4O$y!GV_r@~iz`tf#7enxSk)&Bkp_^y`E0w7hO^lXl zDn+G%x*!79SZwSm*tHFdZppH{;%a%v&GIcbi??*<8ll1XU7F ziAikl#Q2U8Hy^qrtM{QjmCBR4yJFF;SawUU7q`4!{ta&yKLwI#dxK?(_Y&%_ zr>@WB-B(1>_(lz>HJ4PgPoncZnQ+D5kpkmB6GaFA#CCk(ssF%Zf6r!oV&{7t9!#hQ zADX5@=-^UUXyC{aeGwp#a-|sWD(OE!OvA|n6y2rit-j92g%pEF*+;#1T)AGf!;!mHXlEc)$5a zyx;s29*6hz?C=&$(_x!XD_*@1yfTd`*vZeK=|P#=1h1w|zqFa2*Gu-2y6`130U8PI z({i%23f{-9v{+$jky1(h1wEsNMJ6Pk`;dH&#>OHp0HT1Z!K%fpMFkoMBnsUa0V{hG=o);sBC%mAJn`oU>Z8;?ruJxiL}0%BJ8n z;FSNJ(Cw4!WN)dx$k&k6>MHS`vL7dE7Zbh{ic2Xt3RZ+p8dlAc>-Ltr?j7$If8wX* zKj7`^A9CCMiDi37V_R%p2v44Sj1NR^(rR1%Cb#)gAqN%Xwi>I74!U9I?^%z(@G$(9 z``ur7=znG79vNkb4e%_I`VeOGr9>jj6-tnDAWHs{9G%;R7IJ>e;!Mw0Gzllyrgr~L z79EMtdJLRM>@TQkK}f2LN7UyAZ-_@F_%eO$_U&Wy)}}s0@mST|;&^D)itQdFNzt*T zWwiD9FL3ldO1xD*IT}o$CWQMLJele>vdJBI#n51z6>Vd=YOcBK-tlJjBX?Inays0eroV3~s|_c;spKz`B2AJ8tOx4#$X! z2TU+WTzEJ_x{>5XIrLF2ptXPLB4EBSvCD&d_(}M!yFpTNd6IP5w48kSToOHnN#&M# zj!VuX^)aV4{V!sURs`nf3;4<2Tk0Dz4?bqn@I}5`Q9|fHINn1Vj%`d(y*1R23Vxm7 zU^fb_S?k85=8@l$2#x@lz{*?py%<)U| zzN4rKHQRf)<7xNA6jah_-6WN)0 zo_kx9l@*UOu_A+e;&FG+$EOe6uRrj(ePlOoaq5EkX$okm^LP`wM;o!Z29_q3i};Tz z=FVI`4|dMUOf4kb@+_X~C}%i_J^VX7`h&^O#ZRUCUmo0D9r=m%!XsBBfm^+|94~ya zsli1~Bb7m4MFfSYS((sH5bw|!ITKZkcC^y6YOlFn{>a^eEP^!|H#f2|CN~N0FM4S@sW>Z zP3WbV{8-8VRQX(v_|N&WIeVV@UUO^pEOt(1hb6M{DS$W+`uRCCbGnz)E_^;c;2=GA zM9CbJ!%@QGgxjA57j5fnNy^g;T2*q2hM;pSQWZ+Y(6DS)Tz79mU907vxm*63+wML))iCHxfNn zUUxW~v@3(y;(--UOgqb0BoWl2a^-WZ@YyR_wM_f$dvUre!^A$)^E_I5;O}E*^Q-qb z$L<46mm~)psqPP{=u9tz)-*n#)xWhWnK%7ig-yO+DKVMkg^YF2y=QO^!x#Vyr8Nx; zS#s6ha=UsPD~A5Sb^DH`y`_;Ah7O}Pa`j3>)|lgyk9q1d2(7zDhNxXV4UatRKJu{r z$kXt^c3ji@EslZEZxF<4j9?l<^VqU-dhd&0Hk+}D;=zj#;^D4BFP+CLcKlh_M`D@l zc&*OHO+9dDKTBbhoC)(@nY1-Ih{ z#|S3msEH|68Is)+s-uQ6JLmDLIE2O+ti-N4^MfXhrM`^M$#e7$<;?S5VyynWfOrtZ zUv~TDH+xjINa1^F)KkE!R>eFSDJ#!}=D?Ai%l-!;(h_roN-^#kqw8WCo>x-rHvpE1 z1fuAu_|c*2X_}T+7F@Nryt(>;A8vl)-PNDCTmHaRd&|PCLNw6JRD;T_VPFCfrxzde zD|+3raU0gdBagdB*8L;B--gDhme9H@RAP?iU5Q>woXk!=-i;w(U@T%SShL5>4sRs? z{v|2N+edH1Ec|$?xj$6|&P!`ZmvrCLcRbT&p0hAlt5THk1s>M(r~kUo>Ot?HK)ppA zl+0I}i?;Q3Bt-=^r|5X67!?}Zv9#A*w{Li}_<^^ppLo0aF*ZNFqNT%li}+{)=E)F2 zumY`9k2(9WG?b9p`YoIBiKjlK;%s(n2G>Wwl?E-UUdGjDQ`i^@C3OfUp?a`FN#d3L zhwzh+VNx z7C&*@{>V-9jw^G=LRJ`JYp%e2n1;h~Dj6K_7%X+(JvwdQ_TZi(; ze!v?CcKY;aOr8|uL2Oh41&M5T(ddwmwF^Uq)x&hi!)_3H8O*9C7p26^3;X@7i&T+1 zPkRT-zNN&QUo#?o=3A*iB)OrUlcT9Q*-1H%?ac^db+eKBU(r<9OEQS1h6dSu;Jho% zMGi=Q7=zYf#A4fqRdd62_l}#z58Nz%70WW6&@prHR%Nk6F#1tRs`rdM{=(kMJm5^1f&mX z9QwlFUn1xA3Qw4nFB+b&(Mn(AY)^8uRsEcXvZqmT>>#rDyApG}$hQ_nQSVSZg3vY{ zORl+Hyyf=l01H9%zDMqsf8u8GBdhietz2VSBC+vlD6pnE$1a(I$&?CGX2n@nc&~Uj zGL8e|Foe?08K44KWpgeK$_FNYEGiSChy;)_O~`)~n+i&X$e~B0W_ARm=5nOBeeUy^ zoqp%KGG9}4?=LyFRoy4xRq_g_`@ZMDypal_CZ^zv@Dpb7rK;$6CK^h}s5%<4bWO{3 zd&Ax82i{!&#NFyAZn_^?+BYU#i&H5j(6@o$tkFYiW2G&QLHgE z#^StW4N#&}O5-XU%)C&lGDiypjJ3htA%d!p6<9;*IlZr+J@`ZEw@*1V?n+jxoU$cXtYCo69FskMLc3+BuxO5%HK-V*`6sSbqcA-P(}>a zHneR^>l((<;$qK%+9WK!6-RvJXBml!&nAGYR~M={q!gp7BTGs#OP5jR?<0pOnS?>v zsx{4;W+1U%eEms%kA7ov3}0#|XT*Tw53i*L*_Umw=FlaYIqk`7XSNCBp=;l24Wvgn zWfzn1+e!*Sdq1MS2V?2lmaEk@ch_&ZUA^Oa@s?$CM=Mu|Z%aG3Kz6A3`oG?un)Sacmrw_wx-gER~y5u_sGNYI!9Nt8f)V8qylmKJG3pkQ<( z>dgxWE>wq$d~GSWMpJEIEJD|G+$?Xny?V>d@(ruzmW5nn zeTR&;qz2{^?HbzFNC1RfuN$I}I!GcMn^?~`WqbKxTG#F#|kFRN=j^I*jS+khDRI7Q~PUV$M^xq6n zO~;%1Kd8)}^O*}zlZ&Cgw$C0QXr)aiEMyxyHJYfLmy;WjqA8)&u2g)CqvvtTVcxhe+s=*w~K7 zEa>ct-S~vcfLb4FW;w?oj!{BAcduZKWno%6)1WAW>FH#F+VEXtI;^p|szcIx5+x#l zQ2mM{tjx#B`^n@mp(U0QD!i)0`SS8QhKMIYo6TL;O`3q!Tr5{6`wsU>6Q{iklSpAY z?{vs)`pvtV7AtFBTz&3&3k79UleN@QVw)$(wLW|F2{km`abB~@lOWjfKO zMbC<>I_|_|uW@Kz>IenrkWkJA6YDq;C$=vW+(hlg5DAikdhjkbOZ6=s3s!c?Tl)id z_HVg1Kd|DKg)C{YSP7lJP@=y|swYlJJp{{S6Ablrm;>2iIi_VDb7qSOjkK(qYaBn) zNXN?Fv1^{VYaUrQ4{Z7ecH;)8171d)AA`B)Mn>RmD)%%D0y^tXjDVg*{Ww`7|$6RI^rY zB(xW_k=W@mI2uN6@!E#Y&rnxXP@D&RYN9IThE)r0(5`CNVH&_p^GG&(HvS`2$*fJ~ z2^VD*ox#=q`#b?B8bSCw`E9CTDe7a`T0o5nooO*C<~>;@5~xdlsI?qv>R{s)yum0~F`>Rw1&Lk*O~J?BSCY0d(Vi2*JBRl|s~szI%iHEher*55Tl){V z<_8vB)A|N$l4IQ?jgXt+seeqt7kl>CmEH8J?&ZJnYTxZWt2~CJmgdiN!*w6dH!r7#YHU9ZJ6P! zGG!C6DM_=MYIE@vG3lm69XV@~b?9o+5>2z2A?ctJT6$0Vys2hKuvL?_ljKMbJR=wO zX*5(Fh#(W2f5&b)4PA4~ZTBbMEdQ3<_D@{dI~J^HqziS~h0?dM(!g_+C624Glyx!( zPGJ@v0)q0R=t8AI11=RN2U z=d}lMv4~-s&n8zw$=OyD=KX0+^g>~o+?Z-U*AdV{77yIEGS0MkqpALFm_^B5YGQaK zJt1BVUhO_{bmBaZJ2tcPmC4q}FUtXCfBNY;TXxr1H90&p2-m|XVG2cxTPA`-cB-1n z4maS9f{Zh5shG*rdQe)n(Fg|lmZk?WnHQ-9u#fe{!=w}`jY&)M&&n87k5Bt8GZ#^V z_aRCa%m+i)EV)|Va!`X{_iOi4EZlEQrC- z&=|!VPiq|BI(!p-L2d{dl^=7DMXzJ@c?2-1y($T?#5578I>a;?h{7whLz6wQ+V@kH z+g;ChvfIU5rL!Y#yQFOw*tW$qf@#676}wf;;Mr=t!;#4^s+k9uKol={RYvE+LKY*q z)nq=|_0P7#%(XdvC$sna*I?pvsb-WU-{=$(^Xu7a4bKglIOzNke&QaoY4%cf_ot4n zsunmgOcH3}XV2foQyf?8S>;#}n+vr&>++ebaMG5|( z3`R3esy6>7^GM3`k>^F_Llp&#Vni{F94R58=!~2tKaM4 zpC7{ZbPp$~(5G?`R_7^NA(N)-YxV|ps401#e+hKb@|m3CMj>YVr+#)hURRe`O*@Id z&03qt6tpToR|bJN5EEBX2=oDyRcw!w=)02oTomskLrP0^1%sh6EsJi+)$)ext6Nr! zYr1wtV>*m!k>pU|eb;Q(2Zb;BB`fv(ERYokq0E57#H$m)0F#<(6qB`zdLWa3 z%Uq1^TfCYwpQ=dUgu;-2J9mhb^yX};kz63@x+&IJ8fj>x3C(ORm`0JtqcY;@(anGk z1M0`n1eWBM42Dx!$P7-1O=GLLO^I=F_(}Y9(SqyG+~ex=&v>r$of7uw5l7p6y)Mr4 z34@XS-%bs}FPYra{Ul#cUj4K(183SnxTcj;ynZKy6xhEzY$X$;=#0 zlRo=^GEhlT!}22(oT=$?GtnFs0%)m%%aOsb>gLwo6`0f|RnXwDZ%o6YU9jq|xxTvP zdUeODyJ2A$G}2;e5NrW0a-89yB05p+C)(s0Q*#b2yrj#Tk{p%jO{4(Ubot!x-Bh%o z6kn;gm{JtxOYy!lM5})@Gem1&Uzuah_y9oBcPMzg>v3*}`X1FD9eR2{h9)0A23Fz= zmExw@TZ~VC1N7PNWbc}m2kXFZLr5_!7?Pgdx!b15K_6DQK{Ck=I_31!Px$mx_nC~D zY-A;(U;K7XqbQmYmCqrqx5+gd74J#lA;$Hz(vAdj=Kch+q->w{sc6zrp82rCYXqVc z&?q36+N~9^ilhe7=&3AYNOjdyPMsCY!gQ?K6<5m}ZWec3FK=1d>#)L$MIvCO+(Fd? zz%vh=OdsoWLRGn{$wgOR;iAOm>&oPQ9iB0V#+n*Zl;Ft`_rWX1S{B86Hu&nM3!*+& zjsV*U#1cA#+cNn0a@)Yq(jN7((uB1Eu#BKaF(%|fN}4NQS%S$s<-6x=P-|KWI zBi|}t2%!;6V_R0uitEKS*NYpj7B?)LD_XO}#Q&8TO@aN1i}5+_Ukh-Y6S5{VbLRe> z&)O3BI4~YP_!gMuLcY$_I4DyiH2gPQ*~nVcbg#m-H<2DOwgbE6hTc6fxDEZdVHg8o z4IaE7Nx7VoYLOW*)`WmUG%3y&(mLR}%Ko|eMXL)W#&fQ>sT~Lt_vDeGH}%apdU|D% z&wG36{!M&SIdeVz{JiKN>LQWr?1)BUAIYyZQ4>hfwi4?qeyJR>NZI;g5VeS}@>SGM z4BXlr$P6uw%}Z0AuoQ|-3vIk6j$rb6lYf?tny}a6WY-i6Fknm}USy)H3KmOiT9(Zf zH{C6_%R6qm+fee@ENSS9uBR!4EE(`#>V6|JLYPX;oLj>p4#!9}#|{QJrl3|!)~4rX zJlR6o$2mQYeb0_nD^EncnUbfKWO9-*Hnbu$%Bs2IW^qUFH}rnX&TZ(&HO>#{pbUP4 z(=li>O`Mk|!eClJ)t?Kl_Ah1?)vF`z`FYA0`na-EQ04gxe9(tA{d;cU6aYGE+~wA~ zQOkPyCnvsw$;gXlk(kP_Ri9OMi{{XL0;~*R>d^|0L{mAEwleAtm`$3Lx;l~8F!Aq1 zpb9mr%6o58f4R5~A#5EKL@i@B8vI*^ST(^Dy|3Z-Dp=Fd*(F!qHFsBUxLdvDy1k(@ zOKjk^Pdz)ek4Rtle9Dpc=MW)W#@wxEzS__KK5hVH(9#OLa`J*40qakQCCHIai>tBn zIYkx27)v7yR?RiH%eVB}vmG|8@~Qk^O-FI~K9lX#tC5xiLJOskZiGLk^a$mXX6z!F0! zJ{Nt=DQYRv)M#i}nk6^g4R^~o+%4a*>TYPwGPLWGDjJqFy-K^9kb9qfSY`IVbKTzp zBy!MC^YW3U0;u}7&p$|BggmcabsY|m_u$i{gv9K6UZqH`U2(-Nz1y)}KC#(7vK<1G zzaO>?eh9p>4V(Uv&F+zntTDR7#lDj1JfunUEx9xJa)dZ?`KBJ* za=lAs)v1Q{`kjBGNm#DyG)g$X2kF`iQplf2WYVypp8Y3p2Nm~iBhfM~r77f=QjW5= z6OFp6m!6nl9-8=l`d`+veDQjzjvzLW^k(^FDM~jb4@w0_1-Q~}N>qffc{K^@3K|rj zkrBy+o1F6CiFuC}OXxGWv{zhrx7;q@aJ#%?)vf|bRAus9XUAze?h$OI_VH1^dwIH@ zLXM#7WCF|`PV?YTwFKEIHWgjKPxqO3bzs#!HjgU{BX3t6x#ar#J~%LvA4^PwRp{_6 z%{5o{mYc;JHoFI&+6SJRN4DdZ(T}L}ICaIDFZBZZ+1kd-_h3R%NJe17jOb0Ruj^|F z;;(QUHP3GQ;?66#{=VK@?N5tOW`4j^OESxBHGEebfQd_(AI^Mzqc14s)l|vasclv9 zXXR9R5El@B=*cUVPCGhBV*)L8ORSVSzwr{y^?pT-=mSPI#B6D-}Iw&OOrC*b-`BgY06u%(r+%zVL!qIiqhrOYx#qgPVcp$v)!nmdLq&>l z9C0z#$a^Jl1Vd7`k*~9S)OSQG6RHkqO#D}Sc%L{}$1ig&P2S0oD}CDY{z^8rkqlT9 zCvtLZN3APcR`HZmRn5>;Av)sY`-~l4LxDKw<5V>zm7~&*y(-SflDl=89wT5Rn3IW0 zP_N!G^e5Ot3e4yb;Xk=3D*s@@&p;BjG}6)8B}*Gt=&RMv+7!!oy~jx(mk1uqd;rYtSR4Tk3wYZ&p>Qq(#?IIuR7Oi z5sY9cv0QUVRFH{Qj}lD!SmSHiUb9-(-8w=6^1vGRp;lBj<1%uEi&%h5 zVt_BE^>~NzK91q_ zvzI~Ve;jgNok8;A6|^Vy6@k(b!~NlbHnA^Nq8!9POVJe)bwGTe4#ZL~xe2Kk@MEZj zs3x>;j~7M>wS2q>=N0t^6CLLTI!+7>7q+ zk3T7~hL{R6GaJhxKIJ@Kdfa5TZ53fLlEe5i(=WKr$)u}w^Wf7yCupUI+Z>!ZB~|FK)2W=R zOn14rr|0FfY>ce+#dc#5Q)^=F_*6lt8m(YyOiO2%EZQp;?JB?8v7>Pf)>{k~qa_jk z`Q+p;5k2^J@=?8j95M-yjVb#%j*t1(fHhH^U&8`@4u_OtCOvodpCnRzN6s^*$P1Ph zL8PUjrI9w&05=UrZSW<d z!>YYuAuAefF<4S%36bg;$>}G-A?B-_I2i-sd;{A*`7Fp_HHiwJTtc9N7!|AM|Kw44 zMKCI9sRzE{bq{)#NjZH|j~r2>0`JKsG{k~2)6J?~1#g6qHcp+*JBXGzadDrUg!I@P7b=Ni`uCdH>|Sjqf<@q~&xc<5wRz8szo?Ks!1bAr0$ zxU^W?(U}DcyJTrrbhe|Tqm@ttN>b}$CD)nC5xGdv%#p)rMj9XU?@R%ppfR~vi^}DC z>**OwFJghd(G3jaz|i;fZbz>@qYgOlN;~;@u}z{wB>$R{%O@vSj#xw6ELbkCxL)0G zyL!Xz@+~)uJC-)IoHy7hiB(EkO#;Y5S@7{z8YX%8l?geS7@QldrpMDfmh$PR%$M@t zde1NKO<(x?@ObO}DV&!{LM|7D_y3<_L;xLXk8ABt%_P=Uw zxLw|Ix4h$a^@f}7hU+d=D_EEX4Gk&HCRY%RfEBbW3SjvLh7KJU;9Ep2CI$S694%7G z8XwBp#(gAGs#nM8dUm@lo9&v-X3g4c*w_ai`wz(YGo$Yr{WbuW2@x%mH4DKh+0h;% zgAJ|eShP!4i)*fzH(W1nx$bURHCJ?WSZ~S-ZwmI!?`rUF&E2=@m5sw&X$ES z5S;--DW+trV}yZV8*CHY++=1b>#KhdJi!O_Ge$B}ss_K!*;A zfR!pHq+0CdJhiI7P5dmFi-Q~3H5;}zfYpn3lfZ@Hqa;=v*l8>!CpqAAA)S zgN}eRGzt>Q5x_~NCC>l^P(A;5>jikx`J<2hhwDg26nP# zW7k~SCpx>pHv{*Zzejh<*!Q?`#EqfdQ726>57c7Dmd1rHFU!S}o9>pks~`CB>QDT* z`ZGT+-f`PpvowoXNmTL>a$&yI*kbQ#Oli0==r8H7c?73uSCb^^=L0>bxXqL9M4u7l zE8D-sX808CQC|8w`9N*7Fg%*HAsj|DEP!f?ajv2I=-{?&hew`<&<^Z={FNttpf_8b zA47)LXk&XfVld@QH$rQN`W&!|15WGDW962*o4l~Uj}Xs71QLd!AS)s-d$BR?RK9?T@@`|CYDyk1TW< zZm zmKE2uuBGvot8T@cn>*g#zT@rn8}3$bg5S#C(wQYKO`&egFO)oY89(FRd=1+Sjsop( zL!^4(iTxxKwIuZqC`@Mc9yj(3ee4W9JhC1i+2|8Hws<>YeQ;GIQnZ>-cKKY!pw0QvKtz-M-4H`9=Flrb!h-%FfyN5<=%> zD;67xhsvC<7n=c)O4+8$>Z#lE#J|)}t?8)WCX=5g@S`vDuI2z2F`A z$Xs76uDEU9^26fK{J8ovxAqO4E@`yo$}YIQy5{!!mh06OtHl+IW)-W6E-*BapCfz2 zxX3q_NlIACT@8j}GK)e_$&r5O>H97HunUF!{16)FiU$({KPJ)|Bs+rYs<)?+=O`Vg z#EBGMO8ZT(DXk&tXZ4>a9K>YD%A^3>scPoeCz^D}!i&LrZQdk^1XRb8jy4tt7cbl#rSuQgw2k(tT7tV+5?-u%jPRgV-3s zj{6f4#Dfu;9~8^8|++q87eHCKx_yt)2~A8!AK zA6I{3DOa?#G-~N=ODhewYRHOONF8uud$5aE^^N5~yds;oa(L16KGGP59lL%nWf7%+!FpYs}yGTrM3?2JotraGh{pJta+zzw{o z09Hlo$(qk6x@yiHBvuWiKtF28-mnb~OBT`pcHO+=y8VHbtgtkZPH1xsFQf*A`eQ!& z&5REvOoCQ>fvxXG@(vBtDo{Z17+f&MRe3s7RB2Bu>b& z4Nff8e9e_Zox%79OG_h5TDhW=YZiJ#C##gcof~w8Y7Y+et~6GN#Q;-w(M8SrPUOIS zsG%yqQ^zc@3tZk2hIUI}xe5D)S3hIkukhTYag>!A}wZ8Ei~?ZKR`- z1&u6e2+s6|1;)o-JTXX68b~D6la~&7k#8kO?}g^YGLc5TcZ_aibR#a#V;}vig(9Rm zg{-(3&S?@x(0UGhUitZ_JYG$Xq@jB#oS4j~INd_>)7giokP5%c359b?rCt(XF)OGy z;cq;%`%k$DGhfyrVq>i?Cq`S+_KdZ(wvA5ohQ>6pJ9C4P=txie)V!0@cTv=WMlM)v z{glmx*PQP~zMkwko1=yl?`hJMylR}k#X2Yq3C&%X>bn1>Tg?fcv;2si4*ou8R7Jzm zYBv+R`ZRJd|M_GxbC72{HYFm5WaC_;DyPrP9^jWi>*cc~0lXagYUV@S-+2I-##*|j zrSlzKEQMpmOgLTf^kNY}aw#E6MMgw(!9Yn=i?nJOE`aqtNWIQxDB+o;)Sr(PK)u8H5vQ?? zY?a(BFQy1hTXMyZ%D7F#KSXeI+_4K$?GBH}_Tr}lby!qm5lPj0vVoUOoRBOwK$B346 zq8XOf>X)R}Kv|!Uc|@t#`vtJRjU1Ub^RC$w;6HkOGF^cQuC zcZ%^o6Qa+5d%y4jkOP0qD*@~4TYqPJ;;RnKfjsIof|V=I_vFBoxgTpj#592>g$$2h zsAtbgUidqSdeo12KjL)^fTbg-i&~bCles=v0;!^%fvX}$H7s9%>f4K!mG7v(STM%W zwk^xWlGV7P8y7UL!3?4CN$UKRUpY~uayp&xF)OqGndjgY1kr;Wt=aDn?fn1`D`{4e z{Xl1#-Y3PXGD6Lvw#fC$NzCEl4+K(2U4D4ZKvrV(rRoB6`fH$>$eCRAsieC1p?tC% zdz=Ztg|EPBMtsc!R6-qkb;MRdQ8R<=fRm&%{`O4$-<9k=?=tyc+Qx{bYg?Af6-#%; zqF>PLnplRWY^Nz|OnKOAvgWC7_tgD)ptIBL{XAlxw~@WmulSh9pSHbR!g7-5Guxn0 zCQiR&vU?`y=p_v+zI+`gRJzMLwL--u0R+7+w)wy8CdN+nv=6OaI(3<~L^UQT9 zBdKm^CiX;D>V@q7J;|)Ke4f1FGh+;G)3IEvSdJ^Yc7ZW5p*>XqDb&JH=behOL$&Mk zox*(0e?I-@fZO=BNb`wpzD{<2XWVzvut0n$#ur*)m1tq^#w;9U=^or?eD}pPyd#rn zf3>L`21TR! zviqIQxie;cyk^(UbU0s8X1<{>etc?8$&`KP^oE>ESj@rKU;Qb<0A#`891O>o%jTT1!xe{U`&gc=wMCxVkE;a)`m@v%1LRQbn>CZjFJE= zx%V&fO{JcGxg5-_ZoZe$V^cz;Fl0M4q1?5XKx4?gE5mQC3B@2sGgg$rGx>?XQOu?( z*RJ?MzLuQh@yU+#I^-WUs)=@WERS(7`LEWj&i$~bgBwtbrk9tPOO~3vMkl;F0_i6H zHg?0wRZhjklDkt!ZaTFKaD7Xu{8pNLlqKqiD&EC)s!8RxEvklm>*MVYUB9c!wZ=y# zd=+##nS6dRfMY%E1>Z=o5fT-a2cs9|GmD(3g?O{q5eQKCdfz^x+aglE&laPFQ9%2KAaKA&d z67e2~EBUbA@*(7V83MMBEXv4GAOi%f$)pYR;K2219YjQRFW9eZ*b1Lm(d z*-yO)b7SS?o|HQKM3YKwVtpWwXTY&z&<&$*LrZu(O|3UgF1}WI)YH1|lQTMCBNm!w zW%$XmH;ny_o=5q9?Au>zKvx50a;V<;r>V&c09U!p89+GafA9X8~RGhKUG9xM-@DxC7OI{&fRNVzjJ=p-fw68tQ<6p zo(*5U601-ZnpBz6sbLhskrE6gPxr%lyU$Pi=g&!FDc2K|QWeBU-;I+<_LiVo(KG6r zULV={M+UvcafORx5G`s`0kB|xg(yxclb529RfI8vMFJH)5{c6T|E6OaB$kd5@fdoH zY!OzGcNJQV2`xw)&M`HRob;e83sBLs)8y3(7N5I&7deY$Zled|!TStWiV5bOv0+mi zC^@~`@i>0q*WvH^W%Ktu4fl9@tWnw+U2Mf;WJJx7iNk`A-03qBzvrj*stvp1WyY+iL;vdSNi&W@;(n}Wx z>kMcU3Ex3W@$48`)9VAhJ~FVu$ygdzGkcIzN{jcIksc@$QUO*nBd6pl%?)I;=W}|e z>H=%|r@=uUs2C2B9l{o2pmgwQAT^f|8zyH(<0uD{_zvfz-V9)VU&RFjYh2?oqYH^?WY2zIY7SaiS#CDTgl(U7`3b&gYFo0#OblhLFJr-Ga)|oRTYSR9@PAXL=AL)(pvw%{HUa4 zB+b*sWh8QHG?}C+c{wI9R|MGXkE}GTa7D^^%lI!~_4Or~YdP05E+DBW-lW;C@i-mm z+4AHbxZl3#e*2#7@PyYPRO~QeMpy~0y)+n3ISMYNZO&;V*>0zvJJCQ;jU5@2uU1lC zM`RwVJl8en(2kWaA|T1Wll?SJ5vEQ+jgIK>3|B1h85H#7mOOviJ?jB(Q#Hp?lfK{$V zb+RTCpLWt&H>pS+i5;F2pw+t<6|BIJcnzcNA{Tk3OgPIi&(lQTrAROab)+A+Z2KqH z+XtRD53INMZ2J%_@-m>tht~8a^7WjFF4wP7jpGalcqQR;0$5Wwa$(|5cv+vIS&7Iu z0# ztL+1u-2>Zx&0uz5eMo{g7BNw~B4k6TYGApT-=|k#reV$8w!g_UP9e@IK`)tu&W*A1 zXiU>dKbwQnAwc?0uE#W$>LR}tDef4_#UWKn&j6J`qwzX2`kvlx=!XscxM4SL>D`Wz z9-|@IIWk7GDd82=OQ`jqBYM9tIa;mZRHyoF%tM`MR-qT6!|51{_@&CDsZ7hUeem5m zvuhvZcY>c6`2-1shCo(HiO(S)FfObTT<%^+oF5o{&){}A*W-MTw<9T@rpf>13LQyv zfw$y%hf~g!vpvPH3}82hw)}nIa_Wi`%tOWF{K)7BMmOO7_yS;6``{cokDqf!>A$~^ zJM_nsnHrxcMnq*uC{PIHM4$h6bmCyeA% zqkLx#vF=IWSLGI0k*KHYa4rDWm^;xtbCGhSvC7x`X0i`d7ufnOOQG=YaphvlmDoso zFjATw39*P{;arvCBO%%-h0k*y&^pI+@XCEQ$9{V#Q!s(fG4PpxJ~soOizt4%%=8Z} zU?s68R%rJ%GL9qOxvKJLeePAtP3DvyVECVXsd@cbe-GNV|I?ivAW z4UILlt)*=nn$FVr1~o(R%hp8EIgz+pU{9$mOlW^6P6V#^eQeiLz&gT(gc#m`?j{@o zqvw2Ar`5V@P>G~bt@7+7Xjr2g0%&;`qbenzZ_cr;Kg^+s6QyQ--uYdi>GvQZpjD#q zd*oj+7-MPM*pIO5ShNe;u?>_42`T&PL&iqP7M4lNx=DSl6OVn*w|lZZzbvnBzWxk* z_WK}?PER}Z=kp=qSHddf)CaIik-}N^(GWGPBBipoSY_A4cc5HdAnZ3L6JBKI3q~Jn zN(mIyVM!-n%y8f2t$1#wtpS9ODp?C(Z zU&F+my$A%-6K9|X#&uKNSRIcXa zPxC8xYHFQiZU+}T_4B~$TZodtvG}l5d}g@^9#)|>C?!&OC{8**!%uE&bV8|pi{Ias zzsRda$eMq4o_mcIWCbG)*0i*CN!zUG+7(^1q-z#5rVEWGQf1OqQ3S$dLp`dw<4g$aDRi}5+w0?`S zU!ExE7OF(`A=Gbgq@^_rTDzn(OIov_kp)ItM4JdwWnZE}%gSoUIrE-5u)Qsi@hrVx+;)(y+iv zhm{3ZS_};a8~j+&*$%;lVensEl;GvjE9cR(UYD-@q7Un}sdL{xN?7ezDSg>unnLzr zsf!MGw>P!}CHXFLkuyjFtRRv*z)01_IRKWS#nR>Xh6bY+QA?@#mx@bP1e`NXV&Pns zAYM1%NovlgSiD~fHs`I?lPNBRJeqhbK6KAf{~Tj{UhMAk#;R!y`ikuieD=A=yvX+| zLei`bHHOIk$)sh`AT$VVd_}OrGHG%WgG33iUZNnK<~&Y6(+=a$v?hJ?Ne9khhwoSi zi6uI;2C2#{%rA5jojIJK^mQNqF9WSZmHaO9eTpWvKV=2xZvv#HsqMO?`6DZY*+C13P|szQuZ1M%7yukgWrf0gTekJnA}XM z|6kl5@o`TX9%r2e=XtL4Rhapq>K+A6!spPBP;$}t@Vl~Vr%qDGm8*)Mq0>PeLx8hf z(n!NKQa3n?sW~!+va`7n#eieP#Zf-Xu_+=l;(Kc{i}VDy?-$rzpbRGpilEGCke)WI-Ze{LHqFXTZXY` zaDhK4qPeO}o)>$brE}4Wi~Hytmn8vA!Xj0J_k#LR_p9+p=s7B(PfKM9hvzjlj*u!k zkVmWKpBD+0mB}LK#Q(%kNexXE#KoqRo`Hs*HNCFcv0-3K$1=7^HHbIyR09f#Nj`zp zi8%s-RKQS?0qZhcGQ*aM2`U+7^7b~pBy{qvnfBDRyYl*4wW*(dSKo^SV{^#8$XAxM zsCY|m1yf};s|hu+oHz#EvGZ#-!vpI+ymrGAjvlcdOY9YlMoWSCyq3_BWXnI((N); zZ6J>_;u#SPJ!^KX=~*+d!!rU+@C|63P)Kf48r%(1=_i^&D}1wWyzK#2^<|a(lfN<$ z3bR3M-4v2w(=qnRtOt@Wjue&HH~KGN^-V+wDC10M^qU?96KY~5uo@ZI>YBB?=V|!B zdicn8cwjd^;Y|Q6V?q{(#Dz?AJG;bmuN@1gh<~RP5IJLAz^EjMqGIqEyf-*!@!q0p zX|n27omSC>bbqz3Rf_bPPLqwZF0jW5sW003fJ?GE6GN~Pl0S@$2=3=izw8mBvy0h|0*afh0EXYTpJ=5FjSz4w(F zb?Rvp_bC%|1-u5(^4`Q&^^pA_dpk%!tp6?!lL9?S!;-0HMg?5^Ewj(;8kXXiOwc7c zW>~6_dR&Pl9=JCz$!TGCsx!TAzw_Di(ugiD`R_qeVMs_Wt=NaqZ`qEItox5VZa(n1 z{m6EB!ucJFi*5=HAeXu%YgpZkiA^oy5zaO8^Z0Zs?LYdTCuFOLy?eybpib7hRv4Vh z%n6@1hKXi1(XjG~X?YZ95rD5FW%Vgaa#)%4KuxTCAzruV!ymp9$xe3}(g9`flZ$*$ zl9KARx@8_Oj?wq*{1cnufv4>U9yjlK+J0a=JThvJibJeV?$iKuvC@Mv1|v--Yu7ol z=QxM6Najq=KCa$3$G+VUt!sAjCY_~zF6%7rqdt^9U_K9H_SjxU3UHyJLy3BidVgp) zvvC&f=euS+eKPOjB41Uasjta*U;uG=?HT==?fAfYc+cbZR~|RNvfh25A0BaRQ8QwU zB3AHHG%StL<=i$5m&~4TeYT$_uOMPI2Y*!J`{lFb5TmMaJ_*|gWIyBxPU=_PpFnic0fe`+rcZDK6=lU za5|d&JPE0%&p7PvN~^`u=eaU_i#B$?6+lrW(i)QEzYZD%N`m5@!+DSQirSg4Zay?Q zkFW7%Nl1GPFJCz-DeSL{srU`0!WBhP85wm;@1NKV_dM?2^SJ$m$L%jX?S5f1e29Rx z1LMG0)WiaQlUE^E9;bMJr!t$6&yD_Qo39dc(r0#~v#k&9OR7j$1s*eA(kZ2kWu`KT z!~*@XN1?B3V~OU8w12u&c>OxS^(hl>I-Z0KQj35WkJo|GZ`rvgo`#P+ z_P_GD{W-jLzp@@aup93gbd8rGM-x>Hbs6_u7e0a3Z}8T>cD5hMC7e0kA@U>At`CPw zMf3m&)sFh9_vh3-)1U&uLzH}p0RJ7h*>m>ee287L-S`R+O1)#)!}h>{#O zI0eakFio|w#u3*#axM27C|&^?pEMm_rJB9Oqq@j%R|=`d>B!FQcp4t~u=$1e+rRQ* z^A|pD{>sDdS2n{(dVOMKi<2HT8o){%suslti@{h7CZ~_3=eEdiXcoy~8?BZCSm``# za+TECcrxi&F@N?BN6%zmH8~P}I~`(61kgl6E9M|lEd12AevJ89>h(xVjw<~~reJbD zZRRqX&=6y=M&LQ=+`#|JjM+i<`A$ghuo<=3abT%>c$1((|NgY62_^64KBlft40F{BK6; zIr)rpyU80@*irc5(<`0r%bX{dwmQziIyR=f)03ZfWQj?Mn&b#u{#PTVq0+GGF3{;@ zCR#}%wSDcUy=aLqu`XVcj91Cj|H@}_5rCA0-?MdV9=0EN|L`-vJp7gQ_zQ!%$2A+Y z9l&~wNwkIVlz9d5ib!Y&CZ+)qeBu-O0Exf3dpp6NTsO%tOuvIFK)6fYjxpIDU zpjF8Ww1&e!m__yrfw8g$W&WdQY!BIcbLt02GsjD#gMH#>OXiitN#lm9<(Fn$N_mm{ zTGnR|>yu>vI-Tg?siMY3yZVMw@>#tO3~tMI+^`!r46*|mX{^UIhNiQq6>vT*sLtTk z;x*E9OrZ>kdL(y(ii`8-hMHd({~0gMYodhv-^%P&EUTIC>c!L1z1r<_PS)wABo0m2 znQ#N6YcjO_@(!0w!acjWrgl^xeWfS;6jSZca4)3MZ!3ko>!O}D;&fnS#EZjPFxFrj zi)|V(CT#5#AM0nSx2TcgrBFq51RcRUL~LZkn{&kBIU8ubVjo+jkZ8kTx|)UaG^s`|`nGs{EzN+O?i%`U$6?^#N<5Kky9iB-gg1ZLY9 zYy-wxj0u2cyvEvSu@;qD#0xm0`R70#=uoVKR6+MFa$e9_bplWT05YFRL_t(~P7a%d zxw65uE%m;(Bo+TE)}A^BR_8grN~$cm12$Fm$4RQx;DUzbM>GT0JbzO21o(CV;zAI7 zp+@y=>|7A*I~2`O6~Ic2Vy&TR8;otREi_HgvO?KSllg;&SiU@#SXNI=+;^xC+EwXQ z7$ST8oICO4;uRi-yZ(8}d94ujVDO_Ae!mm0v5&s{aNu1`%> z_3)rGZY4j~H?gTM$n*P<e~)9^_Nt^hhpY1fWACPu1#5=#hVe6n_;Qqn4gq5`8Kiwh%{SJ*?QLa6gI` zt7Ii-{3KJUoXhbl3eS#ecD!fo*NgnFbzM_@Twk1#lq+w&* zR%5F%8{4+;{O{X+xG!^__W7Mzd#$zi()WpL;JFkM!+LRVbx47rgp!+ZF;J_fzu&m!~ON> zl!M*|S*=8l?cD-*HIDb?aOQalby`m3`{-UVg5RV%VxRQ5+PcV`J1ZbO^arraM^S5p z*40m4J~<4IjZa z_lJQ=D*rwN`mJrbP7JF6ZZX{{P-S*A)!@F}!rg-P^{94N!Pm~>& z5KW^X$Vhx>b+MZ@g)+W{9z|E*hltAQ#@Cu%a#X9mc4I zT*~?7(IKO^Kb9<%E-C5CN9<7J?OT59cWMSTvEZhi+m9#<+EhPD20A;9sQw)l82I~! zmX{ty;$zqTQho+IX-{Q%pOhowX+(~)+gL~qL@EdqCM6p(qd}ptYssg7N>qTy0$!E= zxdOIa5a|v(ALtfX0W7FXX+aP?y|OBbq_4!BE-#i~`WuJ(FFSmy6St7=D|ZI-ezwf> z62Dd)4NMwwp@ZyR>oL9FivJHM8fJy1zTgKuK+bKiqAcR6 z6k6h(uKe1dKltZ>WRZOF_%AA0f7bi4$l+fcrha**K!Z*xpH>8_uPJeYr!X)8J86tr z%e3@xS4EVuyZyF8hT^ck!kh$IPy3e3JL!_u#35)aGguHDcCeI{)08yk zJbnj4uEvyId=H-%K>>(oeH$0o)##MC?ecRh{9Jgu|ApAG`cB2ys7~B3FD;gbh7hT!Hh?yLOUA4?X50*QYAx}_khep>xnswFceem4VC<#ZdbXDC zUd|dr>=rUZ^U8=!i66lNL*)+ZpQ`qFp`WUvrwGO^_sI!>IcmW6!GVXEjK#0VDsCz7 z#?&g3SRD(%k*1M;*HSnmo()>;svo&X{ZpKPU-i(UP;L3VN`i|9f+7yX4gZ}j;tui~ zw(O50PH}ZA_8T3NhOGJ9JFrg{Y(B&tnP`4VG)c9JHoOEyt??+#pW(BDX7(U7h0~Xx zRh=OK`E|~>urVWk=I8P=Qm5hEA4a8qLE`L>zWx`S#dmKvFl}&L1TJX4!DPdjFu}L= z(-U0{t@+e3`vh5BKH`>ESGOkR_fY&~7f@DaPIjuWT+tKAw$irvo5?4~+U)O%C?VU| z*mN+;(lmQ1Os>8XjEgfrX$+GoFHrQQ;pTi2-e)P>9fN@g}iLxcwnaRg` zT#oR{F7?k1$`-a04J$>ZvtEK?*E3Jvdu5b)D?@1I1q-r;Gu{Y37FP1TdiII5p3Zia z_ow+VFQSK7v-;=I767hwq3-fh^2tB-5gLK% z?;?W4nF)}ob;O%O`=S0a4KJ9?7TV+z#XiHP-n?)?+Dc(oeJ6#-_vlB!f`5DY6n=HK zst=6Db?+r4GMb^b7yv@fMy+ny0b@}3b#$)WBG|Aj7H)w=L*E5CK%O2ZtWqh!_dDl1Ay!r55EWg+)Oc1&L zC?JoE^rYLUL)#g2)rR++;=0op-ADLrBUO+Awfje~9mu}YNJ8&oSZc(av7fF7GCE40 zL{ks^VvF!JPfmNSJo%&AnLq^~Q($T&a6UGSbIv2P7PehkmeP5KsQ$6+$@LJgsM$Dc z6c3@k6Xa>dY4(O6oyzr9Gko?7W6Uv-10e;Rk#6KL3Ffk3SmXd&)sBiQH2&J7ms6w1 zP9hK8oGS!z8AT=emjB*uuzx8Vl&ch`B<%%Kq_6F3Dss}3vG8*QX@Fzzc5ki=$kPw4 z?B?#P#`m=0^P0+GZ?A@4ZgT6ipzYt;im}T$(|lH5iuL&kam>$x)NEn_!L=&QGmtZx zhq(u(GCZBggBkZb&r_)PEV#*E{8@oT>#R9aGYomk?7=6r61q{l_kIIyfiw3!cqV1B zMm#ECw63{BAVLL%Gv6dFx|K$kh;U@1pB&D5&--xSBBB)xTnU!%ZHV5b)=2KmjTj#} z8hb19qk75NOem&FKv*CLFo$7XT+=L#ZXIcqji3HU%78S*s~ z1j7dVgMs;ozgK*6y7XP!WP(VgHN2;l9Qj16sm9BCzuh3m1uq05q(gomb}LKtRrGWF z9t)xQHA!|gwF)8;cVL200ZkMsfAp<9mSLYg{>3}N88M$+ClV9-9B+B{&~i3x<5F~AS~O{_ zg01ySfemh`h$MiB#TrcmWQ|A%!rf&}5$uuuhXq#ux>`9+x86Q*@rA34uiZ^#iQzb% z5{!$Q3SD(vJ8Mz|Ms}s($(3N>b)t%ALpx?98y4Nj@$Uc8jKceJ_&egj8%u#x4HVt} z4|eA|{$R&-AV!cpqvsUdP!RK9NZ$AUU_tZ(?k*q(zIr#mNZ0)FkmRz_@{)bEgVCWL zyvOAAf2KRA^BHS3WEV^q>#i^~Mhpe8v@js+1LgT9!i#^u#3~WwM7}V;D~5M zs|`XyutT-0wYFTCl?D?xVXp@@>(_$0t5&h1FQOzGOlB&-daS@1aeW2O_EA_H)4tVU z!usxAV=0`<+20AgRL&*em`!cueW_!{5@&#^lesJ53w1ovPEevjazcS&C(@VA zwl7jd&6ie%rj{^#x8kdMGtbajO!dN2>_*{7WSGAc56mNb6qv=5~U=8380COb@dDb)-H{cP8 z9Erelb;&eqZG z`vSSNm1j)elYN<($=C{m68OeXC1XOasLSX(dn^EAYCd0p{8hx-~0x)LNDuI9oGvl8}XN)l%7S}(H@u-zso5kc4osMDDPHOpK zHXHD{ZNsUvUtqJ{h&|7QZ|42?tXeJDH>B)N7|K^*Vk-UN<@``m+E!{{G04Kn#BDo9B`mWRwE-lx^bX6F=G@<+IxQ&uo>wrh$^0jBV z5Gw09noSovx9zXF*O;nvk*Z%TJOVaj3fqpZLG3^0y*uoK;c>P64+#tKmt**w-_yav z^uz0rN`JhG+yhD4@rYMisonhk=8~@4OcPmfyr|wH@%3wG-qJ16lrH$k5xSpj`r3n3 z(>9Zl{FGxMHJhS-p!m6AF2F9p#p(o_2`Z-*Xvveqn<)CE&4u30jPIF-NJ(6?25;c^ z;>XFBQa3uHNM9ZgBOwu{gbg)v*oE8S%Ui=3iALyV?U;@kn#n^sPfKrcrIn51W;T4` zkqy+t@v$_WvR|%Sv0uK!&wP+RwW@?k{N;ccGih)?BV}yjgNIQ@AYS|JpjK8UU?G*8 z2EaqOh;AKms6if(_Sjnz&b~!nv8oHw0l`4n$V=IzFr-84I}g?)1S~9vRcnK}hlWdG zI1w~yG|zB0Hyh{>7ySCObmm^ciF_P_Q@zv83O29dEibqJlym!jug8J8i};dt@>4Jj z!PS79Uc($?!2{3nwK*cPmlz0YA0AKN(PAsXHxzku+iDRqXR^k&NMp3_yg0D^@Zwg5 zNYf2GFOVm>xj4YwvgW;v!~TmNTHc5?Ln7f&w)k0PN88ay;&lQmhfh;LN6v73D{*>+?FSs2n&}sy} zc1PpiF2lE99I$@P?uAzEw;z*E_}yXv5_u2fwk_bAa_rkdV$r|uC156V8aZ8Pg3;Fm zXh!CM@VP({!7--dJ!zN9@HHVdP@B@poDXekA8CF;>mTrq78^v>}#HXHqn7+-w|T zEf+j3x0*$yYhH>TUiBg&^0A#nBu-b;7pX>|)uP`b7Q`+1Un?8Bh9(rdA}_vTqQ?>D z&Q?3IDzCo^Nf;Wcp>9hjIpq9PUUa7G*8N(W=HFdxGUC#mh|vDIEhCN*Od!i-1OUkt zEi;IgQisI#pwBr|I1ihw7XaxezC`q<=UU;)=p!fZolIW$j@&wp`tJqT&=i`cqK|TX zJz-rmHLZ6sAmflIHp-tIbWYpLRiKkohG1GmlMUStYQ`awzAyV4kTh_PdoCx_NfxGz zZHxH&{d&i7h?Mo`q)mS*(xUbN@BF25i^Mw%-es9ty=}H_%V>_VGBFK_Y?)QDRqqUN zT{hS;htB7z71wIy@mouiB4{#pt7AU%%!{By^8VIyM@+$5WsJUuP72XtRg=mj5?v^+ z8rBnd3yDMAN1AN+P4m|5_&xC#ye_?UBph=Rg?YqPZe;WpWJ_@*Q?T}o*jaghf^*g>NP6MDOg^a%UG zZKQ4~k|CDQL~$GcnB>7sWM7(*2Cn48i8%h2meX$?O$EceIPedKm_`J}>{?dA98L^7FCe(KRCQeBIvMDEf?!;}fO4-8C`-Qw;z7`Ws9%*SUe zMQ$|?b*JyxOlX?DcrNIw;egnAD}D|}o=LT=;G!;=S6$R@D66;akAbT!3pp3R$<9Nh zU%wj89_zFq7GS_3N^My+SmJMHTm^~g63YPHQEKRv1$bEgVrZ&14WU&PI{ac9czv0E zu$q=8Q%YPfn0YYifq7(#A*Z!5&l6?69;Z%y3Y|L|4r>hhZcNLPVWm1}o7_>6KakDd zA`N&p>9LgWpDqn9QrTB?b-^gb5mpU!awMFSWIZSn8Ya3uqz32-yxe?%2TCw8s)ovO z0rie0qqet>`|JrUv1@@mo!ypkvX9D-g|HoTltU2kIT?#Nrk#->;?ebrWOlWPX&m~N z`C8d~-i_U5XNWD*tFDYG(xCRxQabx5+_`-Sbp<<+x z!oARq47pQf1fzXjj^}9&4SN=}Dkc@2fZ$#7wBX`(xqvcrE&G+CTET z%;E>1(q!bK67*8$PltEvC>hD#FX2PZ%WlqhItIY((SL`N;Gh%vP^3h$f>eX!$9{Ca zBfN+SZHK#f%BotwSC!ym{~*jK%f8Wc zjy@q&Vi8X^B}!bCt{?`bW~=-}*cA1rNq$a@buPN8EV`*aSd#|r6wN3TWS!-yAbN+N zoRb(7vlM(L)NTUgUX1FpQj-iKf55Zo$bL2c@?CD3Oc&@Vq>zpPpYKNnHQkBZ0n<1C zbfAMyEFFm|BdBgdC+U~1=NIq61gPrdQPog)&+Vu7D{t{-B~GXnt+#D9*i~&9(Bp}; zcgcFoya0$;hl#GGt3N7qInu!3XrXi}t8EH?C+{s5J%>%F?mQ0_tZ%OiYE?21eQ=WA zi+xrOA;8k0HTb#Ss$Xt;Nqk149U1%3c5X{dww5|cE_hRTEEH@}HN}&eK!*A+AUO=O zXjOrt{LN35QlfZS)mq0WYP2SSeN4^d0H~~g%Mv|n!{A#=cX@k6zkbmONZr*vF0_#& z@g^QrWMZu!u$3ibnR>rN_x$>ls$lpm*#@uoP(|+k!Z85bJ}69KXm#`}39f|Uspy$G zFJ|Tt`=@#NGriW$_06#6usBiif|bFM7YU?|i`}O5)of?X1)uCn%No?!+Ao1<)alWd zGbS{tj^1!|Y#R5ABdQ;~OK7GG6-xIG54(szthiC0>@{C|rH6)cNt;ov;rk5-LPX!t z@aO|#zLa16RW)@GO>N}xy6%NfH1i!8QQ|nopiNrKs)Gs#Bt|xL)G?`~` zg8A*&tR>LYL0p5(Sf;)4g7jMqi#^c9((wpv|Kp|viJ zo4=}SzWlU($K3fB$De%L;hAq$p;Joborc24sbi1( zC@7W2a+iYfgi0@m+(o7hQ6EC7T5k`>xwq^>yUDU3s}b9B5Zz=i>|(iQO8Ptl51KQ5 zWSV%D;B(3g^{W4wCeYUA|E%zH#Spp6k6vZHZb2d8bK3Knh26&%N~3x!9PvIy>;8&V z$Qx9(CB{zbe#R5#*F%ruhKvH!xx`&6Biz==_hNYaPx8p4n$jS_Z&TRFiE&V!nW&ZR zhd=7tnqme2{O9J+H~oeW(%qNo_x+S5|D!tL2cWPEA~9d=rX)dnfl^xZrl|QRNr(TW z{c!WP2B#8;+gZBoki@`G3=E` zD4G!+Hw-(uk_SBq$#P$=1J4ppK0*|@FMoRXFEAOI_sYQO7bo#$=bya1Jd&z?0#NH& zsCD}erDpH34y5GJYZ<{9LD`aM`LAYm|0<_JRR@0CIm?Q?ZC29>i11z0Napr`^<$?x z1rjB#97L4t;``Whmhw7QZT{k_uhH5ul>h*MEU1W+34ZkvQ=z#MmskGo%!WP9nz<%l&s`wq#$ z!68635_1UKr|4)rT?pulx1r&trDzLinwV&vEVpgBB-_aD@C;DI2LOl&hqARf3JTR@ zlXCfg$s!7-%Zba*oIO3;MXJBj6^0Hxu>WhqwA`@iRTC5IKa9wD&JHJEXRQ($Uc~a6 z>n~8xiL;Wf|7YptDzC@pMo3E^3d_Fp-+L)lx89WrozBBu@5hW(BO0 z#p%Ew_-6m6tq9^iE>DTUBlgjIZMfvyaDnG-6}EIn0)OWPRbZ55yUrlLFnwpS&{<6V zgoeJ*K$%`UFyn0hPP79A`e>}=vMG0!UHwU~A>dw`{@VP9BS7!0ni@^NTB z0sF?{nbfw;nHKuRewgZ6UDWa&MBRE#zBO1VKiMDj``Vw{?vNF;3>*KAu|#dqYovHF zN*8dG-4`^8(xy+4`pVsI{wHbfkPL%N%i3aVD}<%e_n_1QEQa?@BrYg*I$B+Dqpdc^3muKC%i8j3E!UegC-`{30P0RJL$7Im%ylSz zZ=TadO{f{>!4JEn+zj(t46R&%BMLg&CCG zk)JInj~!-yyL0&YihZ6sJ^se>Kc)FH^S; zky_?1QGG?Voi(~2cue=u3XZf`RY&5^YkK0lZ1708p<`j!5Bri0KU1fl#7Ju zT<0qR=oL;kBaOJ15z)w2r~xP`wnL@TozCHCC^8B=(>|jIjOO&bh3Tu^aLmDEvudbW znMvbwx*_c&z7w>~9{gbTu&nE|fL`xRl)4*5iJ;N2Ee?W#3dvbOi5)b$ zDoZc)T@s%N25e^gMd=GFC@zFDAQiLa+hy71Up6~S%O_S56c14u%NpcMxTu-=rZ(xC z3YcoRYO{zKd^o1O0G(b><5hTF>cHBhRwLLf+-O{cp&i04F_!fT=6pZYQFCc0FWu9W9wiy}j?^u{TU zO3GK_LQO)SeRPnJkaBRM&Sc5xS5Sy08U_ajTepmhG8H19GXc`{Fc(P1y_3<#EMYOM zwuon-UKAJ>V4aITchMykaJApa(Ezuj{x&=7v2`LsqlBf59)+@)w=j{m5DQ%b(n>oq zg(LK&18lHD)bmaZ*Y1CNZ=O_}Xe@R_vyNzV;!4lTx}f~7$ZTV3x%&R$!mt`4F5cal zi*lcr$iL!cWkJ!8Bk&(CBWG86G*clCMFp_tQY}lDWjS-)BL3*1(Ke*7;TW>riVv^K}y1F9Bwms?Vs<P@VtEL3hlZ{ zyHQsbyS7r@Y=QMMQY;cAePCLXi;1#L6jl*>l9cbfQ>jceW&k-8lQn!bwd~(Wi?OPh zLa-a~^HHWX<1E*dS#pxMR3@IyZKSHv`N6|*_k2==Y#d$-lTvPrrp`xYJ~lDQb8_Hv zI~w%77h%OcJS*k`zeGdNUV9WuB=!^0`g?6}hjZ6#8eYjMwS>xzO|n2PsI)0w18m44 zD*2Wo$3N3|RzqV|JDn8$QG25!s|)u8-FhUA_XXsbZRdl4#cpGcEn7UOinp1(iO-n7xrA3W!-{u$)__gUUc`3N$ST6lknLxpUef-#J>%`qBS(9+qOb zVpKbil^UW(C~1`fAsY2lao>xK7G-YBly4ybMoZavKe_0(62=%8F-zybd`yP>uuylJ z@daAyJt#Db)imfnzIMKWBaFPnR>Q&MnkoSlH$cubTyGt?-{C|O#HtEK!V!MH+h%>N zxhY>27B&TO?3IE`C|jL?BC}6g(9jwjUs)+Vf*wI1NQW)q05xuXnp~t+optC{QrW_S zn3Cp3kbzgS9;DWgo8iumy`D+VZ((dMUj*A^``$Af8qA=cN-jSb!biH>3!BJvXhwlR zUyTc(gk6<$!`?Fk`Mhw{gWWDjx#o-(AW*i4TrM_mdL_~X>=(`W0)kIT9>S!HW1+EC z*DiB9?>FV7$zUwSF*om%aUbw>A4tnG#dhm+C=gV7CMoIOV)mzL|tK-mBpcLms)}+Kymbftlcye;QdE{wq_E4Dr(p|EI zZ?r)KPwIR(gkBB)@dI}!YHP^5T2Rlc)n$yo#5Oa4Ti&cMQr}@F=gP%t!U_lev@zqh zQ25~ZE~#Y>Bh#>+$PH|hef4*JYqWE{bMB-kn-%JXMckUu{TOAqJVGJ(4;ud+`^4O` zqM|BYL8@B<*61|5g7NXi2*I+o)dCEHdc6Cy-b`6e=f=v>$?(H&lM?l(KZQRP4H+ie)(q;5|JD*Z&{e9WAe#qUm;@1}#3wm116f0p$_FP^w*SW1 zV-~tpgHQA+cpWt*ptQ5=T-ewT09Fs`;t7l>>+MkgKl&xbHm9-GC!kmG?`%)u!w%u? z=eNw?x6av0N|44yjsh83*NFusdhL{#KxeyVJ(O%D{uCl}e&QsVPLr77R1z0kwFfW8 zi(ecK)-qL3US%V++fSk%U@H-pEUb-*5a&%z-AP*SQiaM|ljMLW{WX3MqtRTRR=FY3 z=f&=^!S|yIW=?^(j#?lm>vnJk+K@p1%Et>}0<`+>e>q4z(*3mGy(HJY*Tm#mB)4JL zY};Ay1bKONcXHfWaw*Um8i_QXM5SR#?W8JwqmNF0!TD3BzS?XG-3F{pD)|(Rr$-i8 zQgKV|k+eufdq8q+UZnhQx|b^+KqS(bZ91V1UI&v@cXmaK5&_}%t-%=#1BOXYHo=1t z`ESNw1Pn88CAHpW^=DBwci*x4-TKEak2+0vV2U@`)sW~z7olP*fXw14@zW|4f+Gwi zGryCe?Hnt?;{LiDS~pKgU&JQS7d0LxTH6-{~yT$*bA>ubDGc27Lcw2&DJ$ z{28#!;>($BxSMgZviyAawNSKc5iSnvP_pW6qI~_Cw!ZMdWP9{p`ugIugQ2trtxV;5 zxR*((sIY1gv!yZ?QU)|B6q1uhFpis0#BEh){X_Qs77)C%VQE0~MBWmql1$<(M=s%Q zoGE`L2r7$`*>jY0V*NLyXKMe4ntLDL$(aXqVcU4)p69@-#9w?U6ESQJMheOn7x`TZ zxhu-`rn{_=#%T$^(Og@8{Ua5)JF{QYSTPm4!Ud~E3;AGLaJl+OC!1_aG;7@vrIoIg zB{|xdD}`A-3RFyI3`RBV{;X$pro*|>c}SKH=8^nxe#WhtS6}oXMmF;#Z$@_P&>SIP zZ+wOQqwkuZi|^{6E?4j%3QP+|bql@OsRQI0L8W=v-~ijDJWzszbS^)-5KB?{cz#%& zeQNU0(q!3?-r55fGDbO2&ib zW}wYKHA}0-zwdPD`RBIdzOP7U!&oJaEk{T31)4e5;OhSRw-3MnsMg%!+sq2Hq=nP3 z+7ED3^L|d}vszYatl=qWsUK8v9$CX+M;iR{7> zajd+$4fyYdoXMqD&>TCTC6ohv07D9rEvU^AEf8_b(u4x=p;`Q6GfNje>WT>1k(=ca!K7 zx%kY$=GtcMU`9%8|Z82zF*AIRzIG%#u+Wa^XK1EB3}|b{v=Al6;PMn)=MaNn88gJ5t*wE`^_Y>rEqT#33IbU#=o69)7IcIN;w_Cri z=0*B?t=Rf^VUGhs2EOfiKx~YIZ73KVi**7G8{O|xqmQnC_%8vhU@v|KSG~1|cm(&6 zJn(+$Gm$woi2?A+h6;-MV$3-9trdH!2w9JBO83&UU@W;$2fC#0RAGrVgMp`sy5lV8 z3a4c137psRxB3A6JeYc_@7^lG>2{~?^g}iN@|KnJ#`&Ch`H?ZJduAreoi=@s(XJuY za@q=Dz;7`*gq`PiQ(OTK^V3hnu%H=}Wm{2H(~2@nSl{m++!X+;^R^vHiexk#w_XvW zXrd62VU%}+LifRkmgzoB3fRf|pzeqPjjv{B(z0cQcT060{^eZzI87>1D?P8=@op;S zTrcbeF;iLS-IZJt_DkhV`TN{%-fNvMy=|Uqz1_TUzga&Mc58PX{Q3K+cfL^vrlREX zz(YM{m8@fxwh%vtqeCHtappNQh`C7V<~l9Q+lDaVcJ&Ucd=3DBB$AIeCmd1Z$ysFoINeaN12}%H;!7RQuEQ& z>Ln&7uCZ)UE>WV?*{zl3cooHm;)h_sYRzI@_ix5ZN@-Z0uQH9rcxZxwCp*)Di+}fc z2E)(ErFXob#D}+YYy2ZqSnusZO27BfsqJ&_^O^bn&jP+d&E}Pt?`Xz4*6;oVn{M;{ z7F(C$lt9AlFE}4%I|bdouY3Lz--mauVuk@kK7VOjQ$?a?8e=2W~_(Q91lv`Y3zVVwWK8Y<1UpEu3p z+R(oF=ztz{Zh+Y7LcqGMUYt1!ayHK#2RZW}g72hh3_Mvx&hV$H4LFO=DmH;$!PpPwnqq`p)3&jj~&cKe^OBUx?VIF{t3RclGmSkQW-ynUD2`SVn)`%32O{mkI@vWsKtNEsNB~{Tj9q^4nL7Od zKOopxSUDJ3SQ**a)mb_DSh)CDSm;?;!N0unjQjs*f!$9tD|65Pe}ObwvNm`Dgp7ou Kc(tfe(Ek9HhU&}! literal 0 HcmV?d00001 From 48a07f66f8bce3eff65c29d2791317b543846906 Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Wed, 5 Feb 2014 16:13:44 +0100 Subject: [PATCH 0419/1360] Add VK resolver Add VK.com resolver. Tested --- lib/urlresolver/plugins/vk.py | 102 ++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 lib/urlresolver/plugins/vk.py diff --git a/lib/urlresolver/plugins/vk.py b/lib/urlresolver/plugins/vk.py new file mode 100644 index 00000000..1d701e7f --- /dev/null +++ b/lib/urlresolver/plugins/vk.py @@ -0,0 +1,102 @@ +#-*- coding: utf-8 -*- + +""" +VK urlresolver XBMC Addon +Copyright (C) 2013 JUL1EN094 + +Version 0.0.1 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" +import urllib2, os, re, xbmcgui +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from urlresolver import common +import simplejson as json + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') +#SET OK_LOGO# +ok_logo = os.path.join(common.addon_path, 'resources', 'images', 'greeninch.png') + + +class VKResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "VK" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + base_url = self.get_url(host, media_id) + try: + soup = self.net.http_GET(base_url).content + html = soup.decode('cp1251') + vars_s = re.findall("""var vars = (.+)""",html) + if vars_s : + jsonvars = json.loads(vars_s[0]) + purged_jsonvars = {} + for item in jsonvars : + if re.search('url[0-9]+', str(item)) : + purged_jsonvars[item] = jsonvars[item] + lines = [] + ls_url = [] + for item in purged_jsonvars : + ls_url.append(item) + quality = item.lstrip('url') + lines.append(str(quality)) + if len(ls_url) == 1 : + return purged_jsonvars[ls_url[0]].encode('utf-8') + result = xbmcgui.Dialog().select('Choose the link', lines) + if result != -1 : + return purged_jsonvars[ls_url[result]].encode('utf-8') + else : + return self.unresolvable(0,'No link selected') + else : + return self.unresolvable(0,'No var_s found') + except urllib2.URLError, e: + common.addon.log_error(self.name + ': got http error %d fetching %s' % + (e.code, web_url)) + common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) + return self.unresolvable(code=3, msg=e) + except Exception, e: + common.addon.log('**** VK Error occured: %s' % e) + common.addon.show_small_popup(title='[B][COLOR white]VK[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) + return self.unresolvable(code=0, msg=e) + + def get_url(self, host, media_id): + return 'http://%s.com/video_ext.php?%s' % (host, media_id) + + def get_host_and_id(self, url): + r = re.search('http://(www.)?(.+?).com/video_ext.php\?(.+)', url) + if r : + ls = r.groups() + if ls[0] == 'www.' or ls[0] == None : + ls = (ls[1],ls[2]) + return ls + else : + return False + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': + return False + return re.match('http://(www.)?vk.com/video_ext.php\?.+',url) or 'vk' in host + + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + return xml From 58ef7d6bf377c14f37c8d55be8bda3d717205483 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Fri, 7 Feb 2014 14:08:18 -0600 Subject: [PATCH 0420/1360] Updated ones and New ones Updated allmyvideos, nosvideo, uploadcrazynet, vidcrazynet, vidxden Added megavids, mooshare_biz, sharevid, slicvid, trollvid, videovalley, vidspot, vodlocker --- lib/urlresolver/plugins/allmyvideos.py | 10 +-- lib/urlresolver/plugins/megavids.py | 88 +++++++++++++++++++++ lib/urlresolver/plugins/mooshare_biz.py | 93 +++++++++++++++++++++++ lib/urlresolver/plugins/nosvideo.py | 2 + lib/urlresolver/plugins/sharevid.py | 88 +++++++++++++++++++++ lib/urlresolver/plugins/slickvid.py | 88 +++++++++++++++++++++ lib/urlresolver/plugins/trollvid.py | 80 +++++++++++++++++++ lib/urlresolver/plugins/uploadcrazynet.py | 5 +- lib/urlresolver/plugins/vidcrazynet.py | 8 +- lib/urlresolver/plugins/videovalley.py | 70 +++++++++++++++++ lib/urlresolver/plugins/vidspot.py | 88 +++++++++++++++++++++ lib/urlresolver/plugins/vidxden.py | 5 ++ lib/urlresolver/plugins/vodlocker.py | 80 +++++++++++++++++++ 13 files changed, 692 insertions(+), 13 deletions(-) create mode 100644 lib/urlresolver/plugins/megavids.py create mode 100644 lib/urlresolver/plugins/mooshare_biz.py create mode 100644 lib/urlresolver/plugins/sharevid.py create mode 100644 lib/urlresolver/plugins/slickvid.py create mode 100644 lib/urlresolver/plugins/trollvid.py create mode 100644 lib/urlresolver/plugins/videovalley.py create mode 100644 lib/urlresolver/plugins/vidspot.py create mode 100644 lib/urlresolver/plugins/vodlocker.py diff --git a/lib/urlresolver/plugins/allmyvideos.py b/lib/urlresolver/plugins/allmyvideos.py index 0944d769..14fda04a 100644 --- a/lib/urlresolver/plugins/allmyvideos.py +++ b/lib/urlresolver/plugins/allmyvideos.py @@ -55,8 +55,8 @@ def get_media_url(self, host, media_id): html = net.http_POST(url, data).content dialog.update(50) - - r = re.search('"file" : "(.+?)"', html) + + r = re.search('"sources"\s*:\s*.\n*\s*.\n*\s*"file"\s*:\s*"(.+?)"', html) if r: dialog.update(100) dialog.close() @@ -75,7 +75,7 @@ def get_url(self, host, media_id): def get_host_and_id(self, url): - r = re.search('//(.+?)/([0-9a-zA-Z]+)',url) + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) if r: return r.groups() else: @@ -85,6 +85,4 @@ def get_host_and_id(self, url): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - return (re.match('http://(www.)?allmyvideos.net/' + - '[0-9A-Za-z]+', url) or - 'allmyvideos' in host) + return (re.match('http://(www.)?allmyvideos.net/[0-9A-Za-z]+', url) or re.match('http://(www.)?allmyvideos.net/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'allmyvideos' in host) diff --git a/lib/urlresolver/plugins/megavids.py b/lib/urlresolver/plugins/megavids.py new file mode 100644 index 00000000..840f135c --- /dev/null +++ b/lib/urlresolver/plugins/megavids.py @@ -0,0 +1,88 @@ +''' +Allmyvideos urlresolver plugin +Copyright (C) 2013 Vinnydude + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re, os +import xbmcgui +from urlresolver import common + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +net = Net() + +class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "mega-vids" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + try: + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + dialog = xbmcgui.DialogProgress() + dialog.create('Resolving', 'Resolving mega-vids Link...') + dialog.update(0) + + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value + + html = net.http_POST(url, data).content + dialog.update(50) + + r = re.search("file\s*:\s*'(.+?)'", html) + if r: + dialog.update(100) + dialog.close() + return r.group(1) + else: + dialog.close() + raise Exception('could not find video') + + except Exception, e: + common.addon.log('**** mega-vids Error occured: %s' % e) + common.addon.show_small_popup('Error', str(e), 5000, '') + return self.unresolvable(code=0, msg='Exception: %s' % e) + + def get_url(self, host, media_id): + return 'http://mega-vids.com/%s' % media_id + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) + if r: + return r.groups() + else: + return False + return('host', 'media_id') + + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False + return (re.match('http://(www.)?mega-vids.com/[0-9A-Za-z]+', url) or re.match('http://(www.)?mega-vids.com/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'mega-vids' in host) diff --git a/lib/urlresolver/plugins/mooshare_biz.py b/lib/urlresolver/plugins/mooshare_biz.py new file mode 100644 index 00000000..db1e2a27 --- /dev/null +++ b/lib/urlresolver/plugins/mooshare_biz.py @@ -0,0 +1,93 @@ +''' +Allmyvideos urlresolver plugin +Copyright (C) 2013 Vinnydude + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re, os +import xbmcgui,xbmc +from urlresolver import common + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +net = Net() + +class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "mooshare" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + try: + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + dialog = xbmcgui.DialogProgress() + dialog.create('Resolving', 'Resolving mooshare Link...') + dialog.update(0) + + data = {} + if '

' in html: html=html.split('')[1] + dialog.update(15) + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + dialog.update(30) + for name, value in r: + data[name] = value + data[u'referer']=''; data[u'usr_login']=''; data[u'imhuman']='Proceed to video'; data[u'btn_download']='Proceed to video'; + dialog.update(50) + xbmc.sleep(5000) + html = net.http_POST(url, data).content + dialog.update(75) + + r = re.search('file\s*:\s*"(.+?)"', html) + if r: + dialog.update(100) + dialog.close() + return r.group(1) + else: + dialog.close() + raise Exception('could not find video') + + except Exception, e: + common.addon.log('**** mooshare Error occured: %s' % e) + common.addon.show_small_popup('Error', str(e), 5000, '') + return self.unresolvable(code=0, msg='Exception: %s' % e) + + def get_url(self, host, media_id): + return 'http://mooshare.biz/%s' % media_id + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) + if r: + return r.groups() + else: + return False + return('host', 'media_id') + + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False + return (re.match('http://(www.)?mooshare.biz/[0-9A-Za-z]+', url) or re.match('http://(www.)?mooshare.biz/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'mooshare' in host) diff --git a/lib/urlresolver/plugins/nosvideo.py b/lib/urlresolver/plugins/nosvideo.py index 2c4b1e00..12db1398 100644 --- a/lib/urlresolver/plugins/nosvideo.py +++ b/lib/urlresolver/plugins/nosvideo.py @@ -41,6 +41,8 @@ def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) html = self.net.http_GET(url).content + if 'This server is in maintenance mode. Refresh this page in some minutes.' in html: raise Exception('This server is in maintenance mode. Refresh this page in some minutes.') + if 'File Not Found' in html: raise Exception('File Not Found') url = re.findall('',html) html = self.net.http_GET(url[0]).content diff --git a/lib/urlresolver/plugins/sharevid.py b/lib/urlresolver/plugins/sharevid.py new file mode 100644 index 00000000..22e7db90 --- /dev/null +++ b/lib/urlresolver/plugins/sharevid.py @@ -0,0 +1,88 @@ +''' +Allmyvideos urlresolver plugin +Copyright (C) 2013 Vinnydude + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re, os +import xbmcgui +from urlresolver import common + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +net = Net() + +class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "sharevid" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + try: + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + dialog = xbmcgui.DialogProgress() + dialog.create('Resolving', 'Resolving sharevid Link...') + dialog.update(0) + + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value + + html = net.http_POST(url, data).content + dialog.update(50) + + r = re.search("file\s*:\s*'(.+?)'", html) + if r: + dialog.update(100) + dialog.close() + return r.group(1) + else: + dialog.close() + raise Exception('could not find video') + + except Exception, e: + common.addon.log('**** sharevid Error occured: %s' % e) + common.addon.show_small_popup('Error', str(e), 5000, '') + return self.unresolvable(code=0, msg='Exception: %s' % e) + + def get_url(self, host, media_id): + return 'http://sharevid.org/%s' % media_id + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) + if r: + return r.groups() + else: + return False + return('host', 'media_id') + + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False + return (re.match('http://(www.)?sharevid.org/[0-9A-Za-z]+', url) or re.match('http://(www.)?sharevid.org/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'sharevid' in host) diff --git a/lib/urlresolver/plugins/slickvid.py b/lib/urlresolver/plugins/slickvid.py new file mode 100644 index 00000000..c151e70c --- /dev/null +++ b/lib/urlresolver/plugins/slickvid.py @@ -0,0 +1,88 @@ +''' +Allmyvideos urlresolver plugin +Copyright (C) 2013 Vinnydude + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re, os +import xbmcgui +from urlresolver import common + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +net = Net() + +class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "slickvid" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + try: + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + dialog = xbmcgui.DialogProgress() + dialog.create('Resolving', 'Resolving slickvid Link...') + dialog.update(0) + + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value + + html = net.http_POST(url, data).content + dialog.update(50) + + r = re.search('file\s*:\s*"(.+?)"', html) + if r: + dialog.update(100) + dialog.close() + return r.group(1) + else: + dialog.close() + raise Exception('could not find video') + + except Exception, e: + common.addon.log('**** slickvid Error occured: %s' % e) + common.addon.show_small_popup('Error', str(e), 5000, '') + return self.unresolvable(code=0, msg='Exception: %s' % e) + + def get_url(self, host, media_id): + return 'http://slickvid.com/%s' % media_id + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) + if r: + return r.groups() + else: + return False + return('host', 'media_id') + + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False + return (re.match('http://(www.)?slickvid.com/[0-9A-Za-z]+', url) or re.match('http://(www.)?slickvid.com/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'slickvid' in host) diff --git a/lib/urlresolver/plugins/trollvid.py b/lib/urlresolver/plugins/trollvid.py new file mode 100644 index 00000000..392f926b --- /dev/null +++ b/lib/urlresolver/plugins/trollvid.py @@ -0,0 +1,80 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re,xbmc + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "trollvid.net" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:sv\d*.)?trollvid.net)/embed.php.file=([0-9a-zA-Z]+)' # http://sv3.trollvid.net/embed.php?file=([0-9a-zA-Z]+)& + + def get_url(self, host, media_id): + return 'http://sv3.trollvid.net/embed.php?file=%s&w=800&h=600&bg=' % (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) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching 1st url %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + + #try: + # data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html); data['usr_login']='' + # for name, value in r: data[name] = value + # data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' + # xbmc.sleep(2000) + # html = self.net.http_POST(post_url, data).content + #except urllib2.URLError, e: + # common.addon.log_error(hostname+': got http error %d fetching 2nd url %s' % (e.code, web_url)) + # return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + + r = re.search('clip\s*:\s*\n*\s*{\s*\n*\s*\n*\s*\n*\s*url\s*:\s*"(http.+?)"', html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + #stream_url = str(r.group(1)) + print stream_url + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable(code=0, msg='no file located') #return False + return stream_url diff --git a/lib/urlresolver/plugins/uploadcrazynet.py b/lib/urlresolver/plugins/uploadcrazynet.py index a012a1f2..0f0de3b9 100644 --- a/lib/urlresolver/plugins/uploadcrazynet.py +++ b/lib/urlresolver/plugins/uploadcrazynet.py @@ -35,11 +35,12 @@ def __init__(self): # http://video.vidcrazy.net/nvs.php?file=tenkai-knights06&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg # http://video.vidcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg # http://embeds.uploadcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/H1dqUbf.jpg - self.pattern = 'http://((?:embeds.)?uploadcrazy.net)/\D+.php\?file=([0-9a-zA-Z\-_]+)[&]*' + self.pattern = 'http://((?:embeds.)?uploadcrazy.net)/(\D+.php\?file=[0-9a-zA-Z\-_]+)[&]*' #self.pattern = 'http://((?:www.)?vidcrazy.net)/embed/(.+?)' def get_url(self, host, media_id): - return 'http://embeds.uploadcrazy.net/nvs.php?file=%s' % (media_id) + return 'http://embeds.uploadcrazy.net/%s' % (media_id) + #return 'http://embeds.uploadcrazy.net/embed.php?file=%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) diff --git a/lib/urlresolver/plugins/vidcrazynet.py b/lib/urlresolver/plugins/vidcrazynet.py index 2a895d82..ea5308ae 100644 --- a/lib/urlresolver/plugins/vidcrazynet.py +++ b/lib/urlresolver/plugins/vidcrazynet.py @@ -32,13 +32,11 @@ def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - # http://video.vidcrazy.net/nvs.php?file=tenkai-knights06&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg - # http://video.vidcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg - self.pattern = 'http://((?:video.)?vidcrazy.net)/\D+.php\?file=([0-9a-zA-Z\-_]+)[&]*' - #self.pattern = 'http://((?:www.)?vidcrazy.net)/embed/(.+?)' + self.pattern = 'http://((?:video.)?vidcrazy.net)/(\D+.php\?file=[0-9a-zA-Z\-_]+)[&]*' def get_url(self, host, media_id): - return 'http://video.vidcrazy.net/nvs.php?file=%s' % (media_id) + return 'http://video.vidcrazy.net/%s' % (media_id) + #return 'http://video.vidcrazy.net/nvs.php?file=%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) diff --git a/lib/urlresolver/plugins/videovalley.py b/lib/urlresolver/plugins/videovalley.py new file mode 100644 index 00000000..12e6886a --- /dev/null +++ b/lib/urlresolver/plugins/videovalley.py @@ -0,0 +1,70 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "vidcrazy.net" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:video.)?videovalley.net)/vidvalley/(\D+.php\?file=[0-9a-zA-Z\-_]+)[&]*' + + def get_url(self, host, media_id): + return 'http://videovalley.net/vidvalley/%s&w=640&h=360' % (media_id) + #return 'http://videovalley.net/vidvalley/ancv.php?file=%s&w=640&h=360' % (media_id) + #return 'http://videovalley.net/vidvalley/nvs.php?file=%s&w=640&h=360' % (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) + post_url = web_url + hostname = self.name + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + #print html + r = re.search("'file'\s*:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable(code=0, msg='no file located') #return False + return stream_url + \ No newline at end of file diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py new file mode 100644 index 00000000..4e17cbdd --- /dev/null +++ b/lib/urlresolver/plugins/vidspot.py @@ -0,0 +1,88 @@ +''' +Allmyvideos urlresolver plugin +Copyright (C) 2013 Vinnydude + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re, os +import xbmcgui +from urlresolver import common + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +net = Net() + +class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "vidspot" + + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + + def get_media_url(self, host, media_id): + try: + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + dialog = xbmcgui.DialogProgress() + dialog.create('Resolving', 'Resolving vidspot Link...') + dialog.update(0) + + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value + + html = net.http_POST(url, data).content + dialog.update(50) + + r = re.search('"sources"\s*:\s*.\n*\s*.\n*\s*"file"\s*:\s*"(.+?)"', html) + if r: + dialog.update(100) + dialog.close() + return r.group(1) + else: + dialog.close() + raise Exception('could not find video') + + except Exception, e: + common.addon.log('**** vidspot Error occured: %s' % e) + common.addon.show_small_popup('Error', str(e), 5000, '') + return self.unresolvable(code=0, msg='Exception: %s' % e) + + def get_url(self, host, media_id): + return 'http://vidspot.net/%s' % media_id + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) + if r: + return r.groups() + else: + return False + return('host', 'media_id') + + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False + return (re.match('http://(www.)?vidspot.net/[0-9A-Za-z]+', url) or re.match('http://(www.)?vidspot.net/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'vidspot' in host) diff --git a/lib/urlresolver/plugins/vidxden.py b/lib/urlresolver/plugins/vidxden.py index 8a8bfea7..aedce391 100644 --- a/lib/urlresolver/plugins/vidxden.py +++ b/lib/urlresolver/plugins/vidxden.py @@ -30,6 +30,9 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + #SET DEFAULT TIMEOUT FOR SLOW SERVERS: socket.setdefaulttimeout(30) @@ -78,6 +81,8 @@ def get_media_url(self, host, media_id): try: resp = self.net.http_GET(web_url) html = resp.content + if "No such file or the file has been removed due to copyright infringement issues." in html: + raise Exception ('File Not Found or removed') try: os.remove(img) except: pass filename=re.compile('').findall(html)[0] diff --git a/lib/urlresolver/plugins/vodlocker.py b/lib/urlresolver/plugins/vodlocker.py new file mode 100644 index 00000000..377fc414 --- /dev/null +++ b/lib/urlresolver/plugins/vodlocker.py @@ -0,0 +1,80 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re,xbmc + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "vodlocker.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?vodlocker.com)/([0-9a-zA-Z]+)*' + + def get_url(self, host, media_id): + return 'http://vodlocker.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 self.name in host + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + post_url = web_url + hostname = self.name + common.addon.log(media_id) + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching 1st url %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + + try: + data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html); data['usr_login']='' + for name, value in r: data[name] = value + data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' + xbmc.sleep(2000) + html = self.net.http_POST(post_url, data).content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching 2nd url %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + + r = re.search('file\s*:\s*"(http://.+?)"', html) + if r: + #stream_url = urllib.unquote_plus(r.group(1)) + stream_url = str(r.group(1)) + print stream_url + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable(code=0, msg='no file located') #return False + return stream_url From 359bb3ac590b899838e8a646a5e94d861d883f62 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 19 Feb 2014 19:53:27 -0600 Subject: [PATCH 0421/1360] AUEngine and Fix for Putlocker/Sockshare --- lib/urlresolver/plugins/auengine.py | 68 +++++++++++++++++++++++++++ lib/urlresolver/plugins/putlocker.py | 70 +++++++++++++++++++++++----- 2 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 lib/urlresolver/plugins/auengine.py diff --git a/lib/urlresolver/plugins/auengine.py b/lib/urlresolver/plugins/auengine.py new file mode 100644 index 00000000..3ba670b9 --- /dev/null +++ b/lib/urlresolver/plugins/auengine.py @@ -0,0 +1,68 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "auengine.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?auengine.com)/embed.php\?file=([0-9a-zA-Z\-_]+)[&]*' + + def get_url(self, host, media_id): + return 'http://www.auengine.com/embed.php?file=%s' % (media_id) #&w=800&h=600 + + 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) + post_url = web_url + hostname = self.name + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + #print html + r = re.search("url\s*:\s*'(.+?)'\s*\n*\s*,\s*\n*\s*autoPlay", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable(code=0, msg='no file located') #return False + return stream_url + \ No newline at end of file diff --git a/lib/urlresolver/plugins/putlocker.py b/lib/urlresolver/plugins/putlocker.py index e411c64f..a553c7a2 100644 --- a/lib/urlresolver/plugins/putlocker.py +++ b/lib/urlresolver/plugins/putlocker.py @@ -35,7 +35,7 @@ class PutlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] - name = "putlocker/sockshare" + name = "putlocker/sockshare/filedrive/firedrive" profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'putlocker.cookies') @@ -50,26 +50,56 @@ def get_media_url(self, host, media_id): self.login() self.net.set_cookies(self.cookie_file) web_url = self.get_url(host, media_id) + if web_url[-1:1]=="#": web_url.replace("#",""); #find session_hash try: html = self.net.http_GET(web_url).content - + if "404: This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": 404: This file might have been moved, replaced or deleted.") #firedrive error + elif ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") #sockshare error #Shortcut for logged in users pattern = 'Download File' link = re.search(pattern, html) if link: common.addon.log('Direct link found: %s' % link.group(1)) - return 'http://www.putlocker.com%s' % link.group(1) + if 'putlocker' in host: + return 'http://www.filedrive.com%s' % link.group(1) + #return 'http://www.putlocker.com%s' % link.group(1) + elif 'filedrive' in host: + return 'http://www.filedrive.com%s' % link.group(1) + elif 'firedrive' in host: + return 'http://www.firedrive.com%s' % link.group(1) - r = re.search('value="([0-9a-f]+?)" name="hash"', html) - if r: - session_hash = r.group(1) + if 'firedrive' in host or 'filedrive' in host or 'putlocker' in host or 'sockshare' in host: + try: + data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); #data['usr_login']='' + for name, value in r: data[name] = value + #data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' + #xbmc.sleep(2000) + html = self.net.http_POST(web_url, data).content + except urllib2.URLError, e: + common.addon.log_error(host+': got http error %d fetching 2nd url %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + r = re.search('', html) + if r: + return urllib.unquote_plus(r.group(1)) + #else: + # common.addon.log_error(host+': stream url not found') + # return self.unresolvable(code=0, msg='no file located') #return False + r = re.search("$.post('(.+?)', function(data) {", html) + if r: + return urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(host+': stream url not found') + return self.unresolvable(code=0, msg='no file located') #return False else: - raise Exception ('putlocker: session hash not found') - - #post session_hash - html = self.net.http_POST(web_url, form_data={'hash': session_hash, + r = re.search('value="([0-9a-f]+?)" name="hash"', html) + if r: + session_hash = r.group(1) + else: + raise Exception ('putlocker: session hash not found') + #post session_hash + html = self.net.http_POST(web_url, form_data={'hash': session_hash, 'confirm': 'Continue as Free User'}).content #find playlist code @@ -91,6 +121,16 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(Avi).content final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + elif 'filedrive' in host: + Avi = "http://filedrive.com/get_file.php?stream=%s&original=1"%playlist_code + html = self.net.http_GET(Avi).content + final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') + return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + elif 'firedrive' in host: + Avi = "http://firedrive.com/get_file.php?stream=%s&original=1"%playlist_code + html = self.net.http_GET(Avi).content + final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') + return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') else: Avi = "http://sockshare.com/get_file.php?stream=%s&original=1"%playlist_code html = self.net.http_GET(Avi).content @@ -126,8 +166,16 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): if 'putlocker' in host: host = 'www.putlocker.com' + host = 'www.firedrive.com' + media_id=media_id.replace("#",""); + elif 'filedrive' in host: + host = 'www.filedrive.com' + elif 'firedrive' in host: + host = 'www.firedrive.com' else: host = 'www.sockshare.com' + host = 'www.firedrive.com' + media_id=media_id.replace("#",""); return 'http://%s/file/%s' % (host, media_id) @@ -140,7 +188,7 @@ def get_host_and_id(self, url): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - return (re.match('http://(www.)?(putlocker|sockshare).com/' + '(file|embed)/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host) + return (re.match('http://(www.)?(putlocker|filedrive|firedrive|sockshare).com/' + '(file|embed)/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host or 'filedrive' in host or 'firedrive' in host) def login_stale(self): url = 'http://www.putlocker.com/cp.php' From 1ba7d3f64aaf5ad4288ca17a43060f1571841ead Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 19 Feb 2014 19:56:04 -0600 Subject: [PATCH 0422/1360] VideoBoxOne --- lib/urlresolver/plugins/videoboxone.py | 69 ++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 lib/urlresolver/plugins/videoboxone.py diff --git a/lib/urlresolver/plugins/videoboxone.py b/lib/urlresolver/plugins/videoboxone.py new file mode 100644 index 00000000..079f6ba4 --- /dev/null +++ b/lib/urlresolver/plugins/videoboxone.py @@ -0,0 +1,69 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib,urllib2 +from urlresolver import common +import re + +class FilenukeResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "videoboxone.com" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?videoboxone.com)/(\D+.php\?file=[0-9a-zA-Z\-_]+)[&]*' + + def get_url(self, host, media_id): + return 'http://videoboxone.com/%s' % (media_id) + #return 'http://videoboxone.com/nvs.php?file=%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 self.name in host + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + post_url = web_url + hostname = self.name + common.addon.log(web_url) + try: + resp = self.net.http_GET(web_url) + html = resp.content + except urllib2.URLError, e: + common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + #print html + r = re.search("'file'\s*:\s*'(.+?)'", html) + if r: + stream_url = urllib.unquote_plus(r.group(1)) + else: + common.addon.log_error(hostname+': stream url not found') + return self.unresolvable(code=0, msg='no file located') #return False + return stream_url + \ No newline at end of file From 5c267b3b273f13aead94ef048300a8b3d28a7d35 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Sat, 22 Feb 2014 13:34:52 -0500 Subject: [PATCH 0423/1360] update changelog --- changelog.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/changelog.txt b/changelog.txt index 5bd8dda8..6d805da5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,20 @@ +[B]Version 1.2.0[/B] +- Added CheeseStreams +- Added Play44 +- Added UploadCrazy +- Added VidCrazy +- Added Video44 +- Added VideoFun +- Added ViUp +- Added VidZur +- Added YourUpload +- Fixed Divxstage +- Fixed Ecostream +- Fixed Movzap +- Fixed NowVideo +- Fixed YouWatch +- Updated Real-Debrid login methods + [B]Version 1.1.2[/B] - Vidxden bugfix From 651e5d7d9030cc09ca745f936e8a2f1979d4cc0e Mon Sep 17 00:00:00 2001 From: Eldorados Date: Mon, 24 Feb 2014 18:22:32 -0500 Subject: [PATCH 0424/1360] Use faster no wait method --- lib/urlresolver/plugins/vidhog.py | 86 ++++++++++++++----------------- 1 file changed, 39 insertions(+), 47 deletions(-) diff --git a/lib/urlresolver/plugins/vidhog.py b/lib/urlresolver/plugins/vidhog.py index e4ef6513..dc108733 100644 --- a/lib/urlresolver/plugins/vidhog.py +++ b/lib/urlresolver/plugins/vidhog.py @@ -20,8 +20,12 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, time +import re, time, urllib2 from urlresolver import common +import xbmcgui + +USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36' +ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' net = Net() @@ -39,57 +43,45 @@ def __init__(self): def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) - html = self.net.http_GET(url).content - check = re.compile('fname').findall(html) - if check: - data = {} - r = re.findall(r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - html = net.http_POST(url, data).content - - else: - data = {} - r = re.findall(r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - - captchaimg = re.search('File Not Found', html): + common.addon.log('***** VidHog - File not found') + raise Exception('File has been deleted') - match = re.search("product_download_url=(.+?)'", html) + filename = re.search('\((.+?)\)

', html).group(1) + extension = re.search('(\.[^\.]*$)', filename).group(1) + guid = re.search('http://[www\.]*vidhog.com/(.+)$', url).group(1) + + vid_embed_url = 'http://vidhog.com/vidembed-%s%s' % (guid, extension) + + request = urllib2.Request(vid_embed_url) + request.add_header('User-Agent', USER_AGENT) + request.add_header('Accept', ACCEPT) + request.add_header('Referer', url) + response = urllib2.urlopen(request) + redirect_url = re.search('(http://.+?)video', response.geturl()).group(1) + download_link = redirect_url + filename + + dialog.update(100) - if not match: - raise Exception('could not find video') - return match.group(1) + return download_link except Exception, e: - common.addon.log('**** Muchshare Error occured: %s' % e) + common.addon.log('**** VidHog Error occured: %s' % e) common.addon.show_small_popup('Error', str(e), 5000, '') return self.unresolvable(code=0, msg='Exception: %s' % e) From ee0d5175011d117fa81c266ef9227b89f3bb2bd5 Mon Sep 17 00:00:00 2001 From: HIGHWAY99 Date: Wed, 26 Feb 2014 20:38:18 -0600 Subject: [PATCH 0425/1360] putlocker and sockshare seperate. went off the seperated version and fixed up a few possible methods for putlocker since they put in a piece of html in the line for firedrive stuff. Things should work again in one of the few methods. --- lib/urlresolver/plugins/putlocker.py | 36 +++-- lib/urlresolver/plugins/sockshare.py | 217 +++++++++++++++++++++++++++ 2 files changed, 238 insertions(+), 15 deletions(-) create mode 100644 lib/urlresolver/plugins/sockshare.py diff --git a/lib/urlresolver/plugins/putlocker.py b/lib/urlresolver/plugins/putlocker.py index a553c7a2..70feae69 100644 --- a/lib/urlresolver/plugins/putlocker.py +++ b/lib/urlresolver/plugins/putlocker.py @@ -35,7 +35,7 @@ class PutlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] - name = "putlocker/sockshare/filedrive/firedrive" + name = "putlocker/filedrive/firedrive" profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'putlocker.cookies') @@ -55,8 +55,8 @@ def get_media_url(self, host, media_id): #find session_hash try: html = self.net.http_GET(web_url).content - if "404: This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": 404: This file might have been moved, replaced or deleted.") #firedrive error - elif ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") #sockshare error + if ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") + elif "404: This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": 404: This file might have been moved, replaced or deleted.") #Shortcut for logged in users pattern = '
Download File' link = re.search(pattern, html) @@ -70,7 +70,7 @@ def get_media_url(self, host, media_id): elif 'firedrive' in host: return 'http://www.firedrive.com%s' % link.group(1) - if 'firedrive' in host or 'filedrive' in host or 'putlocker' in host or 'sockshare' in host: + if 'firedrive' in host or 'filedrive' in host or 'putlocker' in host: try: data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); #data['usr_login']='' for name, value in r: data[name] = value @@ -80,9 +80,20 @@ def get_media_url(self, host, media_id): except urllib2.URLError, e: common.addon.log_error(host+': got http error %d fetching 2nd url %s' % (e.code, web_url)) return self.unresolvable(code=3, msg='Exception: %s' % e) #return False - r = re.search('', html) - if r: - return urllib.unquote_plus(r.group(1)) + if "file: '" in html: + r = re.search("file\s*:\s*'(.+?)'", html) + if r: return urllib.unquote_plus(r.group(1)) + if '" target="_blank" '+"id='top_external_download' title='Download This File'>" in html: + r = re.search('", html) + if r: return urllib.unquote_plus(r.group(1)) + if "id='external_download' title='Download This File'>" in html: + r = re.search('', html) + if r: return urllib.unquote_plus(r.group(1)) + if "", html) + if r: return urllib.unquote_plus(r.group(1)) + #if r: + # return urllib.unquote_plus(r.group(1)) #else: # common.addon.log_error(host+': stream url not found') # return self.unresolvable(code=0, msg='no file located') #return False @@ -131,11 +142,7 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(Avi).content final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - else: - Avi = "http://sockshare.com/get_file.php?stream=%s&original=1"%playlist_code - html = self.net.http_GET(Avi).content - final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') - return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + #Else grab standard flv link else: @@ -173,7 +180,6 @@ def get_url(self, host, media_id): elif 'firedrive' in host: host = 'www.firedrive.com' else: - host = 'www.sockshare.com' host = 'www.firedrive.com' media_id=media_id.replace("#",""); return 'http://%s/file/%s' % (host, media_id) @@ -188,7 +194,7 @@ def get_host_and_id(self, url): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - return (re.match('http://(www.)?(putlocker|filedrive|firedrive|sockshare).com/' + '(file|embed)/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host or 'filedrive' in host or 'firedrive' in host) + return (re.match('http://(www.)?(putlocker|filedrive|firedrive).com/' + '(file|embed)/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host or 'filedrive' in host or 'firedrive' in host) def login_stale(self): url = 'http://www.putlocker.com/cp.php' @@ -269,4 +275,4 @@ def get(self): self.close() return text self.close() - return False + return False \ No newline at end of file diff --git a/lib/urlresolver/plugins/sockshare.py b/lib/urlresolver/plugins/sockshare.py new file mode 100644 index 00000000..c988a818 --- /dev/null +++ b/lib/urlresolver/plugins/sockshare.py @@ -0,0 +1,217 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +import os +import xbmcgui +import xbmc +from t0mm0.common.net import Net +import urllib2 +import urllib +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from threading import Thread +import time + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +class sockshareResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "sockshare" + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, 'sockshare.cookies') + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + if self.get_setting('login') == 'true': + if self.login_stale(): + self.login() + self.net.set_cookies(self.cookie_file) + web_url = self.get_url(host, media_id) + + #find session_hash + try: + html = self.net.http_GET(web_url).content + + #Shortcut for logged in users + pattern = 'Download File' + link = re.search(pattern, html) + if link: + common.addon.log('Direct link found: %s' % link.group(1)) + return 'http://www.sockshare.com%s' % link.group(1) + + r = re.search('value="([0-9a-f]+?)" name="hash"', html) + if r: + session_hash = r.group(1) + else: + raise Exception ('sockshare: session hash not found') + + #post session_hash + html = self.net.http_POST(web_url, form_data={'hash': session_hash, + 'confirm': 'Continue as Free User'}).content + + #find playlist code + r = re.search('\?stream=(.+?)\'', html) + if r: + playlist_code = r.group(1) + else: + r = re.search('key=(.+?)&',html) + playlist_code = r.group(1) + + #find download link + q = self.get_setting('quality') + + #Try to grab highest quality link available + if q == '1': + #download & return link. + if 'sockshare' in host: + Avi = "http://sockshare.com/get_file.php?stream=%s&original=1"%playlist_code + html = self.net.http_GET(Avi).content + final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') + return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + + #Else grab standard flv link + else: + xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) + xml_url += playlist_code + html = self.net.http_GET(xml_url).content + + r = re.search('url="(.+?)"', html) + if r: + flv_url = r.group(1) + else: + raise Exception ('sockshare: stream url not found') + + return "%s|User-Agent=%s"%(flv_url.replace('&','&'),'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + + except urllib2.URLError, e: + common.addon.log_error('sockshare: got http error %d fetching %s' % + (e.code, web_url)) + common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) + return self.unresolvable(code=3, msg=e) + + except Exception, e: + common.addon.log_error('**** sockshare Error occured: %s' % e) + common.addon.show_small_popup(title='[B][COLOR white]PUTLOCKER[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) + return self.unresolvable(code=0, msg=e) + + + def get_url(self, host, media_id): + if 'sockshare' in host: + host = 'www.sockshare.com' + return 'http://%s/file/%s' % (host, media_id) + + + def get_host_and_id(self, url): + r = re.search('//(.+?)/(?:file|embed)/([0-9A-Z]+)', 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('http://(www.)?(sockshare).com/' + '(file|embed)/[0-9A-Z]+', url) or 'sockshare' in host) + + def login_stale(self): + url = 'http://www.sockshare.com/cp.php' + if not os.path.exists(self.cookie_file): + return True + self.net.set_cookies(self.cookie_file) + source = self.net.http_GET(url).content + if re.search('(?:\( Pro \)|\( Free \))', source): + common.addon.log('Putlocker account appears to be logged in.') + return False + else: + return True + + #SiteAuth methods + def login(self): + if self.login_stale(): + print 'Need to login since session is invalid' + url = 'http://www.sockshare.com/authenticate.php?login' + source = self.net.http_GET(url).content + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + captcha_img = re.search('CAPTCHA.+?
', source, re.DOTALL).group(1) + captcha_img = 'http://www.sockshare.com%s' %re.sub('&','&',captcha_img) + local_captcha = os.path.join(common.profile_path, "captcha.img" ) + localFile = open(local_captcha, "wb") + localFile.write(self.net.http_GET(captcha_img).content) + localFile.close() + solver = InputWindow(captcha=local_captcha) + solution = solver.get() + if solution: + common.addon.log('Solution provided: %s' %solution) + data = {'user':self.get_setting('username'), 'pass':self.get_setting('password'), 'captcha_code':solution, 'remember':1, 'login_submit':'Login'} + response = self.net.http_POST(url, form_data=data) + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + print response.get_url() + else: + common.addon.log('Dialog was canceled') + return False + + + if re.search('OK', source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + xbmc.executebuiltin("Notification(' sockshare Pro ', ' Login successful')") + return True + else: return False + else: return True + + #PluginSettings methods + def get_settings_xml(self): + xml = PluginSettings.get_settings_xml(self) + xml += ' Date: Wed, 26 Feb 2014 21:12:41 -0600 Subject: [PATCH 0426/1360] Sharesix used the ip address from the image url as a temp fix. --- lib/urlresolver/plugins/sharesix.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/sharesix.py b/lib/urlresolver/plugins/sharesix.py index 79314c16..bbed74cc 100644 --- a/lib/urlresolver/plugins/sharesix.py +++ b/lib/urlresolver/plugins/sharesix.py @@ -47,17 +47,29 @@ def get_media_url(self, host, media_id): r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) for name, value in r: data[name] = value - data["method_free"] = "Free" + #data[u"method_premium"] = "Premium"; + data[u"method_free"] = "Free"; + data[u"op"] = "download1"; data[u"referer"] = ""; data[u"usr_login"] = ""; html = self.net.http_POST(web_url, data).content + Key2 = re.compile('\|\|.+?video\|(.+?)\|file\|').findall(html)[0] + Key1 = re.compile('" target=_blank> 0) and (len(Key2) > 0): + stream_url=Key1+'d/'+Key2+'/video.flv' + return stream_url + if 'file you were looking for could not be found' in html: + raise Exception ('File Not Found or removed') + # To build the streamable link, we need # # the IPv4 addr (first 4 content below) # # the hash of the file metadata = re.compile('\|\|?(\d+)\|\|?(\d+)\|\|?(\d+)\|\|?(\d+)\|.+?video\|(.+?)\|\|?file').findall(html) - if (len(metadata) > 0): metadata = metadata[0] stream_url="http://"+metadata[3]+"."+metadata[2]+"."+metadata[1]+"."+metadata[0]+"/d/"+ metadata[4]+"/video.flv" + ## + ## + ## http://[IP.IP.IP.IP]/d/[HASH]/video.flv?start=0 return stream_url if 'file you were looking for could not be found' in html: From f10b2d6b1a74ef680ec178c09cc908f58e406b04 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 28 Feb 2014 18:01:29 -0500 Subject: [PATCH 0427/1360] added beststreams resolver --- lib/urlresolver/plugins/bestreams.py | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 lib/urlresolver/plugins/bestreams.py diff --git a/lib/urlresolver/plugins/bestreams.py b/lib/urlresolver/plugins/bestreams.py new file mode 100644 index 00000000..4b1a4acd --- /dev/null +++ b/lib/urlresolver/plugins/bestreams.py @@ -0,0 +1,91 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2014 tknorris + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from urlresolver import common +import urllib2 +from time import sleep +import re +import os + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +class BestreamsResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "bestreams" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + try: + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + #print html.encode('ascii','ignore') + headers = { + 'Referer': web_url + } + + data = {} + r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) + for name, value in r: data[name] = value + data.update({'referer': web_url}) + data.update({'imhuman': 'Proceed to video'}) + #print data + #sleep(2) # POST seems to fail is submitted too soon after GET. Page Timeout? + + html = self.net.http_POST(web_url, data, headers=headers).content + #print html.encode('ascii','ignore') + + r = re.search('file\s*:\s*"(http://.+?)"', html) + if r: + return r.group(1) + else: + raise Exception("File Link Not Found") + + except urllib2.URLError, e: + common.addon.log_error('bestreams: got http error %d fetching %s' % + (e.code, web_url)) + common.addon.show_small_popup('Error','beststreams: HTTP error: '+str(e), 5000, error_logo) + return self.unresolvable(code=3, msg=e) + + except Exception, e: + common.addon.log_error('bestreams: general error occured: %s' % e) + common.addon.show_small_popup(title='[B][COLOR white]BESTREAMS[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) + return self.unresolvable(code=0, msg=e) + + return False + + def get_url(self, host, media_id): + return 'http://bestreams.net/%s' % media_id + + def get_host_and_id(self, url): + r = re.search('//(.+?)/([A-Za-z0-9]+)',url) + if r: + return r.groups() + else: + return False + + def valid_url(self, url, host): + return re.match('http://(www.)?bestreams.net/[A-Za-z0-9]+',url) or "bestreams.net" in host + From a84b2a824222251438695ec41bb50c9eb79323e2 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 28 Feb 2014 21:21:12 -0500 Subject: [PATCH 0428/1360] Uncomment sleep to prevent POST returning same page --- lib/urlresolver/plugins/bestreams.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/bestreams.py b/lib/urlresolver/plugins/bestreams.py index 4b1a4acd..c6fc6650 100644 --- a/lib/urlresolver/plugins/bestreams.py +++ b/lib/urlresolver/plugins/bestreams.py @@ -52,7 +52,7 @@ def get_media_url(self, host, media_id): data.update({'referer': web_url}) data.update({'imhuman': 'Proceed to video'}) #print data - #sleep(2) # POST seems to fail is submitted too soon after GET. Page Timeout? + sleep(2) # POST seems to fail is submitted too soon after GET. Page Timeout? html = self.net.http_POST(web_url, data, headers=headers).content #print html.encode('ascii','ignore') From 913dcb1763976592af98affc48b5030ca81c8beb Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 28 Feb 2014 21:25:18 -0500 Subject: [PATCH 0429/1360] added settings to gitignore --- resources/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 resources/.gitignore diff --git a/resources/.gitignore b/resources/.gitignore new file mode 100644 index 00000000..e736c215 --- /dev/null +++ b/resources/.gitignore @@ -0,0 +1 @@ +/settings.xml From 14afbeeb12d326306f908e59ebe715682c12d680 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Sat, 1 Mar 2014 09:24:13 -0500 Subject: [PATCH 0430/1360] Updated hugefiles --- lib/urlresolver/plugins/hugefiles.py | 63 ++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/lib/urlresolver/plugins/hugefiles.py b/lib/urlresolver/plugins/hugefiles.py index 3b3928a0..b9de5bb0 100644 --- a/lib/urlresolver/plugins/hugefiles.py +++ b/lib/urlresolver/plugins/hugefiles.py @@ -24,7 +24,6 @@ from urlresolver import common from lib import jsunpack -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') net = Net() @@ -46,18 +45,55 @@ def get_media_url(self, host, media_id): r = re.findall('File Not Found',html) if r: raise Exception ('File Not Found or removed') + + #Show dialog box so user knows something is happening dialog = xbmcgui.DialogProgress() - dialog.create('Resolving', 'Resolving Hugefiles Link...') + dialog.create('Resolving', 'Resolving HugeFiles Link...') dialog.update(0) + + common.addon.log('HugeFiles - Requesting GET URL: %s' % url) + html = net.http_GET(url).content + + dialog.update(50) + + #Check page for any error msgs + if re.search('File Not Found', html): + common.addon.log('***** HugeFiles - File Not Found') + raise Exception('File Not Found') + #Set POST data values data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - data.update({'method_free':'Free Download'}) + r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) + + if r: + for name, value in r: + data[name] = value + else: + common.addon.log('***** HugeFiles - Cannot find data values') + raise Exception('Unable to resolve HugeFiles Link') + + data['method_free'] = 'Free Download' + file_name = data['fname'] + + common.addon.log('HugeFiles - Requesting POST URL: %s DATA: %s' % (url, data)) html = net.http_POST(url, data).content + + #Set POST data values + data = {} + r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) + + if r: + for name, value in r: + data[name] = value + else: + common.addon.log('***** HugeFiles - Cannot find data values') + raise Exception('Unable to resolve HugeFiles Link') - dialog.update(50) + embed = re.search('

Embed code

.+?',html,re.DOTALL) + html = self.net.http_GET(r.group(1)).content r = re.search("
.*?",html,re.DOTALL) if not r: raise Exception ('Unable to resolve Mightyupload link. Player config not found.') From b903b7b6e5684069a59bfbf07ace277c40b73b84 Mon Sep 17 00:00:00 2001 From: Nexis81 Date: Mon, 20 Oct 2014 08:44:04 -0700 Subject: [PATCH 0522/1360] Update mightyupload.py --- lib/urlresolver/plugins/mightyupload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/mightyupload.py b/lib/urlresolver/plugins/mightyupload.py index e48a44b7..b82fa8a3 100644 --- a/lib/urlresolver/plugins/mightyupload.py +++ b/lib/urlresolver/plugins/mightyupload.py @@ -46,7 +46,7 @@ def get_media_url(self, host, media_id): for i in re.finditer('',html,re.DOTALL) + r = re.search('',html,re.DOTALL) html = self.net.http_GET(r.group(1)).content r = re.search("
.*?",html,re.DOTALL) if not r: From d2ffe8afca45c840fdd5d8c45b90b302598175dc Mon Sep 17 00:00:00 2001 From: Eldorados Date: Wed, 22 Oct 2014 10:20:17 -0400 Subject: [PATCH 0523/1360] Version bump 2.5.0 --- addon.xml | 2 +- changelog.txt | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 1f37d7ff..8e37f5a2 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/changelog.txt b/changelog.txt index f97b9eae..0761712b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,17 @@ +[B]Version 2.5.0[/B] +- Added Teramixer +- Added Exashare +- Fixed 180Upload +- Fixed BillionUploads +- Fixed HugeFiles +- Fixed VidPlay +- Fixed MovDivx +- Fixed ShareSix +- Fixed Vodlocker +- Fixed AllMyVideos +- Fixed Played.To +- Small fixes to Sockshare captcha + [B]Version 2.4.0[/B] - Reverted back to using t0mm0.common as addon.common is creating naming issues From 841a999c6c04019cd71e3836d5886cc66596aa16 Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Thu, 6 Nov 2014 13:53:58 +0100 Subject: [PATCH 0524/1360] Update Purevid resolver : Add a needLogin() method to not log on every time and so to prevent temporary lock account. --- lib/urlresolver/plugins/purevid.py | 45 ++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/lib/urlresolver/plugins/purevid.py b/lib/urlresolver/plugins/purevid.py index 4d2614c3..19da0a8b 100644 --- a/lib/urlresolver/plugins/purevid.py +++ b/lib/urlresolver/plugins/purevid.py @@ -22,17 +22,15 @@ import re import urllib, urllib2 import ast -import xbmc -import time +import xbmc,xbmcplugin,xbmcgui,xbmcaddon,time,datetime +import cookielib +import json +from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import SiteAuth from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -import xbmc,xbmcplugin,xbmcgui,xbmcaddon, datetime -import cookielib -from t0mm0.common.net import Net -import json #SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') @@ -97,17 +95,34 @@ def valid_url(self, url, host): return 'purevid' in url #SiteAuth methods - def login(self): - common.addon.log('login to purevid') - url = 'http://www.purevid.com/?m=login' - data = {'username' : self.get_setting('username'), 'password' : self.get_setting('password')} - source = self.net.http_POST(url,data).content - if re.search(self.get_setting('username'), source): - self.net.save_cookies(self.cookie_file) - self.net.set_cookies(self.cookie_file) + def needLogin(self): + url = 'http://www.purevid.com/?m=main' + if not os.path.exists(self.cookie_file): return True - else: + self.net.set_cookies(self.cookie_file) + source = self.net.http_GET(url).content + common.addon.log_debug(source.encode('utf-8')) + if re.search("""Welcome .*""", source) : + common.addon.log_debug('needLogin returning False') return False + else : + common.addon.log_debug('needLogin returning True') + return True + + def login(self): + if self.needLogin() : + common.addon.log('login to purevid') + url = 'http://www.purevid.com/?m=login' + data = {'username' : self.get_setting('username'), 'password' : self.get_setting('password')} + source = self.net.http_POST(url,data).content + if re.search(self.get_setting('username'), source): + self.net.save_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) + return True + else: + return False + else : + return True #PluginSettings methods def get_settings_xml(self): From e4a3a1fdd5552e9c396331d892bf22aa41233b36 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Thu, 6 Nov 2014 14:06:57 -0500 Subject: [PATCH 0525/1360] Add import of simplejson module --- addon.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addon.xml b/addon.xml index 8e37f5a2..1843ec1a 100644 --- a/addon.xml +++ b/addon.xml @@ -6,6 +6,7 @@ + From c100b5369bb46fccf9a117e76d4959f818f0badd Mon Sep 17 00:00:00 2001 From: Eldorados Date: Thu, 6 Nov 2014 15:43:42 -0500 Subject: [PATCH 0526/1360] Update version of simplejson --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 1843ec1a..21929cf8 100644 --- a/addon.xml +++ b/addon.xml @@ -6,7 +6,7 @@ - + From b48d76767e4b6793ee75d965d0f3698bef610d61 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Fri, 7 Nov 2014 00:19:47 -0500 Subject: [PATCH 0527/1360] Allow host validation to work with universal resolvers --- lib/urlresolver/plugins/realdebrid.py | 33 ++++++++++++++++++++------- lib/urlresolver/types.py | 6 +++-- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index f7233b24..a42586db 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -25,7 +25,7 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -import xbmc,xbmcplugin,xbmcgui,xbmcaddon, datetime +import xbmc,xbmcplugin,xbmcgui,xbmcaddon from t0mm0.common.net import Net import simplejson as json @@ -44,6 +44,7 @@ def __init__(self): self.priority = int(p) self.net = Net() self.hosters = None + self.hosts = None try: os.makedirs(os.path.dirname(self.cookie_file)) except OSError: @@ -81,7 +82,7 @@ def get_media_url(self, host, media_id): else : return self.unresolvable(0,'No generated_link and no main_link') except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % (str(e), web_url)) + common.addon.log_error(self.name + ': got http error %d fetching %s' % (str(e), url)) common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) return self.unresolvable(3,str(e)) except Exception, e: @@ -107,22 +108,38 @@ def get_all_hosters(self): common.addon.log_debug( 'RealDebrid hosters : %s' %self.hosters) return self.hosters + def get_hosts(self): + if self.hosts is None: + try: + url = 'https://real-debrid.com/api/hosters.php' + response = self.net.http_GET(url).content + response = response[1:-1] + self.hosts = response.split('","') + except: + self.hosts = [] + common.addon.log_debug( 'RealDebrid hosts : %s' %self.hosts) + def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False if self.get_setting('login') == 'false': return False common.addon.log_debug('in valid_url %s : %s' % (url, host)) - self.get_all_hosters() - for host in self.hosters : - #common.addon.log_debug('RealDebrid checking host : %s' %str(host)) - if re.search(host,url): - common.addon.log_debug('RealDebrid Match found') + if url: + self.get_all_hosters() + for host in self.hosters : + #common.addon.log_debug('RealDebrid checking host : %s' %str(host)) + if re.search(host,url): + common.addon.log_debug('RealDebrid Match found') + return True + elif host: + self.get_hosts() + if host in self.hosts or any(item in host for item in self.hosts): return True return False def checkLogin(self): url = 'https://real-debrid.com/api/account.php' if not os.path.exists(self.cookie_file): - return True + return True self.net.set_cookies(self.cookie_file) source = self.net.http_GET(url).content common.addon.log_debug(source) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 33464dfa..0a07f1a0 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -83,8 +83,6 @@ def __init__(self, url='', host='', media_id='', title=''): self._host, self._media_id = result else: self._resolvers = [] - else: - self._resolvers = [] else: self._url = self._resolvers[0].get_url(host, media_id) @@ -133,6 +131,10 @@ def resolve(self): if this was not possible. ''' if self._resolvers: + # universal resolvers aren't resolvable without a url + if len(self._resolvers)==1 and self._resolvers[0].isUniversal() and not self._url: + return False + resolver = self._resolvers[0] common.addon.log_debug('resolving using %s plugin' % resolver.name) if SiteAuth in resolver.implements: From a439f491d66b0cc82c328cf6a58f5d1f4f3178b3 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Mon, 10 Nov 2014 17:26:11 -0500 Subject: [PATCH 0528/1360] New embed player regex Added missing re-grab of data values if captcha challenge is needed --- lib/urlresolver/plugins/180upload.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/180upload.py b/lib/urlresolver/plugins/180upload.py index ddde1d51..10522a84 100644 --- a/lib/urlresolver/plugins/180upload.py +++ b/lib/urlresolver/plugins/180upload.py @@ -73,13 +73,28 @@ def get_media_url(self, host, media_id): packed = re.search('id="player_code".*?(eval.*?\)\)\))', html,re.DOTALL) if packed: js = jsunpack.unpack(packed.group(1)) - link = re.search('name="src"\s*value="([^"]+)', js.replace('\\','')) + link = re.search('name="src"*0="([^"]+)"/>', js.replace('\\','')) if link: common.addon.log('180Upload Link Found: %s' % link.group(1)) return link.group(1) + else: + link = re.search("'file','(.+?)'", js.replace('\\','')) + if link: + common.addon.log('180Upload Link Found: %s' % link.group(1)) + return link.group(1) web_url = self.get_url(host, media_id) html = net.http_GET(web_url).content + + #Re-grab data values + data = {} + r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) + + if r: + for name, value in r: + data[name] = value + else: + raise Exception('Unable to resolve 180Upload Link') #Check for SolveMedia Captcha image solvemedia = re.search('',html,re.DOTALL) - html = self.net.http_GET(r.group(1)).content + if r: + html = self.net.http_GET(r.group(1)).content r = re.search("
.*?",html,re.DOTALL) if not r: raise Exception ('Unable to resolve Mightyupload link. Player config not found.') @@ -65,12 +66,9 @@ def get_media_url(self, host, media_id): except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** Mightyupload Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]MIGHTYUPLOAD[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' - % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg='Exception: %s' % e) def get_url(self, host, media_id): From 96b72324906a4d63201b5067ad2bbe1103fc9db4 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Fri, 5 Dec 2014 14:19:39 -0500 Subject: [PATCH 0546/1360] New realvid resolver --- lib/urlresolver/plugins/realvid.py | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 lib/urlresolver/plugins/realvid.py diff --git a/lib/urlresolver/plugins/realvid.py b/lib/urlresolver/plugins/realvid.py new file mode 100644 index 00000000..09354cb1 --- /dev/null +++ b/lib/urlresolver/plugins/realvid.py @@ -0,0 +1,88 @@ +""" +realvid urlresolver plugin +Copyright (C) 2014 Lynx187 +Modded by Bit - October 2014 +Exactly the same as Streamcloud resolver by Lynx187 but names changed to allow +for Realvid.net so no real coding changes except to change the +download1 to download2 in streamcloud to +"Proceed to video" to "Proceed+to+video" in realvid + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2, os +from urlresolver import common +from lib import jsunpack +import xbmcgui +import re +import time + +class RealvidResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "Realvid" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + try: + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + dialog = xbmcgui.Dialog() + + if re.search('>(File Not Found)<',html): + raise Exception ('File Not Found or removed') + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2).replace("Proceed to video","Proceed+to+video") + + html = self.net.http_POST(post_url, form_data=form_values).content + + r = re.search('file: "(.+?)",', html) + if r: + return r.group(1) + else: + raise Exception ('File Not Found or removed') + except urllib2.URLError, e: + common.addon.log_error(self.name + ': got http error %d fetching %s' % + (e.code, web_url)) + return self.unresolvable(code=3, msg=e) + except Exception, e: + common.addon.log('**** Realvid Error occured: %s' % e) + return self.unresolvable(code=0, msg=e) + + def get_url(self, host, media_id): + return 'http://realvid.net/%s' % (media_id) + + def get_host_and_id(self, url): + r = re.search('http://(?:www.)?(.+?)/([0-9A-Za-z]+)', 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('http://(www.)?realvid.net/[0-9A-Za-z]+', url) or 'realvid' in host From f23d9c72db5ae250ee679f263a9b6018549d229e Mon Sep 17 00:00:00 2001 From: Irfan Charania Date: Fri, 5 Dec 2014 16:14:52 -0800 Subject: [PATCH 0547/1360] Update Realvid/Vodlocker Resolver [vodlocker]: remove print statement [realvid]: use embedded iframe link instead of doing HTTP post (same as vodlocker) --- lib/urlresolver/plugins/realvid.py | 83 ++++++++++++---------------- lib/urlresolver/plugins/vodlocker.py | 2 - 2 files changed, 34 insertions(+), 51 deletions(-) diff --git a/lib/urlresolver/plugins/realvid.py b/lib/urlresolver/plugins/realvid.py index 09354cb1..f58a44bb 100644 --- a/lib/urlresolver/plugins/realvid.py +++ b/lib/urlresolver/plugins/realvid.py @@ -1,11 +1,5 @@ """ realvid urlresolver plugin -Copyright (C) 2014 Lynx187 -Modded by Bit - October 2014 -Exactly the same as Streamcloud resolver by Lynx187 but names changed to allow -for Realvid.net so no real coding changes except to change the -download1 to download2 in streamcloud to -"Proceed to video" to "Proceed+to+video" in realvid This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,16 +15,17 @@ along with this program. If not, see . """ +import os +import xbmc from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, os -from urlresolver import common -from lib import jsunpack -import xbmcgui import re -import time +import urllib2 +from urlresolver import common + +logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class RealvidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -40,49 +35,39 @@ def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() + self.pattern = 'http://((?:www.)?realvid.net)/(?:embed-)?([0-9a-zA-Z]+)(?:-\d+x\d+.html)?' + + def get_url(self,host,media_id): + return 'http://realvid.net/embed-%s-640x400.html' % (media_id) - def get_media_url(self, host, media_id): - web_url = self.get_url(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): try: - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() - dialog = xbmcgui.Dialog() - - if re.search('>(File Not Found)<',html): - raise Exception ('File Not Found or removed') - - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2).replace("Proceed to video","Proceed+to+video") + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + + if link.find('404 Not Found') >= 0: + err_title = 'Content not available.' + err_message = 'The requested video was not found.' + common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + return self.unresolvable(1, err_message) - html = self.net.http_POST(post_url, form_data=form_values).content + video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) - r = re.search('file: "(.+?)",', html) - if r: - return r.group(1) + if len(video_link) > 0: + return video_link else: - raise Exception ('File Not Found or removed') + return self.unresolvable(0, 'No playable video found.') except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) + return self.unresolvable(3, str(e)) except Exception, e: - common.addon.log('**** Realvid Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) - - def get_url(self, host, media_id): - return 'http://realvid.net/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search('http://(?:www.)?(.+?)/([0-9A-Za-z]+)', 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('http://(www.)?realvid.net/[0-9A-Za-z]+', url) or 'realvid' in host + return self.unresolvable(0, str(e)) diff --git a/lib/urlresolver/plugins/vodlocker.py b/lib/urlresolver/plugins/vodlocker.py index c67c565a..8cdf8563 100644 --- a/lib/urlresolver/plugins/vodlocker.py +++ b/lib/urlresolver/plugins/vodlocker.py @@ -56,8 +56,6 @@ def get_media_url(self,host,media_id): link = self.net.http_GET(web_url).content if link.find('404 Not Found') >= 0: - print "shouldn't get here" - err_title = 'Content not available.' err_message = 'The requested video was not found.' common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) From 4fe6550e4dedaa83966ae4d96f4da17f15048a7d Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Fri, 5 Dec 2014 23:53:14 -0500 Subject: [PATCH 0548/1360] Add urlopen() check to resolve() --- lib/urlresolver/types.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 0a07f1a0..7a3e825f 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -15,6 +15,8 @@ # along with this program. If not, see . import urlresolver +import urllib2 +import urlparse from urlresolver import common from plugnplay.interfaces import UrlResolver from plugnplay.interfaces import SiteAuth @@ -85,7 +87,6 @@ def __init__(self, url='', host='', media_id='', title=''): self._resolvers = [] else: self._url = self._resolvers[0].get_url(host, media_id) - if title: self.title = title else: @@ -140,9 +141,12 @@ def resolve(self): if SiteAuth in resolver.implements: common.addon.log_debug('logging in') resolver.login() - return resolver.get_media_url(self._host, self._media_id) - else: - return False + + stream_url = resolver.get_media_url(self._host, self._media_id) + if stream_url and self.__test_stream(stream_url): + return stream_url + + return False def valid_url(self): ''' @@ -163,6 +167,30 @@ def valid_url(self): return True return False + def __test_stream(self, stream_url): + ''' + Returns True if the stream_url gets a non-failure http status (i.e. <400) back from the server + otherwise return False + + Intended to catch stream urls returned by resolvers that would fail to playback + ''' + # parse_qsl doesn't work because it splits elements by ';' which can be in a non-quoted UA + try: headers = dict([item.split('=') for item in (stream_url.split('|')[1]).split('&')]) + except: headers = {} + common.addon.log_debug('Setting Headers on UrlOpen: %s' % (headers)) + + request = urllib2.Request(stream_url.split('|')[0], headers=headers) + + # set urlopen timeout to 2 seconds + try: http_code = urllib2.urlopen(request, timeout=2).getcode() + except: http_code = 404 # not sure how I feel about considering all urlopen exceptions a http 404 + + # added this log line for now so that we can catch any logs on streams that are rejected due to test_stream failures + # we can remove it once we are sure this works reliably + if int(http_code)>=400: common.addon.log('Stream UrlOpen Failed: Url: %s HTTP Code: %s' % (stream_url, http_code)) + + return int(http_code) < 400 + def _find_resolvers(self): imps = [] for imp in UrlResolver.implementors(): From 499569420940ad0bfa6d9ce156bdf7108a8ca0cc Mon Sep 17 00:00:00 2001 From: Eldorados Date: Tue, 9 Dec 2014 10:09:18 -0500 Subject: [PATCH 0549/1360] URLResolver 2.6.0 --- addon.xml | 8 ++++---- changelog.txt | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/addon.xml b/addon.xml index 21929cf8..d0629698 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ @@ -12,7 +12,7 @@ all - Resolve common video host URL's to be playable in XBMC. - Resolve common video host URL's to be playable in XBMC, simplify addon development of video plugins requiring multi video hosts. + Resolve common video host URL's to be playable in XBMC/Kodi. + Resolve common video host URL's to be playable in XBMC/Kodi, simplify addon development of video plugins requiring multi video hosts. diff --git a/changelog.txt b/changelog.txt index 0761712b..e32242af 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,19 @@ +[B]Version 2.6.0[/B] +- Code Base Changes: + - Allow host validation to work with universal resolvers +- Resolvers Added: + - Realvid + - Letwatch + - Speedvideo + - Videohut +- Resolvers Fixed/Updated: + - Vidbull + - VeeHD + - VODLocker (speed improvement) + - MightyUpload + - Exashare + - Tunepk + [B]Version 2.5.0[/B] - Added Teramixer - Added Exashare From ba13b1453772a5b457a6abf01048ec526c55852e Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Wed, 10 Dec 2014 04:41:39 -0500 Subject: [PATCH 0550/1360] adjust captcha image, improve captcha library to not require image filename; remove pop-ups from editted resolvers --- lib/urlresolver/plugins/180upload.py | 6 +-- lib/urlresolver/plugins/clicktoview.py | 8 +-- lib/urlresolver/plugins/hostingcup.py | 8 ++- lib/urlresolver/plugins/hugefiles.py | 14 +---- lib/urlresolver/plugins/jumbofiles.py | 7 --- lib/urlresolver/plugins/lib/captcha_lib.py | 17 ++++--- lib/urlresolver/plugins/megarelease.py | 12 +---- lib/urlresolver/plugins/ovfile.py | 10 +--- lib/urlresolver/plugins/vidpe.py | 12 ++--- lib/urlresolver/plugins/vidplay.py | 16 ++---- lib/urlresolver/plugins/vidxden.py | 59 ++-------------------- 11 files changed, 34 insertions(+), 135 deletions(-) diff --git a/lib/urlresolver/plugins/180upload.py b/lib/urlresolver/plugins/180upload.py index 10522a84..cbae0a97 100644 --- a/lib/urlresolver/plugins/180upload.py +++ b/lib/urlresolver/plugins/180upload.py @@ -29,13 +29,10 @@ #SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') -datapath = common.profile_path class OneeightyuploadResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "180upload" - - def __init__(self): p = self.get_setting('priority') or 100 @@ -47,7 +44,6 @@ def get_media_url(self, host, media_id): common.addon.log('180upload: in get_media_url %s %s' % (host, media_id)) web_url = 'http://180upload.com/embed-%s.html' % media_id try: - puzzle_img = os.path.join(datapath, "180_puzzle.png") common.addon.log('180Upload - Requesting GET URL: %s' % web_url) html = net.http_GET(web_url).content @@ -101,7 +97,7 @@ def get_media_url(self, host, media_id): recaptcha = re.search('' - r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) - if r: - sJavascript = r.group() - sUnpacked = jsunpack.unpack(sJavascript) - stream_url = re.search('[^\w\.]file[\"\']?\s*[:,]\s*[\"\']([^\"\']+)', sUnpacked) - if stream_url: - if( re.match('http://.*',stream_url.group(1))): - return stream_url.group(1) - elif (re.match('[0-9a-f]+',stream_url.group(1))): - return decryptHex(stream_url.group(1)) - else: - return stream_url.group(1) - raise Exception ('File Not Found or removed') - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) + headers = { + 'User-Agent': USER_AGENT + } + + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url, headers=headers).content + match = re.search(' Date: Mon, 15 Dec 2014 14:18:28 -0500 Subject: [PATCH 0555/1360] throw exception when no login is provided --- lib/urlresolver/plugins/veeHD.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py index e1f5a5e8..6b2a711e 100644 --- a/lib/urlresolver/plugins/veeHD.py +++ b/lib/urlresolver/plugins/veeHD.py @@ -43,8 +43,11 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) try: + if not self.get_setting('login')=='true' or not (self.get_setting('username') and self.get_setting('password')): + raise Exception('VeeHD requires a username & password') + + web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content #print html.encode('ascii', 'ignore') @@ -63,7 +66,7 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(player_url).content #print html.encode('ascii', 'ignore') - patterns = ['"video/divx" src="([^"]+)', '"url"\s*:\s*"([^"]+)', 'href="([^"]+(?:mp4|avi))'] + patterns = ['"video/divx"\s+src="([^"]+)', '"url"\s*:\s*"([^"]+)', 'href="([^"]+(?:mp4|avi))'] for pattern in patterns: r = re.search(pattern, html) if r: @@ -71,7 +74,7 @@ def get_media_url(self, host, media_id): #print 'pattern: %s matched in url: %s result: %s' % (pattern, player_url, stream_url) return stream_url - raise Exception ('File Not Found or removed') + raise Exception ('File Not Found or Removed') except Exception, e: common.addon.log('**** VeeHD Error occured: %s' % e) return self.unresolvable(code=0, msg='Exception: %s' % e) From a770948017957d96d9b30d40d46f088661d66249 Mon Sep 17 00:00:00 2001 From: alibbaba Date: Mon, 22 Dec 2014 18:18:18 -0500 Subject: [PATCH 0556/1360] Added streamin.to http://streamin.to/20xk6r5vpkch streamin.to resolved to rtmp but urlresolver check only http resulting make it 404 error. There should be an exception for rtmp --- lib/urlresolver/plugins/streaminto.py | 89 +++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 lib/urlresolver/plugins/streaminto.py diff --git a/lib/urlresolver/plugins/streaminto.py b/lib/urlresolver/plugins/streaminto.py new file mode 100644 index 00000000..28f01f3e --- /dev/null +++ b/lib/urlresolver/plugins/streaminto.py @@ -0,0 +1,89 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2, re, os,xbmc +from urlresolver import common + +#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + + +class streamintoResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "streaminto" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + #e.g. http://streamin.to/20xk6r5vpkch + self.pattern = 'http://((?:www.)?streamin.to)/(.*)' + + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + try: + resp = self.net.http_GET(web_url) + + html = resp.content + post_url = web_url #resp.get_url() + + # get post vars + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + xbmc.sleep(5000) + html = self.net.http_POST(post_url, form_data=form_values).content + + # get stream url + pattern = 'streamer:\s*"([^"]+)",' #streamer: " + file = 'file:\s*"([^"]+)",' #streamer: " + r = re.search(pattern, html) + rr = re.search(file, html) + if r: + return r.group(1).replace(':1935','') + ' swfUrl=http://streamin.to/player/player.swf live=true swfVfy=1 playpath=' + rr.group(1).replace('.flv','') + + raise Exception ('File Not Found or removed') + except urllib2.URLError, e: + common.addon.log_error(self.name + ': got http error %d fetching %s' % + (e.code, web_url)) + common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) + return self.unresolvable(code=3, msg=e) + except Exception, e: + common.addon.log('**** streaminto Error occured: %s' % e) + common.addon.show_small_popup(title='[B][COLOR white]streaminto[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) + return self.unresolvable(code=0, msg=e) + + def get_url(self, host, media_id): + return 'http://streamin.to/%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 self.name in host From b25dcc5b06e3af5ccb5b2d6ab804079f7aa14b45 Mon Sep 17 00:00:00 2001 From: alibbaba Date: Mon, 22 Dec 2014 18:24:55 -0500 Subject: [PATCH 0557/1360] Do not check rtmp type exclude rtmp type --- lib/urlresolver/types.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 7a3e825f..15cb5d12 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -143,8 +143,14 @@ def resolve(self): resolver.login() stream_url = resolver.get_media_url(self._host, self._media_id) - if stream_url and self.__test_stream(stream_url): - return stream_url + + + if stream_url : + if stream_url.startswith('rtmp://'): + print 'return rtmp stream' + return stream_url + elif self.__test_stream(stream_url): + return stream_url return False From d52ad9141b89273790af8c8fd17effc5f53c25de Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Tue, 23 Dec 2014 03:22:11 -0500 Subject: [PATCH 0558/1360] fix vidspot resolver --- lib/urlresolver/plugins/vidspot.py | 39 +++++++++++------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py index 4e17cbdd..c9a43d5b 100644 --- a/lib/urlresolver/plugins/vidspot.py +++ b/lib/urlresolver/plugins/vidspot.py @@ -20,59 +20,50 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os -import xbmcgui +import re from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -net = Net() - -class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): +class VidSpotResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidspot" - def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): try: url = self.get_url(host, media_id) html = self.net.http_GET(url).content - dialog = xbmcgui.DialogProgress() - dialog.create('Resolving', 'Resolving vidspot Link...') - dialog.update(0) data = {} r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) for name, value in r: data[name] = value - html = net.http_POST(url, data).content - dialog.update(50) + html = self.net.http_POST(url, data).content - r = re.search('"sources"\s*:\s*.\n*\s*.\n*\s*"file"\s*:\s*"(.+?)"', html) + r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) if r: - dialog.update(100) - dialog.close() - return r.group(1) + fragment = r.group(1) + stream_url = None + for match in re.finditer('"file"\s*:\s*"([^"]+)', fragment): + stream_url = match.group(1) + + if stream_url: + return stream_url + else: + raise Exception('could not find file') else: - dialog.close() - raise Exception('could not find video') + raise Exception('could not find sources') except Exception, e: common.addon.log('**** vidspot Error occured: %s' % e) - common.addon.show_small_popup('Error', str(e), 5000, '') return self.unresolvable(code=0, msg='Exception: %s' % e) def get_url(self, host, media_id): return 'http://vidspot.net/%s' % media_id - def get_host_and_id(self, url): r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) @@ -80,8 +71,6 @@ def get_host_and_id(self, url): return r.groups() else: return False - return('host', 'media_id') - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False From bdbd4591a4ff669e42f10f4e413aefea1dadac43 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Tue, 23 Dec 2014 03:28:31 -0500 Subject: [PATCH 0559/1360] fix thevideo.me resolver to handle embedded links --- lib/urlresolver/plugins/thevideo.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/urlresolver/plugins/thevideo.py b/lib/urlresolver/plugins/thevideo.py index 77be70ed..0aaf1483 100644 --- a/lib/urlresolver/plugins/thevideo.py +++ b/lib/urlresolver/plugins/thevideo.py @@ -20,27 +20,22 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, urllib, urllib2, os, xbmcgui +import re, urllib, urllib2 from urlresolver import common from lib import jsunpack -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' MAX_TRIES=3 -class SharesixResolver(Plugin, UrlResolver, PluginSettings): +class TheVideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "thevideo" - def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) @@ -95,26 +90,21 @@ def get_media_url(self, host, media_id): except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** TheVideo Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]THEVIDEO[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e) - def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) - def get_host_and_id(self, url): - r = re.search('//(.+?)/([0-9a-zA-Z/]+)', url) + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z/]+)', 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('http://(www\.|embed-)?thevideo.me/' + From 2f8369bd9abb3bb36cd9c024b32fe07ee3d43ba7 Mon Sep 17 00:00:00 2001 From: Irfan Charania Date: Mon, 29 Dec 2014 22:19:01 -0800 Subject: [PATCH 0560/1360] Add Vshare Resolver --- lib/urlresolver/plugins/vshare.py | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/urlresolver/plugins/vshare.py diff --git a/lib/urlresolver/plugins/vshare.py b/lib/urlresolver/plugins/vshare.py new file mode 100644 index 00000000..e5e6227b --- /dev/null +++ b/lib/urlresolver/plugins/vshare.py @@ -0,0 +1,74 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import os +import xbmc +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +import urllib2 +from urlresolver import common + +logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +class VshareResolver(Plugin, UrlResolver, PluginSettings): + implements=[UrlResolver,PluginSettings] + name="vshare" + + def __init__(self): + p=self.get_setting('priority') or 100 + self.priority=int(p) + self.net=Net() + self.pattern='http://((?:www.)?vshare.io)/\w?/(\w+)(?:\/width-\d+/height-\d+/)?' + + def get_url(self,host,media_id): + return 'http://vshare.io/v/%s/width-620/height-280/' % (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): + try: + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + + if link.find('404 - Error') >= 0: + err_title = 'Content not available.' + err_message = 'The requested video was not found.' + common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) + xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') + return self.unresolvable(1, err_message) + + video_link = str(re.compile("url[: ]*'(.+?)'").findall(link)[0]) + + if len(video_link) > 0: + return video_link + else: + return self.unresolvable(0, 'No playable video found.') + except urllib2.URLError, e: + return self.unresolvable(3, str(e)) + except Exception, e: + return self.unresolvable(0, str(e)) From 5a6a2bb6ffa386d66fd220c83ed81f6910b08668 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Wed, 31 Dec 2014 23:33:20 -0500 Subject: [PATCH 0561/1360] fix premiumize to work w/ host validation --- lib/urlresolver/plugins/premiumize_me.py | 36 +++++++++++++----------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/urlresolver/plugins/premiumize_me.py b/lib/urlresolver/plugins/premiumize_me.py index 4320dc3c..f86a0258 100644 --- a/lib/urlresolver/plugins/premiumize_me.py +++ b/lib/urlresolver/plugins/premiumize_me.py @@ -16,9 +16,6 @@ along with this program. If not, see . """ -import os, sys -import re - from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import SiteAuth from urlresolver.plugnplay.interfaces import PluginSettings @@ -26,6 +23,7 @@ from urlresolver import common from t0mm0.common.net import Net +import re try: import simplejson as json except ImportError: @@ -40,7 +38,8 @@ def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - self.patterns = None + self.hosts = [] + self.patterns = [] #UrlResolver methods def get_media_url(self, host, media_id): @@ -56,7 +55,6 @@ def get_media_url(self, host, media_id): link = response['result']['location'] except Exception, e: common.addon.log_error('**** Premiumize Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]PREMIUMIZE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e) common.addon.log('Premiumize.me: Resolved to %s' %link) @@ -66,11 +64,11 @@ def get_url(self, host, media_id): return media_id def get_host_and_id(self, url): - return 'Premiumize.me', url + return 'premiumize.me', url def get_all_hosters(self): try : - if self.patterns is None: + if self.patterns is None or self.hosts is None: username = self.get_setting('username') password = self.get_setting('password') url = 'https://api.premiumize.me/pm-api/v1.php?method=hosterlist' @@ -79,20 +77,26 @@ def get_all_hosters(self): response = self.net.http_GET(url).content response = json.loads(response) result = response['result'] - log_msg = 'Premiumize.me patterns: %s' % result['regexlist'] + log_msg = 'Premiumize.me patterns: %s hosts: %s' % (result['regexlist'], result['tldlist']) common.addon.log_debug(log_msg) + self.hosts = result['tldlist'] self.patterns = [re.compile(regex) for regex in result['regexlist']] - return self.patterns except : - return [] + pass def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': - return False + if self.get_setting('enabled') == 'false': return False if self.get_setting('login') == 'false': return False - for pattern in self.get_all_hosters(): - if pattern.findall(url): + + self.get_all_hosters() + if url: + for pattern in self.patterns: + if pattern.findall(url): + return True + elif host: + if host in self.hosts or any(item in host for item in self.hosts): return True + return False #PluginSettings methods @@ -101,9 +105,9 @@ def get_settings_xml(self): xml += ' Date: Wed, 31 Dec 2014 23:58:04 -0500 Subject: [PATCH 0562/1360] improve url strings --- lib/urlresolver/plugins/premiumize_me.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/urlresolver/plugins/premiumize_me.py b/lib/urlresolver/plugins/premiumize_me.py index f86a0258..79fcd388 100644 --- a/lib/urlresolver/plugins/premiumize_me.py +++ b/lib/urlresolver/plugins/premiumize_me.py @@ -24,6 +24,7 @@ from t0mm0.common.net import Net import re +import urllib try: import simplejson as json except ImportError: @@ -36,10 +37,10 @@ class PremiumizeMeResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): def __init__(self): p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() self.hosts = [] self.patterns = [] + self.priority = int(p) + self.net = Net() #UrlResolver methods def get_media_url(self, host, media_id): @@ -47,9 +48,8 @@ def get_media_url(self, host, media_id): username = self.get_setting('username') password = self.get_setting('password') url = 'https://api.premiumize.me/pm-api/v1.php?' - url += 'method=directdownloadlink¶ms%%5Blogin%%5D=%s' - url += '¶ms%%5Bpass%%5D=%s¶ms%%5Blink%%5D=%s' - url = url % (username, password, media_id) + query = urllib.urlencode({'method': 'directdownloadlink', 'params[login]': username, 'params[pass]': password, 'params[link]': media_id}) + url = url + query response = self.net.http_GET(url).content response = json.loads(response) link = response['result']['location'] @@ -57,7 +57,7 @@ def get_media_url(self, host, media_id): common.addon.log_error('**** Premiumize Error occured: %s' % e) return self.unresolvable(code=0, msg=e) - common.addon.log('Premiumize.me: Resolved to %s' %link) + common.addon.log_debug('Premiumize.me: Resolved to %s' %link) return link def get_url(self, host, media_id): @@ -68,12 +68,12 @@ def get_host_and_id(self, url): def get_all_hosters(self): try : - if self.patterns is None or self.hosts is None: + if not self.patterns or not self.hosts: username = self.get_setting('username') password = self.get_setting('password') - url = 'https://api.premiumize.me/pm-api/v1.php?method=hosterlist' - url += '¶ms%%5Blogin%%5D=%s¶ms%%5Bpass%%5D=%s' - url = url % (username, password) + url = 'https://api.premiumize.me/pm-api/v1.php?' + query = urllib.urlencode({'method': 'hosterlist', 'params[login]': username, 'params[pass]': password}) + url = url + query response = self.net.http_GET(url).content response = json.loads(response) result = response['result'] From 1613363876c1af82ffc6b362e52c193dcbf2d656 Mon Sep 17 00:00:00 2001 From: Irfan Charania Date: Sat, 3 Jan 2015 18:47:49 -0800 Subject: [PATCH 0563/1360] Update Novamov regex to extract embedded media id --- lib/urlresolver/plugins/novamov.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/novamov.py b/lib/urlresolver/plugins/novamov.py index 3ed4cc77..161dfc0e 100644 --- a/lib/urlresolver/plugins/novamov.py +++ b/lib/urlresolver/plugins/novamov.py @@ -70,7 +70,7 @@ def get_url(self, host, media_id): return 'http://www.novamov.com/video/%s' % media_id def get_host_and_id(self, url): - r = re.search('//(?:embed.)?(.+?)/(?:video/|embed.php\?v=)([0-9a-z]+)', url) + r = re.search('//(?:www\.|embed\.)?novamov\.com\/(?:(?:video/)(\w+)|(?:embed\.php\?[\w\=\&]*)v\=(\w+))', url) if r: return r.groups() else: From 0d20b5d1216b90326671462b173cb1a51044b7b2 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Mon, 5 Jan 2015 23:34:58 -0500 Subject: [PATCH 0564/1360] improve premiumize.me error handling --- lib/urlresolver/plugins/premiumize_me.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/premiumize_me.py b/lib/urlresolver/plugins/premiumize_me.py index 79fcd388..dc49f996 100644 --- a/lib/urlresolver/plugins/premiumize_me.py +++ b/lib/urlresolver/plugins/premiumize_me.py @@ -52,7 +52,11 @@ def get_media_url(self, host, media_id): url = url + query response = self.net.http_GET(url).content response = json.loads(response) - link = response['result']['location'] + if 'status' in response: + if response['status']==200: + link = response['result']['location'] + else: + raise Exception('Link Not Found: Error Code: %s' % response['status']) except Exception, e: common.addon.log_error('**** Premiumize Error occured: %s' % e) return self.unresolvable(code=0, msg=e) From 6d493e3712f7a0eb395cb03e733c3bafb702debd Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Mon, 5 Jan 2015 23:36:57 -0500 Subject: [PATCH 0565/1360] catch unexpected response --- lib/urlresolver/plugins/premiumize_me.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/urlresolver/plugins/premiumize_me.py b/lib/urlresolver/plugins/premiumize_me.py index dc49f996..88aabc7c 100644 --- a/lib/urlresolver/plugins/premiumize_me.py +++ b/lib/urlresolver/plugins/premiumize_me.py @@ -57,6 +57,8 @@ def get_media_url(self, host, media_id): link = response['result']['location'] else: raise Exception('Link Not Found: Error Code: %s' % response['status']) + else: + raise Exception('Unexpected Response Received') except Exception, e: common.addon.log_error('**** Premiumize Error occured: %s' % e) return self.unresolvable(code=0, msg=e) From 5f16eb928ba82c913e00cf44309e283b020798a2 Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Wed, 7 Jan 2015 19:23:05 +0100 Subject: [PATCH 0566/1360] new resolver cloudyvideos --- lib/urlresolver/plugins/cloudyvideos.py | 80 +++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 lib/urlresolver/plugins/cloudyvideos.py diff --git a/lib/urlresolver/plugins/cloudyvideos.py b/lib/urlresolver/plugins/cloudyvideos.py new file mode 100644 index 00000000..b044b7c5 --- /dev/null +++ b/lib/urlresolver/plugins/cloudyvideos.py @@ -0,0 +1,80 @@ +""" +cloudyvideos urlresolver plugin +Copyright (C) 2015 Lynx187 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2 +from urlresolver import common +from lib import jsunpack +import re +import os + +error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') + +class CloudyvideosResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "cloudyvideos" + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + print web_url + try: + html = self.net.http_GET(web_url).content + form_values = {} + for i in re.finditer(' Date: Wed, 7 Jan 2015 21:14:15 -0500 Subject: [PATCH 0567/1360] Increase timeout for universal resolvers which take longer; handle unknown url schemes more generically (to replace the specific rtmp code) --- lib/urlresolver/types.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 15cb5d12..6db76ce2 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -143,13 +143,7 @@ def resolve(self): resolver.login() stream_url = resolver.get_media_url(self._host, self._media_id) - - - if stream_url : - if stream_url.startswith('rtmp://'): - print 'return rtmp stream' - return stream_url - elif self.__test_stream(stream_url): + if stream_url and self.__test_stream(stream_url): return stream_url return False @@ -187,9 +181,15 @@ def __test_stream(self, stream_url): request = urllib2.Request(stream_url.split('|')[0], headers=headers) - # set urlopen timeout to 2 seconds - try: http_code = urllib2.urlopen(request, timeout=2).getcode() - except: http_code = 404 # not sure how I feel about considering all urlopen exceptions a http 404 + # set urlopen timeout to 10 seconds + try: http_code = urllib2.urlopen(request, timeout=15).getcode() + except urllib2.URLError as e: + # treat an unhandled url type as success + if 'unknown url type' in e.reason.lower(): + return True + else: + http_code = 404 + except: http_code = 404 # added this log line for now so that we can catch any logs on streams that are rejected due to test_stream failures # we can remove it once we are sure this works reliably From d9bd4997099f4302831e20c618f25bc86db3a9a1 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Fri, 9 Jan 2015 00:24:52 -0500 Subject: [PATCH 0568/1360] fix bu resolver --- lib/urlresolver/plugins/billionuploads.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/lib/urlresolver/plugins/billionuploads.py b/lib/urlresolver/plugins/billionuploads.py index 17ba9618..ba0d7965 100644 --- a/lib/urlresolver/plugins/billionuploads.py +++ b/lib/urlresolver/plugins/billionuploads.py @@ -76,30 +76,15 @@ def get_media_url(self, host, media_id): data = {} r = re.findall(r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html) for name, value in r: data[name] = value - if 'rand' in data: del data['rand'] - if 'gloss' in data: del data['gloss'] - data['airman']='toast' - r = re.search(r'hidden">([^<]+)', html) - if r: - data['blader']=r.group(1) + data['method_free']='Download or watch' #print data html = net.http_POST(web_url, form_data = data, headers = headers).content #print 'html3: %s' % (html.encode('ascii','ignore')) - file_str = None - r = re.search(r'metro">([^<]+)', html) + r = re.search(r'class="[^"]+download"\s+href="([^"]+)', html) if r: - file_str = r.group(1) - sep = 'XXX' - else: - r = re.search(r'id="dl"\s+value="([^"]+)', html) - if r: - file_str = r.group(1) - sep = 'GvaZu' - - if file_str: - return self.__bu_decode(self.__bu_decode(file_str.split(sep)[1])) + return r.group(1) else: raise Exception('Unable to locate file link') except Exception as e: From 5526b66c4b5894fc0f7c916d685c48accd837838 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Fri, 9 Jan 2015 00:38:48 -0500 Subject: [PATCH 0569/1360] fix for two different video pages I've seen on the new BU --- lib/urlresolver/plugins/billionuploads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/billionuploads.py b/lib/urlresolver/plugins/billionuploads.py index ba0d7965..06a59e28 100644 --- a/lib/urlresolver/plugins/billionuploads.py +++ b/lib/urlresolver/plugins/billionuploads.py @@ -82,7 +82,7 @@ def get_media_url(self, host, media_id): html = net.http_POST(web_url, form_data = data, headers = headers).content #print 'html3: %s' % (html.encode('ascii','ignore')) - r = re.search(r'class="[^"]+download"\s+href="([^"]+)', html) + r = re.search(r'class="[^"]*download"\s+href="([^"]+)', html) if r: return r.group(1) else: From fe7250b08680879e4e0028779c77b7a85e6ea194 Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Sat, 10 Jan 2015 17:50:52 +0100 Subject: [PATCH 0570/1360] Update novamov.py previous RegEx returned (id,None) or (None,id) instead of (host,id). --- lib/urlresolver/plugins/novamov.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/novamov.py b/lib/urlresolver/plugins/novamov.py index 161dfc0e..151035dc 100644 --- a/lib/urlresolver/plugins/novamov.py +++ b/lib/urlresolver/plugins/novamov.py @@ -70,7 +70,7 @@ def get_url(self, host, media_id): return 'http://www.novamov.com/video/%s' % media_id def get_host_and_id(self, url): - r = re.search('//(?:www\.|embed\.)?novamov\.com\/(?:(?:video/)(\w+)|(?:embed\.php\?[\w\=\&]*)v\=(\w+))', url) + r = re.search('//(?:www\.|embed\.)?(.+?)/(?:video/|embed\.php\?[\w=&]*v=)(\w+)',url) if r: return r.groups() else: From 94396de2e11d00f78988864025cdd78f7c1cd921 Mon Sep 17 00:00:00 2001 From: Eldorados Date: Mon, 12 Jan 2015 16:24:26 -0500 Subject: [PATCH 0571/1360] Dead resolvers --- lib/urlresolver/plugins/2gbhosting.py | 91 ------------------ lib/urlresolver/plugins/cheesestream.py | 80 ---------------- lib/urlresolver/plugins/clicktoview.py | 117 ------------------------ lib/urlresolver/plugins/entroupload.py | 113 ----------------------- lib/urlresolver/plugins/filebox.py | 93 ------------------- 5 files changed, 494 deletions(-) delete mode 100644 lib/urlresolver/plugins/2gbhosting.py delete mode 100644 lib/urlresolver/plugins/cheesestream.py delete mode 100644 lib/urlresolver/plugins/clicktoview.py delete mode 100644 lib/urlresolver/plugins/entroupload.py delete mode 100644 lib/urlresolver/plugins/filebox.py diff --git a/lib/urlresolver/plugins/2gbhosting.py b/lib/urlresolver/plugins/2gbhosting.py deleted file mode 100644 index a567c2b3..00000000 --- a/lib/urlresolver/plugins/2gbhosting.py +++ /dev/null @@ -1,91 +0,0 @@ -''' -2gbhosting urlresolver plugin -Copyright (C) 2011 t0mm0, DragonWin, jas0npc - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' - -from t0mm0.common.net import Net -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -from lib import jsunpack -import re, urllib2, os -from urlresolver import common - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = common.addon_path + '/resources/images/redx.png' - -class TwogbhostingResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "2gbhosting" - - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - data = {} - try: - html = self.net.http_GET(web_url).content - r = re.search('', html) - if not r: - raise Exception ('File Not Found or removed') - if r: - sid = r.group(1) - common.addon.log_debug('eg-hosting: found k' + sid) - data = { 'k' : sid,'submit' : 'Click Here To Continue', } - common.addon.show_countdown(10, 'Please Wait', 'Resolving') - html = self.net.http_POST(web_url, data).content - r = re.findall("text/javascript'>\n.+?(eval\(function\(p,a,c,k,e,d\).+?)\n.+?",html,re.I|re.M) - if r: - unpacked = jsunpack.unpack(r[0]) - unpacked = str(unpacked).replace('\\','') - r = re.findall(r"file\':\'(.+?)\'",unpacked) - return r[0] - if not r: - raise Exception ('File Not Found or removed') - - except urllib2.URLError, e: - common.addon.log_error('2gb-hosting: http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** 2GB-hosting Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]2GBHOSTING[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) - - def get_url(self, host, media_id): - return 'http://www.2gb-hosting.com/videos/%s' % media_id + '.html' - - - def get_host_and_id(self, url): - r = re.search('//(.+?)/[videos|v]/([0-9a-zA-Z/]+)', 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('http://(www.)?2gb-hosting.com/[videos|v]/' + - '[0-9A-Za-z]+/[0-9a-zA-Z]+.*', url) or - '2gb-hosting' in host) diff --git a/lib/urlresolver/plugins/cheesestream.py b/lib/urlresolver/plugins/cheesestream.py deleted file mode 100644 index 2cb502d4..00000000 --- a/lib/urlresolver/plugins/cheesestream.py +++ /dev/null @@ -1,80 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -from t0mm0.common.net import Net -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import urllib,urllib2 -from urlresolver import common -import re - -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "cheesestream.com" - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - # http://cheesestream.com/embed_ext/videoweed/4f4d5748c8f56&width=600&height=438 - #self.pattern = 'http://((?:embed.)?cheesestream.com)/embed[_ext]*/([0-9a-zA-Z/\?=]+)[\&]*' - self.pattern = 'http://((?:www.)?cheesestream.com)/embed[_ext]*/([0-9a-zA-Z/\?=]+)[\&]*' - self.pattern2 = 'http://(embed.cheesestream.com)/([0-9a-zA-Z/\?=]+)[\&]*' - #self.pattern = 'http://((?:www.)?cheesestream.com)/embed/(.+?)' - - def get_url(self, host, media_id): - # http://embed.cheesestream.com/f0O8nd?client_file_id=349851 - if '/' in media_id: - return 'http://cheesestream.com/embed_ext/%s' % (media_id) - elif '?client_file_id=' in media_id: - #return 'http://embed.cheesestream.com/%s?client_file_id=%s' % (media_id.split("?client_file_id=")[0],media_id.split("?client_file_id=")[1]) - return 'http://embed.cheesestream.com/%s' % (media_id) - else: - return 'http://embed.cheesestream.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 - if 'embed.cheesestream.com/' in url: self.pattern=self.pattern2 - 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) - post_url = web_url - hostname = self.name - common.addon.log(media_id) - common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False - r = re.search("'file'\s*:\s*'(.+?)'", html) - if r: - stream_url = urllib.unquote_plus(r.group(1)) - else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False - return stream_url - \ No newline at end of file diff --git a/lib/urlresolver/plugins/clicktoview.py b/lib/urlresolver/plugins/clicktoview.py deleted file mode 100644 index d5f590f0..00000000 --- a/lib/urlresolver/plugins/clicktoview.py +++ /dev/null @@ -1,117 +0,0 @@ -''' -Clicktoview urlresolver plugin -Copyright (C) 2013 Vinnydude - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' - -from t0mm0.common.net import Net -from urlresolver.plugnplay.interfaces import UrlResolver -from urlresolver.plugnplay.interfaces import PluginSettings -from urlresolver.plugnplay import Plugin -import re -from urlresolver import common -from lib import jsunpack -from lib import captcha_lib - -net = Net() - -class ClicktoviewResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "clicktoview" - - - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - - def get_media_url(self, host, media_id): - try: - url = self.get_url(host, media_id) - html = self.net.http_GET(url).content - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - data.update({'method_free':'Create Streaming Link'}) - - html = net.http_POST(url, data).content - r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) - for name, value in r: - data[name] = value - - #Check for SolveMedia Captcha image - solvemedia = re.search('',html,re.DOTALL) + r = re.search('', html, re.DOTALL) if r: html = self.net.http_GET(r.group(1)).content - r = re.search("
.*?",html,re.DOTALL) + r = re.search("
.*?", html, re.DOTALL) if not r: - raise Exception ('Unable to resolve Mightyupload link. Player config not found.') - r_temp = re.search("file: '([^']+)'",r.group(1)) + raise Exception('Unable to resolve Mightyupload link. Player config not found.') + r_temp = re.search("file: '([^']+)'", r.group(1)) if r_temp: return r_temp.group(1) js = jsunpack.unpack(r.group(1)) - r = re.search("'file','([^']+)'", js.replace('\\','')) + r = re.search("'file','([^']+)'", js.replace('\\', '')) if not r: - r = re.search('"src"value="([^"]+)', js.replace('\\','')) + r = re.search('"src"value="([^"]+)', js.replace('\\', '')) if not r: - raise Exception ('Unable to resolve Mightyupload link. Filelink not found.') + raise Exception('Unable to resolve Mightyupload link. Filelink not found.') return r.group(1) except urllib2.URLError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) + return self.unresolvable(code=3, msg='Exception: %s' % e) except Exception, e: common.addon.log('**** Mightyupload Error occured: %s' % e) return self.unresolvable(code=0, msg='Exception: %s' % e) @@ -76,7 +76,7 @@ def get_url(self, host, media_id): return 'http://www.mightyupload.com/embed-%s.html' % (media_id) def get_host_and_id(self, url): - r = re.search('http://(?:www.)(.+?)/embed-([\w]+)-', url) + r = re.search('http://(?:www.)?(.+?)/embed-([\w]+)-', url) if r: return r.groups() else: @@ -89,5 +89,3 @@ def get_host_and_id(self, url): def valid_url(self, url, host): return re.match('http://(www.)?mightyupload.com/[0-9A-Za-z]+', url) or 'mightyupload' in host - - From d4a17efdf4732c1e2049ea5d6a0ae4f0500290d7 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 26 Mar 2015 22:37:33 -0400 Subject: [PATCH 0653/1360] add co to nowvideo resolver --- lib/urlresolver/plugins/nowvideo.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/urlresolver/plugins/nowvideo.py b/lib/urlresolver/plugins/nowvideo.py index 05fc7a01..d65b76e4 100644 --- a/lib/urlresolver/plugins/nowvideo.py +++ b/lib/urlresolver/plugins/nowvideo.py @@ -24,13 +24,10 @@ from urlresolver.plugnplay import Plugin from lib import unwise -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO & RESOLVING BY MIKEY1234 -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class NowvideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "nowvideo" - domains = [ "nowvideo.eu","nowvideo.ch","nowvideo.sx" ] + domains = ["nowvideo.eu", "nowvideo.ch", "nowvideo.sx", "nowvideo.co"] def __init__(self): p = self.get_setting('priority') or 100 @@ -43,14 +40,14 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url).content key = re.compile('flashvars.filekey=(.+?);').findall(html) ip_key = key[0] - pattern = 'var %s="(.+?)".+?flashvars.file="(.+?)"'% str(ip_key) - r = re.search(pattern,html, re.DOTALL) + pattern = 'var %s="(.+?)".+?flashvars.file="(.+?)"' % str(ip_key) + r = re.search(pattern, html, re.DOTALL) if r: - filekey, filename= r.groups() + filekey, filename = r.groups() else: - r = re.search('file no longer exists',html) + r = re.search('file no longer exists', html) if r: - raise Exception ('File Not Found or removed') + raise Exception('File Not Found or removed') #get stream url from api api = 'http://www.nowvideo.sx/api/player.api.php?key=%s&file=%s' % (filekey, filename) @@ -59,10 +56,10 @@ def get_media_url(self, host, media_id): if r: stream_url = urllib.unquote(r.group(1)) else: - r = re.search('no longer exists',html) + r = re.search('no longer exists', html) if r: - raise Exception ('File Not Found or removed') - raise Exception ('Failed to parse url') + raise Exception('File Not Found or removed') + raise Exception('Failed to parse url') try: # test the url, should throw 404 @@ -82,14 +79,13 @@ def get_media_url(self, host, media_id): return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Nowvideo Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]NOWVIDEO[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e) def get_url(self, host, media_id): return 'http://embed.nowvideo.sx/embed.php?v=%s' % media_id def get_host_and_id(self, url): - r = re.search('((?:http://|www.|embed.)nowvideo.(?:eu|sx|ch))/(?:video/|embed.php\?.*?v=)([0-9a-z]+)', url) + r = re.search('((?:http://|www.|embed.)nowvideo.(?:eu|sx|ch|co))/(?:video/|embed.php\?.*?v=)([0-9a-z]+)', url) if r: return r.groups() else: @@ -97,4 +93,4 @@ def get_host_and_id(self, url): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - return re.match('http://(www.|embed.)?nowvideo.(?:eu|sx|ch)/(video/|embed.php\?)(?:[0-9a-z]+|width)', url) or 'nowvideo' in host + return re.match('http://(www.|embed.)?nowvideo.(?:eu|sx|ch|co)/(video/|embed.php\?)(?:[0-9a-z]+|width)', url) or 'nowvideo' in host From 8f7d3372655f165d603b40414476af5892d3f965 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 26 Mar 2015 23:35:37 -0400 Subject: [PATCH 0654/1360] add filepup resolver --- lib/urlresolver/plugins/filepup.py | 66 ++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 lib/urlresolver/plugins/filepup.py diff --git a/lib/urlresolver/plugins/filepup.py b/lib/urlresolver/plugins/filepup.py new file mode 100644 index 00000000..c53e30d8 --- /dev/null +++ b/lib/urlresolver/plugins/filepup.py @@ -0,0 +1,66 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2015 tknorris + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import urllib2, re, os +from urlresolver import common + +class FilePupResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "filepup" + domains = ["filepup.net"] + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?filepup.(?:net))/play/([0-9a-zA-Z]+)' + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + try: + resp = self.net.http_GET(web_url) + html = resp.content + r = re.search(' Date: Fri, 27 Mar 2015 02:52:43 -0400 Subject: [PATCH 0655/1360] add alternate url form for filepup --- lib/urlresolver/plugins/filepup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/filepup.py b/lib/urlresolver/plugins/filepup.py index c53e30d8..8cfe595f 100644 --- a/lib/urlresolver/plugins/filepup.py +++ b/lib/urlresolver/plugins/filepup.py @@ -32,7 +32,7 @@ def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - self.pattern = 'http://((?:www.)?filepup.(?:net))/play/([0-9a-zA-Z]+)' + self.pattern = 'http://((?:www.)?filepup.(?:net))/(?:play|files)/([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) From 07cb589345961ce2af9f7fa396f4b6c95cfcb178 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Mon, 6 Apr 2015 19:20:29 -0400 Subject: [PATCH 0656/1360] add embed support for vidzi --- lib/urlresolver/plugins/vidzi.py | 37 ++++++++------------------------ 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/lib/urlresolver/plugins/vidzi.py b/lib/urlresolver/plugins/vidzi.py index d3bd7641..9332f916 100644 --- a/lib/urlresolver/plugins/vidzi.py +++ b/lib/urlresolver/plugins/vidzi.py @@ -20,72 +20,53 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, urllib2, os, xbmcgui +import re +import urllib2 from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' - -class SharesixResolver(Plugin, UrlResolver, PluginSettings): +class VidziResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidzi" - domains = [ "vidzi.tv" ] - + domains = ["vidzi.tv"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - try: - headers = { - 'User-Agent': USER_AGENT, - 'Referer': web_url - } - + web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if '404 Not Found' in html: - raise Exception ('File Not Found or removed') + raise Exception('File Not Found or removed') r = re.search('.+file:\s"(.+?)"', html) if not r: raise Exception('Unable to locate link') else: - stream_url=r.group(1) + stream_url = r.group(1) return stream_url + '|Referer=http://vidzi.tv/nplayer/jwplayer.flash.swf' except urllib2.HTTPError, e: common.addon.log_error(self.name + ': got http error %d fetching %s' % (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) return self.unresolvable(code=3, msg=e) except Exception, e: common.addon.log_error('**** Vidzi Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]VIDZI[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) return self.unresolvable(code=0, msg=e) - def get_url(self, host, media_id): return 'http://%s/%s.html' % (host, media_id) - def get_host_and_id(self, url): - r = re.search('http://(?:www\.|embed-)?(.+?)/([0-9a-zA-Z/]+)', url) + r = re.search('http://(?:www\.|embed-)?(.+?)/(?:embed-)?([0-9a-zA-Z/]+)', 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('http://(www\.|embed-)?vidzi.tv/' + - '[0-9A-Za-z]+', url) or - 'vidzi' in host) + return (re.match('http://(www\.|embed-)?vidzi.tv/(?:embed-)?[0-9A-Za-z]+', url) or 'vidzi' in host) From 13c0ef50c479ec8f028360cb896a85b267240e39 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Wed, 8 Apr 2015 16:50:57 -0400 Subject: [PATCH 0657/1360] Fix solvemedia captcha when using frame method --- lib/urlresolver/plugins/lib/captcha_lib.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/lib/captcha_lib.py b/lib/urlresolver/plugins/lib/captcha_lib.py index 45367559..f3965610 100644 --- a/lib/urlresolver/plugins/lib/captcha_lib.py +++ b/lib/urlresolver/plugins/lib/captcha_lib.py @@ -25,7 +25,7 @@ import os net = Net() -IMG_FILE = 'captcha_img.gif' +IMG_FILE = 'captcha_img.png' def get_response(img): try: @@ -80,11 +80,14 @@ def do_solvemedia_captcha(captcha_url): except: pass #Check for alternate puzzle type - stored in a div - alt_puzzle = re.search('
', html, re.DOTALL) - if r: - html = self.net.http_GET(r.group(1)).content - r = re.search("
.*?", html, re.DOTALL) - if not r: - raise Exception('Unable to resolve Mightyupload link. Player config not found.') - r_temp = re.search("file: '([^']+)'", r.group(1)) - if r_temp: - return r_temp.group(1) + html = self.net.http_GET(web_url).content + form_values = {} + stream_url = None + for i in re.finditer('', html, re.DOTALL) + if r: + html = self.net.http_GET(r.group(1)).content + r = re.search("
.*?", html, re.DOTALL) + if not r: + raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Player config not found.') + r_temp = re.search("file: '([^']+)'", r.group(1)) + if r_temp: + stream_url = r_temp.group(1) + else: js = jsunpack.unpack(r.group(1)) r = re.search("'file','([^']+)'", js.replace('\\', '')) if not r: r = re.search('"src"value="([^"]+)', js.replace('\\', '')) + if not r: - raise Exception('Unable to resolve Mightyupload link. Filelink not found.') - return r.group(1) - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) - except Exception, e: - common.addon.log('**** Mightyupload Error occured: %s' % e) - return self.unresolvable(code=0, msg='Exception: %s' % e) + raise UrlResolver.ResolverError('Unable to resolve Mightyupload link. Filelink not found.') + + stream_url = r.group(1) + + if stream_url: + return stream_url + '|User-Agent=%s' % (USER_AGENT) + else: + raise UrlResolver.ResolverError('Unable to resolve link') def get_url(self, host, media_id): return 'http://www.mightyupload.com/embed-%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/mooshare_biz.py b/lib/urlresolver/plugins/mooshare_biz.py index a0eccb7a..8148ade1 100644 --- a/lib/urlresolver/plugins/mooshare_biz.py +++ b/lib/urlresolver/plugins/mooshare_biz.py @@ -16,69 +16,45 @@ along with this program. If not, see . ''' +import re +import xbmc from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os -import xbmcgui,xbmc from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -net = Net() - class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mooshare" domains = [ "mooshare.biz" ] - def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): - try: url = self.get_url(host, media_id) html = self.net.http_GET(url).content - dialog = xbmcgui.DialogProgress() - dialog.create('Resolving', 'Resolving mooshare Link...') - dialog.update(0) data = {} if '' in html: html=html.split('')[1] - dialog.update(15) r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) - dialog.update(30) for name, value in r: data[name] = value data[u'referer']=''; data[u'usr_login']=''; data[u'imhuman']='Proceed to video'; data[u'btn_download']='Proceed to video'; - dialog.update(50) xbmc.sleep(5000) - html = net.http_POST(url, data).content - dialog.update(75) + html = self.net.http_POST(url, data).content r = re.search('file\s*:\s*"(.+?)"', html) if r: - dialog.update(100) - dialog.close() return r.group(1) else: - dialog.close() - raise Exception('could not find video') - - except Exception, e: - common.addon.log('**** mooshare Error occured: %s' % e) - common.addon.show_small_popup('Error', str(e), 5000, '') - return self.unresolvable(code=0, msg='Exception: %s' % e) + raise UrlResolver.ResolverError('could not find video') def get_url(self, host, media_id): return 'http://mooshare.biz/%s' % media_id - def get_host_and_id(self, url): r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) @@ -88,7 +64,6 @@ def get_host_and_id(self, url): return False return('host', 'media_id') - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?mooshare.biz/[0-9A-Za-z]+', url) or re.match('http://(www.)?mooshare.biz/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'mooshare' in host) diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index 29644487..2c1fe0a0 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -16,19 +16,15 @@ along with this program. If not, see . """ +import re +import urllib2 from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2 from urlresolver import common from lib import jsunpack -# Custom imports -import re -import os - -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class MovDivxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -42,57 +38,41 @@ def __init__(self): #e.g. http://movdivx.com/trrrw4r6bjqu/American_Dad__s_1_e_3_p1-1.flv.html self.pattern = 'http://(movdivx.com)/(.+?).html' - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - try: - html = self.net.http_GET(web_url).content - - r = 'name="op" value="(.+?)">.+?' - r += 'name="usr_login" value="(.+?)?">.+?' - r += 'name="id" value="(.+?)".+?' - r += 'name="fname" value="(.+?)".+?' - - r = re.search(r,html,re.DOTALL) - op,usr_login,id,fname = r.groups() - data = {'op':op} - data['usr_login'] = usr_login - data['id'] = id - data['fname'] = fname - data['referer'] = web_url - data['method_free'] = 'Continue to Stream' - - html = self.net.http_POST(web_url, data).content - - # get url from packed javascript - sPattern = '' - - matches = re.findall(sPattern, html, re.DOTALL + re.IGNORECASE) - - if matches: - sJavascript=matches[-1] - sUnpacked = jsunpack.unpack(sJavascript) - sUnpacked = sUnpacked.replace('\\','') - sPattern = "\('file','([^']+)" - r = re.search(sPattern, sUnpacked) - if r: - return r.group(1) - - raise Exception ('failed to parse link') - - except urllib2.URLError, e: - common.addon.log_error('Movdivx: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) + html = self.net.http_GET(web_url).content + + r = 'name="op" value="(.+?)">.+?' + r += 'name="usr_login" value="(.+?)?">.+?' + r += 'name="id" value="(.+?)".+?' + r += 'name="fname" value="(.+?)".+?' + + r = re.search(r, html, re.DOTALL) + op, usr_login, id, fname = r.groups() + data = {'op': op} + data['usr_login'] = usr_login + data['id'] = id + data['fname'] = fname + data['referer'] = web_url + data['method_free'] = 'Continue to Stream' + + html = self.net.http_POST(web_url, data).content + + # get url from packed javascript + sPattern = '' - except Exception, e: - common.addon.log_error('**** Movdivx Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]MOVDIVX[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) - + matches = re.findall(sPattern, html, re.DOTALL + re.IGNORECASE) + if matches: + sJavascript = matches[-1] + sUnpacked = jsunpack.unpack(sJavascript) + sUnpacked = sUnpacked.replace('\\', '') + sPattern = "\('file','([^']+)" + r = re.search(sPattern, sUnpacked) + if r: + return r.group(1) + + raise UrlResolver.ResolverError('failed to parse link') def get_url(self, host, media_id): return 'http://movdivx.com/%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py index 2c3aa04e..7ad408d9 100644 --- a/lib/urlresolver/plugins/movpod.py +++ b/lib/urlresolver/plugins/movpod.py @@ -20,17 +20,13 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, re, os +import re from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - - class MovpodResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "movpod" - domains = [ "movpod.net", "movpod.in" ] + domains = ["movpod.net", "movpod.in"] def __init__(self): p = self.get_setting('priority') or 100 @@ -39,38 +35,22 @@ def __init__(self): #e.g. http://movpod.com/vb80o1esx2eb self.pattern = 'http://((?:www.)?movpod.(?:net|in))/([0-9a-zA-Z]+)' - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - """ Human Verification """ - try: - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() - - - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2) - - html = self.net.http_POST(post_url, form_data=form_values).content - r = re.search('file: "http(.+?)"', html) - if r: - return "http" + r.group(1) - else: - raise Exception ('Unable to resolve Movpod Link') - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** Movpod Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]MOVPOD[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) - + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + + html = self.net.http_POST(post_url, form_data=form_values).content + r = re.search('file: "http(.+?)"', html) + if r: + return "http" + r.group(1) + else: + raise UrlResolver.ResolverError('Unable to resolve Movpod Link') def get_url(self, host, media_id): #return 'http://(movpod|movpod).(in|com)/%s' % (media_id) @@ -83,7 +63,6 @@ def get_host_and_id(self, url): 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 diff --git a/lib/urlresolver/plugins/movreel.py b/lib/urlresolver/plugins/movreel.py index 3a55b7a1..8bf4ec6e 100644 --- a/lib/urlresolver/plugins/movreel.py +++ b/lib/urlresolver/plugins/movreel.py @@ -19,7 +19,9 @@ mash2k3, Mikey1234,voinage and of course Eldorado. Cheers guys :) """ -import re, os, xbmc +import re +import os +import xbmc from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings @@ -32,7 +34,7 @@ class movreelResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "movreel" - domains = [ "movreel.com" ] + domains = ["movreel.com"] profile_path = common.profile_path cookie_file = os.path.join(profile_path, '%s.cookies' % name) @@ -46,41 +48,36 @@ def __init__(self): pass def get_media_url(self, host, media_id): - try: - net.set_cookies(self.cookie_file) - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - if re.search('This server is in maintenance mode', html): - raise Exception('File is currently unavailable on the host') - - data = {} - r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) - if r: - for name, value in r: - data[name] = value - data['referer'] = web_url - else: - raise Exception('Cannot find data values') - data['btn_download']='Continue to Video' - - r = re.search('Wait (.+?) seconds', html) - if r: - wait_time = r.group(1) - else: - wait_time = 2 # default to 2 seconds - xbmc.sleep(int(wait_time) * 1000) - - html = net.http_POST(web_url, data).content - - r = re.search('href="([^"]+)">Download Link', html) - if r: - return r.group(1) - else: - raise Exception('Unable to locate Download Link') + net.set_cookies(self.cookie_file) + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + if re.search('This server is in maintenance mode', html): + raise UrlResolver.ResolverError('File is currently unavailable on the host') + + data = {} + r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) + if r: + for name, value in r: + data[name] = value + data['referer'] = web_url + else: + raise UrlResolver.ResolverError('Cannot find data values') + data['btn_download'] = 'Continue to Video' + + r = re.search('Wait (.+?) seconds', html) + if r: + wait_time = r.group(1) + else: + wait_time = 2 # default to 2 seconds + xbmc.sleep(int(wait_time) * 1000) - except Exception, e: - common.addon.log('**** Movreel Error occured: %s' % e) - return self.unresolvable(code=0, msg='Exception: %s' % e) + html = net.http_POST(web_url, data).content + + r = re.search('href="([^"]+)">Download Link', html) + if r: + return r.group(1) + else: + raise UrlResolver.ResolverError('Unable to locate Download Link') def get_url(self, host, media_id): return 'http://www.movreel.com/%s' % media_id diff --git a/lib/urlresolver/plugins/movshare.py b/lib/urlresolver/plugins/movshare.py index aa29e36b..e300dd5f 100644 --- a/lib/urlresolver/plugins/movshare.py +++ b/lib/urlresolver/plugins/movshare.py @@ -23,7 +23,6 @@ """ import re -import urllib2 from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings @@ -42,39 +41,29 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - print web_url - """ Human Verification """ - try: - self.net.http_HEAD(web_url) - html = self.net.http_GET(web_url).content - """movshare can do both flv and avi. There is no way I know before hand - if the url going to be a flv or avi. So the first regex tries to find - the avi file, if nothing is present, it will check for the flv file. - "param name="src" is for avi - "flashvars.file=" is for flv - """ - r = re.search('. """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2 -import urllib from urlresolver import common from lib import jsunpack -import xbmcgui -import re -import time -from lib import jsunpack -import xbmc -import os - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class MovzapZuzVideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "movzap|zuzvideo" - domains = [ "movzap.com", "zuzvideo.com" ] + domains = ["movzap.com", "zuzvideo.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -46,39 +36,25 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + resp = self.net.http_GET(web_url) + html = resp.content - try: - resp = self.net.http_GET(web_url) - html = resp.content - - # search for packed function - sPattern="" - r = re.search(sPattern, html, re.DOTALL) + # search for packed function + sPattern = "" + r = re.search(sPattern, html, re.DOTALL) + if r: + sUnpacked = jsunpack.unpack(r.group(1)) + r = re.search('file:"(.+?)",', sUnpacked) if r: - sUnpacked = jsunpack.unpack(r.group(1)) - r = re.search('file:"(.+?)",', sUnpacked) - if r: - return r.group(1) - else: - # search for file reference if present - r = re.search('file: "(.+?)",', html) - if r: - return r.group(1) + return r.group(1) + else: + # search for file reference if present + r = re.search('file: "(.+?)",', html) + if r: + return r.group(1) - raise Exception ('movzap|zuzvideo: could not obtain video url') - - except urllib2.URLError, e: - common.addon.log_error('Movzap: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) + raise UrlResolver.ResolverError('movzap|zuzvideo: could not obtain video url') - except Exception, e: - common.addon.log_error('**** Movzap Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]MOVZAP[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) - - def get_url(self, host, media_id): return '%s/%s' % (host,media_id) @@ -92,4 +68,3 @@ def get_host_and_id(self, url): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match('http://(?:www.|)(?:movzap|zuzvideo).com/[0-9A-Za-z]+', url) or 'movzap' in host or 'zuzvideo' in host - diff --git a/lib/urlresolver/plugins/mp4star.py b/lib/urlresolver/plugins/mp4star.py index 3f55e6d7..af388380 100644 --- a/lib/urlresolver/plugins/mp4star.py +++ b/lib/urlresolver/plugins/mp4star.py @@ -21,62 +21,53 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -import urllib,urllib2,re,xbmc +import urllib +import re +import xbmc + +class MP4StarResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "mp4star" + domains = ["mp4star.com"] + domain = "http://mp4star.com" -class MP4StarResolver(Plugin,UrlResolver,PluginSettings): - implements=[UrlResolver,PluginSettings] - name="mp4star" - domains=[ "mp4star.com" ] - domain="http://mp4star.com" - def __init__(self): - p=self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - self.pattern='http://((?:www.)?mp4star.com)/\D+/(\d+)' - - def get_url(self,host,media_id): - return self.domain+'/vid/'+media_id - - def get_host_and_id(self,url): - r=re.search(self.pattern,url) + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?mp4star.com)/\D+/(\d+)' + + def get_url(self, host, media_id): + return self.domain + '/vid/' + 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) - post_url=web_url - hostname=self.name + + 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) + post_url = web_url common.addon.log(web_url) - headers={'Referer':web_url} - try: - resp=self.net.http_GET(web_url) - html=resp.content - except urllib2.URLError,e: - common.addon.log_error(hostname+': got http error %d fetching %s'%(e.code,web_url)) - return self.unresolvable(code=3,msg='Exception: %s'%e) #return False - data={} - r=re.findall(r'2 and 'hd_button' in param[2]: - break - - match = re.compile('file\':(.+?),').findall(link)[0] - if len(match)>5: - videoUrl = match.replace("'http:",'http:').replace("'+cc+'",param[0]).replace("'+videourl+'",param[1]).replace("'+token",param[3]).strip() - - return videoUrl - - - 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('//(.+?)/embed/(.+)', url) - if r: - return r.groups() - else: - return False - - - def valid_url(self, url, host): - return 'mp4stream' in url or self.name in host + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + link = ''.join(link.splitlines()).replace('\t', '') + videoUrl = 'nope' + + sPlayer = re.compile('show_player\((.+?)\)').findall(link) + for sPlayer_param in sPlayer: + param = re.compile('\'(.+?)\'').findall(sPlayer_param) + if len(param) > 2 and 'hd_button' in param[2]: + break + + match = re.compile('file\':(.+?),').findall(link)[0] + if len(match) > 5: + videoUrl = match.replace("'http:", 'http:').replace("'+cc+'", param[0]).replace("'+videourl+'", param[1]).replace("'+token", param[3]).strip() + + return videoUrl + + 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('//(.+?)/embed/(.+)', url) + if r: + return r.groups() + else: + return False + + def valid_url(self, url, host): + return 'mp4stream' in url or self.name in host diff --git a/lib/urlresolver/plugins/mp4upload.py b/lib/urlresolver/plugins/mp4upload.py index 6ca2ac88..a039bb09 100755 --- a/lib/urlresolver/plugins/mp4upload.py +++ b/lib/urlresolver/plugins/mp4upload.py @@ -19,49 +19,37 @@ import re from t0mm0.common.net import Net -import urllib2 from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import xbmcgui class Mp4uploadResolver(Plugin, UrlResolver, PluginSettings): - implements = [UrlResolver, PluginSettings] - name = "mp4upload" - domains = [ "mp4upload.com" ] + implements = [UrlResolver, PluginSettings] + name = "mp4upload" + domains = ["mp4upload.com"] - def __init__(self): - p = self.get_setting('priority') or 100 - self.priority = int(p) - self.net = Net() - - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - try: - link = self.net.http_GET(web_url).content - except urllib2.URLError, e: - common.addon.log_error(self.name + '- got http error %d fetching %s' % (e.code, web_url)) - return False - - link = ''.join(link.splitlines()).replace('\t','') - videoUrl = re.compile('\'file\': \'(.+?)\'').findall(link)[0] - - return videoUrl - - - def get_url(self, host, media_id): - return 'http://www.mp4upload.com/embed-%s.html' % media_id - - - def get_host_and_id(self, url): - r = re.search('//(.+?)/embed-(.+?)\.', url) - if r: - return r.groups() - else: - return False - - - def valid_url(self, url, host): - return 'mp4upload.com' in url or self.name in host + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + link = ''.join(link.splitlines()).replace('\t', '') + videoUrl = re.compile('\'file\': \'(.+?)\'').findall(link)[0] + return videoUrl + + def get_url(self, host, media_id): + return 'http://www.mp4upload.com/embed-%s.html' % media_id + + def get_host_and_id(self, url): + r = re.search('//(.+?)/embed-(.+?)\.', url) + if r: + return r.groups() + else: + return False + + def valid_url(self, url, host): + return 'mp4upload.com' in url or self.name in host diff --git a/lib/urlresolver/plugins/mrfile.py b/lib/urlresolver/plugins/mrfile.py index 5b85f396..c330c09d 100644 --- a/lib/urlresolver/plugins/mrfile.py +++ b/lib/urlresolver/plugins/mrfile.py @@ -20,17 +20,13 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2 from urlresolver import common import re -import os - -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class mrfileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mrfile" - domains = [ "mrfile.me" ] + domains = ["mrfile.me"] def __init__(self): p = self.get_setting('priority') or 100 @@ -39,25 +35,13 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - html = self.net.http_GET(web_url).content - if re.search('File was deleted',html): - raise Exception ('File Not Found or removed') - r = re.search("file: '([^']+)'",html) - if not r: - raise Exception ('Unable to resolve mrfile link. Filelink not found.') - return r.group(1) - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg='Exception: %s' % e) - except Exception, e: - common.addon.log('**** mrfile Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]mrfile[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' - % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg='Exception: %s' % e) + html = self.net.http_GET(web_url).content + if re.search('File was deleted', html): + raise UrlResolver.ResolverError('File Not Found or removed') + r = re.search("file: '([^']+)'", html) + if not r: + raise UrlResolver.ResolverError('Unable to resolve mrfile link. Filelink not found.') + return r.group(1) def get_url(self, host, media_id): return 'http://www.mrfile.me/embed-%s.html' % (media_id) @@ -73,8 +57,5 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): return re.match('http://(www.)?mrfile.me/[0-9A-Za-z]+', url) or 'mrfile' in host - - diff --git a/lib/urlresolver/plugins/muchshare.py b/lib/urlresolver/plugins/muchshare.py index 460f5321..c8779231 100644 --- a/lib/urlresolver/plugins/muchshare.py +++ b/lib/urlresolver/plugins/muchshare.py @@ -23,12 +23,10 @@ import re, urllib2 from urlresolver import common -net = Net() - class MuchshareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "muchshare" - domains = [ "muchshare.net" ] + domains = ["muchshare.net"] def __init__(self): p = self.get_setting('priority') or 100 @@ -36,33 +34,27 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - url = self.get_url(host, media_id) - html = self.net.http_GET(url).content - - err = re.compile('

(.+?)
').findall(html) - if err: - raise Exception (str(err)) - - data = {} - r = re.findall(r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - data.update({'down_direct':1}) - - common.addon.show_countdown(45, title='Muchshare', text='Loading Video...') - html = net.http_POST(url, data).content - r = re.search("(?:.+var file_link = \'|.+\)", html).group(1) - urllib2.unquote(r) - return r + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + + err = re.compile('

(.+?)
').findall(html) + if err: + raise UrlResolver.ResolverError(str(err)) - except Exception, e: - common.addon.log('**** Muchshare Error occured: %s' % e) - common.addon.show_small_popup('Error', str(e), 5000, '') - return self.unresolvable(code=0, msg=e) + data = {} + r = re.findall(r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value + data.update({'down_direct': 1}) + + common.addon.show_countdown(45, title='Muchshare', text='Loading Video...') + html = self.net.http_POST(url, data).content + r = re.search("(?:.+var file_link = \'|.+\
)", html).group(1) + r = urllib2.unquote(r) + return r def get_url(self, host, media_id): - return 'http://muchshare.net/%s' % media_id + return 'http://muchshare.net/%s' % media_id def get_host_and_id(self, url): r = re.search('//(.+?)/([0-9a-zA-Z]+)',url) diff --git a/lib/urlresolver/plugins/nosvideo.py b/lib/urlresolver/plugins/nosvideo.py index fe4cfe4d..c050e23a 100644 --- a/lib/urlresolver/plugins/nosvideo.py +++ b/lib/urlresolver/plugins/nosvideo.py @@ -20,15 +20,10 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os +import re from urlresolver import common from lib import jsunpack -# SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -net = Net() - class NosvideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "nosvideo" @@ -40,48 +35,38 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - code = 0 - try: - url = self.get_url(host, media_id) - print url - html = self.net.http_GET(url).content - if 'File Not Found' in html: - code = 1 - raise Exception('File Not Found') + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + if 'File Not Found' in html: + raise UrlResolver.ResolverError('File Not Found') - headers = { - 'Referer': url - } + headers = { + 'Referer': url + } - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="(.+?)"', html) - for name, value in r: - data[name] = value - data.update({'method_free': 'Free Download'}) - print data + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="(.+?)"', html) + for name, value in r: + data[name] = value + data.update({'method_free': 'Free Download'}) - html = net.http_POST(url, data, headers=headers).content + html = self.net.http_POST(url, data, headers=headers).content - r = re.search('(eval\(function\(p,a,c,k,e,[dr].*)', html) + r = re.search('(eval\(function\(p,a,c,k,e,[dr].*)', html) + if r: + js = jsunpack.unpack(r.group(1)) + r = re.search('playlist=(.*)&config=', js) if r: - js = jsunpack.unpack(r.group(1)) - r = re.search('playlist=(.*)&config=', js) + html = self.net.http_GET(r.group(1)).content + r = re.search('\s*(.*)\s*', html) if r: - html = self.net.http_GET(r.group(1)).content - r = re.search('\s*(.*)\s*', html) - if r: - return r.group(1) - else: - raise Exception('Unable to locate video file') + return r.group(1) else: - raise Exception('Unable to locate playlist') + raise UrlResolver.ResolverError('Unable to locate video file') else: - raise Exception('Unable to locate packed data') - - except Exception, e: - common.addon.log('**** Nosvideo Error occured: %s' % e) - common.addon.show_small_popup('*** Nosvideo Error occured ***', str(e), 5000, '') - return self.unresolvable(code=code, msg='Exception: %s' % e) + raise UrlResolver.ResolverError('Unable to locate playlist') + else: + raise UrlResolver.ResolverError('Unable to locate packed data') def get_url(self, host, media_id): return 'http://nosvideo.com/?v=%s' % media_id @@ -94,7 +79,6 @@ def get_host_and_id(self, url): return False return('host', 'media_id') - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?nosvideo.com/' + diff --git a/lib/urlresolver/plugins/novamov.py b/lib/urlresolver/plugins/novamov.py index dfca7d04..53f30d63 100644 --- a/lib/urlresolver/plugins/novamov.py +++ b/lib/urlresolver/plugins/novamov.py @@ -16,7 +16,7 @@ along with this program. If not, see . """ -import re, urllib, urllib2, os +import re, urllib from t0mm0.common.net import Net from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver @@ -24,9 +24,6 @@ from urlresolver.plugnplay import Plugin from lib import unwise -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class NovamovResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "novamov" @@ -39,33 +36,23 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - #find key - try: - html = self.net.http_GET(web_url).content - html = unwise.unwise_process(html) - filekey = unwise.resolve_var(html, "flashvars.filekey") - - #get stream url from api - api = 'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filekey, media_id) - html = self.net.http_GET(api).content - r = re.search('url=(.+?)&title', html) + html = self.net.http_GET(web_url).content + html = unwise.unwise_process(html) + filekey = unwise.resolve_var(html, "flashvars.filekey") + + #get stream url from api + api = 'http://www.novamov.com/api/player.api.php?key=%s&file=%s' % (filekey, media_id) + html = self.net.http_GET(api).content + r = re.search('url=(.+?)&title', html) + if r: + stream_url = urllib.unquote(r.group(1)) + else: + r = re.search('file no longer exists', html) if r: - stream_url = urllib.unquote(r.group(1)) - else: - r = re.search('file no longer exists',html) - if r: - raise Exception ('File Not Found or removed') - raise Exception ('Failed to parse url') - - return stream_url - except urllib2.URLError, e: - common.addon.log_error('Novamov: got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** Novamov Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]NOVAMOV[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + raise UrlResolver.ResolverError('File Not Found or removed') + raise UrlResolver.ResolverError('Failed to parse url') + + return stream_url def get_url(self, host, media_id): return 'http://www.novamov.com/video/%s' % media_id diff --git a/lib/urlresolver/plugins/nowvideo.py b/lib/urlresolver/plugins/nowvideo.py index d65b76e4..9fd86c40 100644 --- a/lib/urlresolver/plugins/nowvideo.py +++ b/lib/urlresolver/plugins/nowvideo.py @@ -36,50 +36,42 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - html = self.net.http_GET(web_url).content - key = re.compile('flashvars.filekey=(.+?);').findall(html) - ip_key = key[0] - pattern = 'var %s="(.+?)".+?flashvars.file="(.+?)"' % str(ip_key) - r = re.search(pattern, html, re.DOTALL) + html = self.net.http_GET(web_url).content + key = re.compile('flashvars.filekey=(.+?);').findall(html) + ip_key = key[0] + pattern = 'var %s="(.+?)".+?flashvars.file="(.+?)"' % str(ip_key) + r = re.search(pattern, html, re.DOTALL) + if r: + filekey, filename = r.groups() + else: + r = re.search('file no longer exists', html) if r: - filekey, filename = r.groups() - else: - r = re.search('file no longer exists', html) - if r: - raise Exception('File Not Found or removed') - - #get stream url from api - api = 'http://www.nowvideo.sx/api/player.api.php?key=%s&file=%s' % (filekey, filename) + raise UrlResolver.ResolverError('File Not Found or removed') + + #get stream url from api + api = 'http://www.nowvideo.sx/api/player.api.php?key=%s&file=%s' % (filekey, filename) + html = self.net.http_GET(api).content + r = re.search('url=(.+?)&title', html) + if r: + stream_url = urllib.unquote(r.group(1)) + else: + r = re.search('no longer exists', html) + if r: + raise UrlResolver.ResolverError('File Not Found or removed') + raise UrlResolver.ResolverError('Failed to parse url') + + try: + # test the url, should throw 404 + self.net.http_HEAD(stream_url) + except urllib2.HTTPError: + # if error 404, redirect it back (two pass authentification) + api = 'http://www.nowvideo.sx/api/player.api.php?pass=undefined&cid3=undefined&key=%s&user=undefined&numOfErrors=1&errorUrl=%s&cid=1&file=%s&cid2=undefined&errorCode=404' % (filekey, urllib.quote_plus(stream_url), filename) html = self.net.http_GET(api).content r = re.search('url=(.+?)&title', html) if r: stream_url = urllib.unquote(r.group(1)) - else: - r = re.search('no longer exists', html) - if r: - raise Exception('File Not Found or removed') - raise Exception('Failed to parse url') - try: - # test the url, should throw 404 - nv_header = self.net.http_HEAD(stream_url) - except urllib2.HTTPError, e: - # if error 404, redirect it back (two pass authentification) - api = 'http://www.nowvideo.sx/api/player.api.php?pass=undefined&cid3=undefined&key=%s&user=undefined&numOfErrors=1&errorUrl=%s&cid=1&file=%s&cid2=undefined&errorCode=404' % (filekey, urllib.quote_plus(stream_url), filename) - html = self.net.http_GET(api).content - r = re.search('url=(.+?)&title', html) - if r: - stream_url = urllib.unquote(r.group(1)) - - return stream_url - except urllib2.HTTPError, e: - common.addon.log_error('Nowvideo: got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** Nowvideo Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + return stream_url def get_url(self, host, media_id): return 'http://embed.nowvideo.sx/embed.php?v=%s' % media_id diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py index 13a05711..6f8abfd1 100644 --- a/lib/urlresolver/plugins/play44_net.py +++ b/lib/urlresolver/plugins/play44_net.py @@ -20,14 +20,14 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 +import urllib from urlresolver import common import re class FilenukeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "play44.net" - domains = [ "play44.net" ] + domains = ["play44.net"] def __init__(self): p = self.get_setting('priority') or 100 @@ -51,20 +51,11 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name - common.addon.log(media_id) - common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + resp = self.net.http_GET(web_url) + html = resp.content r = re.search("playlist:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*'(.+?)'", html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url diff --git a/lib/urlresolver/plugins/played.py b/lib/urlresolver/plugins/played.py index 8dae4172..1e3b819a 100644 --- a/lib/urlresolver/plugins/played.py +++ b/lib/urlresolver/plugins/played.py @@ -10,50 +10,43 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import urllib2,xbmcgui,re,os,xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo=os.path.join(common.addon_path,'resources','images','redx.png') - -class playedResolver(Plugin,UrlResolver,PluginSettings): - implements=[UrlResolver,PluginSettings] - name="played" - domains=[ "played.to" ] +class PlayedResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "played" + domains = ["played.to"] def __init__(self): - p=self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - def get_media_url(self,host,media_id): - web_url=self.get_url(host,media_id) - try: - data={}; html=self.net.http_GET(web_url,{'host':'played.to'}).content - r=re.findall(r'. ''' -import os -import xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2, urllib from urlresolver import common import xml.etree.ElementTree as ET -logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class PlaywireResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "playwire" - domains = [ "playwire.com" ] + domains = ["playwire.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -40,36 +35,25 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - - if web_url.endswith('xml'): # xml source - root = ET.fromstring(link) - stream = root.find('src') - if stream is not None: - return stream.text - else: - accessdenied = root.find('Message') - if accessdenied is not None: - err_title = 'Access Denied' - err_message = 'You do not have permission to view this content' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) - - return self.unresolvable(0, 'No playable video found.') - else: # json source - r = re.search('"src":"(.+?)"',link) - if r: - return r.group(1) - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + if web_url.endswith('xml'): # xml source + root = ET.fromstring(link) + stream = root.find('src') + if stream is not None: + return stream.text + else: + accessdenied = root.find('Message') + if accessdenied is not None: + raise UrlResolver.ResolverError('You do not have permission to view this content') + raise UrlResolver.ResolverError('No playable video found.') + else: # json source + r = re.search('"src":"(.+?)"', link) + if r: + return r.group(1) + else: + raise UrlResolver.ResolverError('No playable video found.') def get_url(self, host, media_id): if not 'v2' in host: diff --git a/lib/urlresolver/plugins/premiumize_me.py b/lib/urlresolver/plugins/premiumize_me.py index bf1e7066..9b8d5672 100644 --- a/lib/urlresolver/plugins/premiumize_me.py +++ b/lib/urlresolver/plugins/premiumize_me.py @@ -45,24 +45,20 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): - try: - username = self.get_setting('username') - password = self.get_setting('password') - url = 'https://api.premiumize.me/pm-api/v1.php?' - query = urllib.urlencode({'method': 'directdownloadlink', 'params[login]': username, 'params[pass]': password, 'params[link]': media_id}) - url = url + query - response = self.net.http_GET(url).content - response = json.loads(response) - if 'status' in response: - if response['status'] == 200: - link = response['result']['location'] - else: - raise Exception('Link Not Found: Error Code: %s' % response['status']) + username = self.get_setting('username') + password = self.get_setting('password') + url = 'https://api.premiumize.me/pm-api/v1.php?' + query = urllib.urlencode({'method': 'directdownloadlink', 'params[login]': username, 'params[pass]': password, 'params[link]': media_id}) + url = url + query + response = self.net.http_GET(url).content + response = json.loads(response) + if 'status' in response: + if response['status'] == 200: + link = response['result']['location'] else: - raise Exception('Unexpected Response Received') - except Exception, e: - common.addon.log_error('**** Premiumize Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + raise UrlResolver.ResolverError('Link Not Found: Error Code: %s' % response['status']) + else: + raise UrlResolver.ResolverError('Unexpected Response Received') common.addon.log_debug('Premiumize.me: Resolved to %s' % link) return link diff --git a/lib/urlresolver/plugins/primeshare.py b/lib/urlresolver/plugins/primeshare.py index 9c9b84cb..246222af 100644 --- a/lib/urlresolver/plugins/primeshare.py +++ b/lib/urlresolver/plugins/primeshare.py @@ -16,22 +16,19 @@ along with this program. If not, see . """ +import re +import os from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2 from urlresolver import common from lib import jsunpack -import re -import os - -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class PrimeshareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "primeshare" - domains = [ "primeshare.tv" ] + domains = ["primeshare.tv"] profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'primeshare.cookies') @@ -39,39 +36,24 @@ def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - html = self.net.http_GET(web_url).content - if re.search('>File not exist<',html): - msg = 'File Not Found or removed' - common.addon.show_small_popup(title='[B][COLOR white]PRIMESHARE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' - % msg, delay=5000, image=error_logo) - return self.unresolvable(code = 1, msg = msg) - self.net.save_cookies(self.cookie_file) - headers = {'Referer':web_url} - # wait required - common.addon.show_countdown(8) - self.net.set_cookies(self.cookie_file) - html = self.net.http_POST(web_url, form_data={'hash':media_id}, headers = headers).content - r = re.compile("clip:.*?url: '([^']+)'",re.DOTALL).findall(html) - if not r: - r = re.compile("download\('([^']+)'",re.DOTALL).findall(html) - if not r: - raise Exception ('Unable to resolve Primeshare link. Filelink not found.') - return r[0] - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg='Exception: %s' % e) - except Exception, e: - common.addon.log('**** Primeshare Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]PRIMESHARE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg='Exception: %s' % e) + html = self.net.http_GET(web_url).content + if re.search('>File not exist<', html): + raise UrlResolver.ResolverError('File Not Found or removed') + self.net.save_cookies(self.cookie_file) + headers = {'Referer': web_url} + # wait required + common.addon.show_countdown(8) + self.net.set_cookies(self.cookie_file) + html = self.net.http_POST(web_url, form_data={'hash': media_id}, headers=headers).content + r = re.compile("clip:.*?url: '([^']+)'", re.DOTALL).findall(html) + if not r: + r = re.compile("download\('([^']+)'", re.DOTALL).findall(html) + if not r: + raise UrlResolver.ResolverError('Unable to resolve Primeshare link. Filelink not found.') + return r[0] def get_url(self, host, media_id): return 'http://primeshare.tv/download/%s' % (media_id) @@ -86,8 +68,6 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): return re.match('http://(www.)?primeshare.tv/download/[0-9A-Za-z]+', url) or 'primeshare' in host diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index 1fa25cc7..8c486c64 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -15,21 +15,17 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' - +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, urllib2, os, xbmcgui from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class PromptfileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "promptfile" - domains = [ "promptfile.com" ] + domains = ["promptfile.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -38,30 +34,17 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - try: - html = self.net.http_GET(web_url).content - data = {} - r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) - for name, value in r: - data[name] = value - html = self.net.http_POST(web_url, data).content - html = re.compile(r'clip\s*:\s*\{.*?url\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html) - if not html: - raise Exception ('File Not Found or removed') - stream_url = html.group(1) - return stream_url - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** Promptfile Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]PROMPTFILE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + html = self.net.http_GET(web_url).content + data = {} + r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) + for name, value in r: + data[name] = value + html = self.net.http_POST(web_url, data).content + html = re.compile(r'clip\s*:\s*\{.*?url\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html) + if not html: + raise UrlResolver.ResolverError('File Not Found or removed') + stream_url = html.group(1) + return stream_url def get_url(self, host, media_id): return 'http://www.promptfile.com/%s' % (media_id) diff --git a/lib/urlresolver/plugins/purevid.py b/lib/urlresolver/plugins/purevid.py index d623e2b3..8041a286 100644 --- a/lib/urlresolver/plugins/purevid.py +++ b/lib/urlresolver/plugins/purevid.py @@ -18,12 +18,8 @@ """ import os -import random import re -import urllib, urllib2 -import ast -import xbmc,xbmcplugin,xbmcgui,xbmcaddon,time,datetime -import cookielib +import urllib import json from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver @@ -32,20 +28,17 @@ from urlresolver.plugnplay import Plugin from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class purevid(Plugin, UrlResolver, SiteAuth, PluginSettings): - implements = [UrlResolver, SiteAuth, PluginSettings] - name = "purevid" - domains = [ "purevid.com" ] - profile_path = common.profile_path - cookie_file = os.path.join(profile_path, '%s.cookies' % name) + implements = [UrlResolver, SiteAuth, PluginSettings] + name = "purevid" + domains = ["purevid.com"] + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, '%s.cookies' % name) def __init__(self): - p = self.get_setting('priority') or 1 + p = self.get_setting('priority') or 1 self.priority = int(p) - self.net = Net() + self.net = Net() try: os.makedirs(os.path.dirname(self.cookie_file)) except OSError: @@ -53,31 +46,23 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): - try : - web_url = self.get_url(host, media_id) - try: - html = self.net.http_GET(web_url).content - except urllib2.URLError, e: - raise Exception ('got http error %d fetching %s' % (e.code, web_url)) - data = json.loads(html) - if self.get_setting('quality') == '0' : - url = data['clip']['bitrates'][0]['url'] - else : - url = data['clip']['bitrates'][-1]['url'] - params = '' - for val in data['plugins']['lighttpd']['params'] : - params += val['name'] + '=' + val['value'] + '&' - url = url + '?' + params[:-1] - cookies = {} - for cookie in self.net._cj: - cookies[cookie.name] = cookie.value - url = url + '|' + urllib.urlencode({'Cookie' :urllib.urlencode(cookies)}) - common.addon.log(url) - return url - except Exception, e: - common.addon.log('**** Purevid Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]PUREVID[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + data = json.loads(html) + if self.get_setting('quality') == '0': + url = data['clip']['bitrates'][0]['url'] + else: + url = data['clip']['bitrates'][-1]['url'] + params = '' + for val in data['plugins']['lighttpd']['params']: + params += val['name'] + '=' + val['value'] + '&' + url = url + '?' + params[:-1] + cookies = {} + for cookie in self.net._cj: + cookies[cookie.name] = cookie.value + url = url + '|' + urllib.urlencode({'Cookie': urllib.urlencode(cookies)}) + common.addon.log_debug(url) + return url def get_url(self, host, media_id): return 'http://www.purevid.com/?m=video_info_embed_flv&id=%s' % media_id diff --git a/lib/urlresolver/plugins/putlocker.py b/lib/urlresolver/plugins/putlocker.py index a7f27226..d59e5765 100644 --- a/lib/urlresolver/plugins/putlocker.py +++ b/lib/urlresolver/plugins/putlocker.py @@ -30,9 +30,6 @@ from threading import Thread import time -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class PutlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "putlocker" @@ -51,165 +48,152 @@ def get_media_url(self, host, media_id): self.login() self.net.set_cookies(self.cookie_file) web_url = self.get_url(host, media_id) - if web_url[-1:1]=="#": web_url.replace("#",""); + if web_url[-1:1] == "#": web_url.replace("#", ""); - #find session_hash - try: - html = self.net.http_GET(web_url).content - if ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") - elif "This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": This file might have been moved, replaced or deleted.") - #Shortcut for logged in users - pattern = 'Download File' - link = re.search(pattern, html) - if link: - common.addon.log('Direct link found: %s' % link.group(1)) - if 'putlocker' in host: - return 'http://www.filedrive.com%s' % link.group(1) - #return 'http://www.putlocker.com%s' % link.group(1) - elif 'filedrive' in host: - return 'http://www.filedrive.com%s' % link.group(1) - elif 'firedrive' in host: - return 'http://www.firedrive.com%s' % link.group(1) + # find session_hash + html = self.net.http_GET(web_url).content + if ">This file doesn't exist, or has been removed.<" in html: raise Exception (host + ": This file doesn't exist, or has been removed.") + elif "This file might have been moved, replaced or deleted.<" in html: raise Exception (host + ": This file might have been moved, replaced or deleted.") + # Shortcut for logged in users + pattern = 'Download File' + link = re.search(pattern, html) + if link: + common.addon.log('Direct link found: %s' % link.group(1)) + if 'putlocker' in host: + return 'http://www.filedrive.com%s' % link.group(1) + # return 'http://www.putlocker.com%s' % link.group(1) + elif 'filedrive' in host: + return 'http://www.filedrive.com%s' % link.group(1) + elif 'firedrive' in host: + return 'http://www.firedrive.com%s' % link.group(1) - if ('firedrive' in host) or ('filedrive' in host) or ('putlocker' in host): - try: - data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); #data['usr_login']='' - for name, value in r: data[name] = value - #data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' - #xbmc.sleep(2000) - html = self.net.http_POST(web_url, data).content - except urllib2.URLError, e: - common.addon.log_error(host+': got http error %d fetching 2nd url %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False - if "file: '" in html: - r = re.search("file\s*:\s*'(.+?)'", html) - if r: return urllib.unquote_plus(r.group(1)) - if '" target="_blank" '+"id='top_external_download' title='Download This File'>" in html: - r = re.search('", html) - if r: return urllib.unquote_plus(r.group(1)) - if "id='external_download' title='Download This File'>" in html: - r = re.search('', html) - if r: return urllib.unquote_plus(r.group(1)) - if "", html) - if r: return urllib.unquote_plus(r.group(1)) - #if r: - # return urllib.unquote_plus(r.group(1)) - #else: - # common.addon.log_error(host+': stream url not found') - # return self.unresolvable(code=0, msg='no file located') #return False - r = re.search("$.post('(.+?)', function(data) {", html) - if r: - return urllib.unquote_plus(r.group(1)) - else: - common.addon.log_error(host+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + if ('firedrive' in host) or ('filedrive' in host) or ('putlocker' in host): + try: + data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"/>', html); # data['usr_login']='' + for name, value in r: data[name] = value + # data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' + # xbmc.sleep(2000) + html = self.net.http_POST(web_url, data).content + except urllib2.URLError, e: + common.addon.log_error(host + ': got http error %d fetching 2nd url %s' % (e.code, web_url)) + return self.unresolvable(code=3, msg='Exception: %s' % e) # return False + if "file: '" in html: + r = re.search("file\s*:\s*'(.+?)'", html) + if r: return urllib.unquote_plus(r.group(1)) + if '" target="_blank" ' + "id='top_external_download' title='Download This File'>" in html: + r = re.search('", html) + if r: return urllib.unquote_plus(r.group(1)) + if "id='external_download' title='Download This File'>" in html: + r = re.search('', html) + if r: return urllib.unquote_plus(r.group(1)) + if "", html) + if r: return urllib.unquote_plus(r.group(1)) + # if r: + # return urllib.unquote_plus(r.group(1)) + # else: + # common.addon.log_error(host+': stream url not found') + # return self.unresolvable(code=0, msg='no file located') #return False + r = re.search("$.post('(.+?)', function(data) {", html) + if r: + return urllib.unquote_plus(r.group(1)) else: - r = re.search('value="([0-9a-f]+?)" name="hash"', html) - if r: - session_hash = r.group(1) - else: - raise Exception ('putlocker: session hash not found') - #post session_hash - html = self.net.http_POST(web_url, form_data={'hash': session_hash, - 'confirm': 'Continue as Free User'}).content - - #find playlist code - r = re.search('\?stream=(.+?)\'', html) + common.addon.log_error(host + ': stream url not found') + return self.unresolvable(code=0, msg='no file located') # return False + else: + r = re.search('value="([0-9a-f]+?)" name="hash"', html) if r: - playlist_code = r.group(1) + session_hash = r.group(1) else: - r = re.search('key=(.+?)&',html) - playlist_code = r.group(1) - - #find download link - q = self.get_setting('quality') - - #Try to grab highest quality link available - if q == '1': - #download & return link. - if 'putlocker' in host: - Avi = "http://putlocker.com/get_file.php?stream=%s&original=1"%playlist_code - html = self.net.http_GET(Avi).content - final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') - return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - elif 'filedrive' in host: - Avi = "http://filedrive.com/get_file.php?stream=%s&original=1"%playlist_code - html = self.net.http_GET(Avi).content - final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') - return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - elif 'firedrive' in host: - Avi = "http://firedrive.com/get_file.php?stream=%s&original=1"%playlist_code - html = self.net.http_GET(Avi).content - final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') - return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + raise Exception ('putlocker: session hash not found') + # post session_hash + html = self.net.http_POST(web_url, form_data={'hash': session_hash, + 'confirm': 'Continue as Free User'}).content + # find playlist code + r = re.search('\?stream=(.+?)\'', html) + if r: + playlist_code = r.group(1) + else: + r = re.search('key=(.+?)&', html) + playlist_code = r.group(1) - #Else grab standard flv link - else: - xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) - xml_url += playlist_code - html = self.net.http_GET(xml_url).content + # find download link + q = self.get_setting('quality') + + # Try to grab highest quality link available + if q == '1': + # download & return link. + if 'putlocker' in host: + Avi = "http://putlocker.com/get_file.php?stream=%s&original=1" % playlist_code + html = self.net.http_GET(Avi).content + final = re.compile('url="(.+?)"').findall(html)[0].replace('&', '&') + return "%s|User-Agent=%s" % (final, 'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + elif 'filedrive' in host: + Avi = "http://filedrive.com/get_file.php?stream=%s&original=1" % playlist_code + html = self.net.http_GET(Avi).content + final = re.compile('url="(.+?)"').findall(html)[0].replace('&', '&') + return "%s|User-Agent=%s" % (final, 'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + elif 'firedrive' in host: + Avi = "http://firedrive.com/get_file.php?stream=%s&original=1" % playlist_code + html = self.net.http_GET(Avi).content + final = re.compile('url="(.+?)"').findall(html)[0].replace('&', '&') + return "%s|User-Agent=%s" % (final, 'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - r = re.search('url="(.+?)"', html) - if r: - flv_url = r.group(1) - else: - raise Exception ('putlocker: stream url not found') - return "%s|User-Agent=%s"%(flv_url.replace('&','&'),'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + # Else grab standard flv link + else: + xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) + xml_url += playlist_code + html = self.net.http_GET(xml_url).content - except urllib2.URLError, e: - common.addon.log_error('Putlocker: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** Putlocker Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]PUTLOCKER[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + r = re.search('url="(.+?)"', html) + if r: + flv_url = r.group(1) + else: + raise Exception ('putlocker: stream url not found') + return "%s|User-Agent=%s" % (flv_url.replace('&', '&'), 'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') def get_url(self, host, media_id): if 'putlocker' in host: host = 'www.putlocker.com' host = 'www.firedrive.com' - media_id=media_id.replace("#",""); + media_id = media_id.replace("#", ""); elif 'filedrive' in host: host = 'www.filedrive.com' elif 'firedrive' in host: host = 'www.firedrive.com' else: host = 'www.firedrive.com' - media_id=media_id.replace("#",""); + media_id = media_id.replace("#", ""); return 'http://%s/file/%s' % (host, media_id) - - + + def get_host_and_id(self, url): r = re.search('//(.+?)/(?:file|embed)/([0-9A-Z]+)', 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('http://(?:www.)?(putlocker|filedrive|firedrive)?\.com/' + '(file|embed)?/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host or 'filedrive' in host or 'firedrive' in host) + return (re.match('http://(?:www.)?(putlocker|filedrive|firedrive)?\.com/' + '(file|embed)?/[0-9A-Z]+', url) or 'putlocker' in host or 'sockshare' in host or 'filedrive' in host or 'firedrive' in host) def login_stale(self): url = 'http://www.putlocker.com/cp.php' if not os.path.exists(self.cookie_file): return True self.net.set_cookies(self.cookie_file) - source = self.net.http_GET(url).content + source = self.net.http_GET(url).content if re.search('(?:\( Pro \)|\( Free \))', source): common.addon.log('Putlocker account appears to be logged in.') return False else: return True - #SiteAuth methods + # SiteAuth methods def login(self): if self.login_stale(): url = 'http://www.putlocker.com/authenticate.php?login' @@ -217,15 +201,15 @@ def login(self): self.net.save_cookies(self.cookie_file) self.net.set_cookies(self.cookie_file) captcha_img = re.search('CAPTCHA.+?
', source, re.DOTALL).group(1) - captcha_img = 'http://www.putlocker.com%s' %re.sub('&','&',captcha_img) - local_captcha = os.path.join(common.profile_path, "captcha.img" ) + captcha_img = 'http://www.putlocker.com%s' % re.sub('&', '&', captcha_img) + local_captcha = os.path.join(common.profile_path, "captcha.img") localFile = open(local_captcha, "wb") localFile.write(self.net.http_GET(captcha_img).content) localFile.close() solver = InputWindow(captcha=local_captcha) solution = solver.get() if solution: - common.addon.log('Solution provided: %s' %solution) + common.addon.log('Solution provided: %s' % solution) data = {'user':self.get_setting('username'), 'pass':self.get_setting('password'), 'captcha_code':solution, 'remember':1, 'login_submit':'Login'} response = self.net.http_POST(url, form_data=data) self.net.save_cookies(self.cookie_file) @@ -238,12 +222,12 @@ def login(self): if re.search('OK', source): self.net.save_cookies(self.cookie_file) self.net.set_cookies(self.cookie_file) - xbmc.executebuiltin("Notification(' Putlocker Pro ', ' Login successful')") + xbmc.executebuiltin("Notification(' Putlocker Pro ', ' Login successful')") return True else: return False else: return True - #PluginSettings methods + # PluginSettings methods def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '. """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2 from urlresolver import common -# Custom imports -import re - - -class RapidvideoResolver(Plugin, UrlResolver, PluginSettings): +class RapidVideoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "rapidvideo" domains = [ "rapidvideo.com" ] @@ -39,27 +35,12 @@ def __init__(self): #e.g. http://rapidvideo.com/view/hwksai28 self.pattern = 'http://((?:www.)?rapidvideo.com)/view/([0-9a-zA-Z]+)' - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - try: - html = self.net.http_GET(web_url).content - - # get stream url - sPattern = "so.addVariable\(\s*'file'\s*,\s*'([^']+)'\s*\)" - return re.search(sPattern, html).group(1) - - except urllib2.URLError, e: - common.addon.log_error('Rapidvideo: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** Rapidvideo Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]RAPIDVIDEO[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + html = self.net.http_GET(web_url).content + # get stream url + sPattern = "so.addVariable\(\s*'file'\s*,\s*'([^']+)'\s*\)" + return re.search(sPattern, html).group(1) def get_url(self, host, media_id): return 'http://rapidvideo.com/view/%s' % (media_id) @@ -71,7 +52,6 @@ def get_host_and_id(self, url): 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 diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index c44c7395..34c13656 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -16,26 +16,25 @@ along with this program. If not, see . """ -import os, sys +import os import re -import urllib, urllib2 - +import urllib +import xbmcgui from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import SiteAuth from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -import xbmc,xbmcplugin,xbmcgui,xbmcaddon from t0mm0.common.net import Net import simplejson as json -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO +# SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class RealDebridResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "realdebrid" - domains = [ "*" ] + domains = ["*"] profile_path = common.profile_path cookie_file = os.path.join(profile_path, '%s.cookies' % name) media_url = None @@ -51,45 +50,34 @@ def __init__(self): except OSError: pass - #UrlResolver methods + # UrlResolver methods def get_media_url(self, host, media_id): dialog = xbmcgui.Dialog() - try: - url = 'https://real-debrid.com/ajax/unrestrict.php?link=%s' % media_id.replace('|User-Agent=Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0','') - source = self.net.http_GET(url).content - jsonresult = json.loads(source) - if 'generated_links' in jsonresult : - generated_links = jsonresult['generated_links'] - if len(generated_links) == 1: - return generated_links[0][2].encode('utf-8') - line = [] - for link in generated_links : - extension = link[0].split('.')[-1] - line.append(extension.encode('utf-8')) - result = dialog.select('Choose the link', line) - if result != -1 : - link = generated_links[result][2] - return link.encode('utf-8') - else : - return self.unresolvable(0,'No generated_link') - elif 'main_link' in jsonresult : - return jsonresult['main_link'].encode('utf-8') - else : - if 'message' in jsonresult : - common.addon.log('**** Real Debrid Error occured: %s' % jsonresult['message'].encode('utf-8')) - common.addon.show_small_popup(title='[B][COLOR white]REAL-DEBRID[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % jsonresult['message'].encode('utf-8'), delay=15000, image=error_logo) - return self.unresolvable(0,jsonresult['message'].encode('utf-8')) - else : - return self.unresolvable(0,'No generated_link and no main_link') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % (str(e), url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(3,str(e)) - except Exception, e: - common.addon.log('**** Real Debrid Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]REAL-DEBRID[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(0,str(e)) - + url = 'https://real-debrid.com/ajax/unrestrict.php?link=%s' % media_id.replace('|User-Agent=Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0', '') + source = self.net.http_GET(url).content + jsonresult = json.loads(source) + if 'generated_links' in jsonresult: + generated_links = jsonresult['generated_links'] + if len(generated_links) == 1: + return generated_links[0][2].encode('utf-8') + line = [] + for link in generated_links: + extension = link[0].split('.')[-1] + line.append(extension.encode('utf-8')) + result = dialog.select('Choose the link', line) + if result != -1: + link = generated_links[result][2] + return link.encode('utf-8') + else: + raise UrlResolver.ResolverError('No generated_link') + elif 'main_link' in jsonresult: + return jsonresult['main_link'].encode('utf-8') + else: + if 'message' in jsonresult: + raise UrlResolver.ResolverError(jsonresult['message'].encode('utf-8')) + else: + raise UrlResolver.ResolverError('No generated_link and no main_link') + def get_url(self, host, media_id): return media_id @@ -98,14 +86,14 @@ def get_host_and_id(self, url): def get_all_hosters(self): if self.hosters is None: - try : + try: url = 'http://www.real-debrid.com/api/regex.php?type=all' response = self.net.http_GET(url).content.lstrip('/').rstrip('/g') delim = '/g,/|/g\|-\|/' self.hosters = [re.compile(host) for host in re.split(delim, response)] except: self.hosters = [] - common.addon.log_debug( 'RealDebrid hosters : %s' %self.hosters) + common.addon.log_debug('RealDebrid hosters : %s' % self.hosters) return self.hosters def get_hosts(self): @@ -117,17 +105,17 @@ def get_hosts(self): self.hosts = response.split('","') except: self.hosts = [] - common.addon.log_debug( 'RealDebrid hosts : %s' %self.hosts) - + common.addon.log_debug('RealDebrid hosts : %s' % self.hosts) + def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - if self.get_setting('login') == 'false': return False + if self.get_setting('login') == 'false': return False common.addon.log_debug('in valid_url %s : %s' % (url, host)) if url: self.get_all_hosters() - for host in self.hosters : - #common.addon.log_debug('RealDebrid checking host : %s' %str(host)) - if re.search(host,url): + for host in self.hosters: + # common.addon.log_debug('RealDebrid checking host : %s' %str(host)) + if re.search(host, url): common.addon.log_debug('RealDebrid Match found') return True elif host: @@ -149,14 +137,14 @@ def checkLogin(self): else: common.addon.log_debug('checkLogin returning True') return True - - #SiteAuth methods + + # SiteAuth methods def login(self): if self.checkLogin(): try: common.addon.log_debug('Need to login since session is invalid') import hashlib - login_data = urllib.urlencode({'user' : self.get_setting('username'), 'pass' : hashlib.md5(self.get_setting('password')).hexdigest()}) + login_data = urllib.urlencode({'user': self.get_setting('username'), 'pass': hashlib.md5(self.get_setting('password')).hexdigest()}) url = 'https://real-debrid.com/ajax/login.php?' + login_data source = self.net.http_GET(url).content if re.search('OK', source): @@ -172,7 +160,7 @@ def login(self): else: return True - #PluginSettings methods + # PluginSettings methods def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '. """ -import os -import xbmc from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin import re -import urllib2 from urlresolver import common -logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class RealvidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "Realvid" @@ -42,33 +37,22 @@ def get_url(self,host,media_id): return 'http://realvid.net/embed-%s-640x400.html' % (media_id) def get_host_and_id(self,url): - r=re.search(self.pattern,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 + 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): - try: - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - - if link.find('404 Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) - - video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) - - if len(video_link) > 0: - return video_link - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + if link.find('404 Not Found') >= 0: + raise UrlResolver.ResolverError('The requested video was not found.') + + video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) + if len(video_link) > 0: + return video_link + else: + raise UrlResolver.ResolverError('No playable video found.') diff --git a/lib/urlresolver/plugins/royalvids.py b/lib/urlresolver/plugins/royalvids.py index 0fd4bc1f..19077f32 100644 --- a/lib/urlresolver/plugins/royalvids.py +++ b/lib/urlresolver/plugins/royalvids.py @@ -16,60 +16,44 @@ along with this program. If not, see . """ -import os -import xbmc from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin import re -import urllib2 from urlresolver import common -logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class RoyalvidsResolver(Plugin, UrlResolver, PluginSettings): - implements=[UrlResolver,PluginSettings] - name='royalvids' - domains=[ 'royalvids.eu' ] + implements = [UrlResolver, PluginSettings] + name = 'royalvids' + domains = ['royalvids.eu'] def __init__(self): - p=self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - self.pattern='http://(?:www\.)?(royalvids\.eu)/(?:tt\/|e\.php\?.*id=)([0-9a-zA-Z]+)' - - def get_url(self,host,media_id): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://(?:www\.)?(royalvids\.eu)/(?:tt\/|e\.php\?.*id=)([0-9a-zA-Z]+)' + + def get_url(self, host, media_id): return 'http://www.royalvids.eu/e.php?id=%s&width=640&height=400' % (media_id) - def get_host_and_id(self,url): - r=re.search(self.pattern,url) + 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): - try: - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - - if link.find('File was deleted') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) - - video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) - - if len(video_link) > 0: - return video_link - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) + 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) + link = self.net.http_GET(web_url).content + if link.find('File was deleted') >= 0: + raise UrlResolver.ResolverError('The requested video was not found.') + + video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) + if len(video_link) > 0: + return video_link + else: + raise UrlResolver.ResolverError('No playable video found.') diff --git a/lib/urlresolver/plugins/rpnet.py b/lib/urlresolver/plugins/rpnet.py index 61784235..1ccaf102 100644 --- a/lib/urlresolver/plugins/rpnet.py +++ b/lib/urlresolver/plugins/rpnet.py @@ -16,9 +16,7 @@ along with this program. If not, see . """ -import os, sys import re - from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import SiteAuth from urlresolver.plugnplay.interfaces import PluginSettings @@ -46,18 +44,14 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): - try: - username = self.get_setting('username') - password = self.get_setting('password') - url = 'https://premium.rpnet.biz/client_api.php?' - url += 'username=%s&password=%s&action=generate&links=%s' - url = url %(username, password, media_id) - response = self.net.http_GET(url).content - response = json.loads(response) - return response['links'][0]['generated'] - except Exception, e: - common.addon.log_error('**** Rpnet Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + username = self.get_setting('username') + password = self.get_setting('password') + url = 'https://premium.rpnet.biz/client_api.php?' + url += 'username=%s&password=%s&action=generate&links=%s' + url = url % (username, password, media_id) + response = self.net.http_GET(url).content + response = json.loads(response) + return response['links'][0]['generated'] def get_url(self, host, media_id): return media_id @@ -77,7 +71,7 @@ def get_all_hosters(self): def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False - if self.get_setting('login') == 'false': return False + if self.get_setting('login') == 'false': return False for pattern in self.get_all_hosters(): if pattern.findall(url): return True diff --git a/lib/urlresolver/plugins/sharedsx.py b/lib/urlresolver/plugins/sharedsx.py index 62cb2089..f4b8a9c7 100644 --- a/lib/urlresolver/plugins/sharedsx.py +++ b/lib/urlresolver/plugins/sharedsx.py @@ -25,9 +25,6 @@ import re import os -# set error logo, thanks to VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - net = Net() class SharedsxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -40,45 +37,38 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - - # get landing page - html = self.net.http_GET(web_url, headers = {'Referer':web_url}).content - - # read POST variables into data - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) - if not r: raise Exception('page structure changed') - for name, value in r: data[name] = value - - # get delay from hoster; actually this is not needed, but we are polite - delay = 5 - r = re.search(r'var RequestWaiting = (\d+);', html) - if r: delay = r.groups(1)[0] - - # run countdown and check whether it was canceld or not - cnt = common.addon.show_countdown(int(delay), title='shared.sx', text='Please wait for hoster...') - if not cnt: raise Exception('countdown was canceld by user') - - # get video page using POST variables - html = self.net.http_POST(web_url, data, headers = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'})).content - - # search for content tag - r = re.search(r'class="stream-content" data-url', html) - if not r: raise Exception('page structure changed') - - # read the data-url - r = re.findall(r'data-url="?(.+?)"', html) - if not r: raise Exception('video not found') - - # return media URL - return r[0] + web_url = self.get_url(host, media_id) + # get landing page + html = self.net.http_GET(web_url, headers={'Referer': web_url}).content + + # read POST variables into data + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) + if not r: raise UrlResolver.ResolverError('page structure changed') + for name, value in r: data[name] = value + + # get delay from hoster; actually this is not needed, but we are polite + delay = 5 + r = re.search(r'var RequestWaiting = (\d+);', html) + if r: delay = r.groups(1)[0] + + # run countdown and check whether it was canceld or not + cnt = common.addon.show_countdown(int(delay), title='shared.sx', text='Please wait for hoster...') + if not cnt: raise UrlResolver.ResolverError('countdown was canceld by user') + + # get video page using POST variables + html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content + + # search for content tag + r = re.search(r'class="stream-content" data-url', html) + if not r: raise UrlResolver.ResolverError('page structure changed') + + # read the data-url + r = re.findall(r'data-url="?(.+?)"', html) + if not r: raise UrlResolver.ResolverError('video not found') - except Exception, e: - common.addon.log('sharedsx: general error occured: %s' % e) - common.addon.show_small_popup(title='shared.sx', msg='%s' % e, delay = 5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + # return media URL + return r[0] def get_url(self, host, media_id): return 'http://shared.sx/%s' % media_id diff --git a/lib/urlresolver/plugins/sharerepo.py b/lib/urlresolver/plugins/sharerepo.py index 8efa6831..d7372883 100644 --- a/lib/urlresolver/plugins/sharerepo.py +++ b/lib/urlresolver/plugins/sharerepo.py @@ -25,7 +25,7 @@ import urllib2 net = Net() -USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' +USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' class SharerepoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] @@ -38,37 +38,29 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - headers = { - 'User-Agent': USER_AGENT, - 'Referer': web_url - } + web_url = self.get_url(host, media_id) + headers = { + 'User-Agent': USER_AGENT, + 'Referer': web_url + } - try: + try: + html = self.net.http_GET(web_url, headers=headers).content + except urllib2.HTTPError as e: + if e.code == 404: + # sharerepo supports two different styles of links/media_ids + # if the first fails, try the second kind + web_url = 'http://sharerepo.com/%s' % media_id html = self.net.http_GET(web_url, headers=headers).content - except urllib2.HTTPError as e: - if e.code == 404: - # sharerepo supports two different styles of links/media_ids - # if the first fails, try the second kind - web_url = 'http://sharerepo.com/%s' % media_id - html = self.net.http_GET(web_url, headers=headers).content - else: - raise - - link = re.search("file\s*:\s*'([^']+)", html) - if link: - common.addon.log('ShareRepo Link Found: %s' % link.group(1)) - return link.group(1) + '|User-Agent=%s' % (USER_AGENT) else: - raise Exception('Unable to resolve ShareRepo Link') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('sharerepo: general error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + raise + + link = re.search("file\s*:\s*'([^']+)", html) + if link: + common.addon.log_debug('ShareRepo Link Found: %s' % link.group(1)) + return link.group(1) + '|User-Agent=%s' % (USER_AGENT) + else: + raise UrlResolver.ResolverError('Unable to resolve ShareRepo Link') def get_url(self, host, media_id): return 'http://sharerepo.com/f/%s' % media_id diff --git a/lib/urlresolver/plugins/sharesix.py b/lib/urlresolver/plugins/sharesix.py index 655f44f7..a9631abe 100644 --- a/lib/urlresolver/plugins/sharesix.py +++ b/lib/urlresolver/plugins/sharesix.py @@ -16,68 +16,52 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, urllib2, os, xbmcgui from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' +USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' class SharesixResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharesix" - domains = [ "sharesix.com" ] + domains = ["sharesix.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - try: - headers = { - 'User-Agent': USER_AGENT, - 'Referer': web_url - } - # Otherwise just use the original url to get the content. For sharesix - html = self.net.http_GET(web_url).content - - data = {} - r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) - for name, value in r: - data[name] = value - #data[u"method_premium"] = "Premium"; - data[u"method_free"] = "Free"; - data[u"op"] = "download1"; data[u"referer"] = web_url; data[u"usr_login"] = ""; - html = self.net.http_POST(web_url, data, headers=headers).content - - r = re.search("var\s+lnk1\s*=\s*'(.*?)'", html) - if r: - stream_url=r.group(1)+'|User-Agent=%s' % (USER_AGENT) - return stream_url - else: - raise Exception('Unable to locate link') - - if 'file you were looking for could not be found' in html: - raise Exception ('File Not Found or removed') - - except urllib2.HTTPError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** Sharesix Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]SHARESIX[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + headers = { + 'User-Agent': USER_AGENT, + 'Referer': web_url + } + # Otherwise just use the original url to get the content. For sharesix + html = self.net.http_GET(web_url).content + + data = {} + r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) + for name, value in r: + data[name] = value + #data[u"method_premium"] = "Premium" + data[u"method_free"] = "Free" + data[u"op"] = "download1"; data[u"referer"] = web_url; data[u"usr_login"] = "" + html = self.net.http_POST(web_url, data, headers=headers).content + + r = re.search("var\s+lnk1\s*=\s*'(.*?)'", html) + if r: + stream_url = r.group(1) + '|User-Agent=%s' % (USER_AGENT) + return stream_url + else: + raise UrlResolver.ResolverError('Unable to locate link') + + if 'file you were looking for could not be found' in html: + raise UrlResolver.ResolverError ('File Not Found or removed') def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) @@ -89,7 +73,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?sharesix.com/' + diff --git a/lib/urlresolver/plugins/sharevid.py b/lib/urlresolver/plugins/sharevid.py index cf617f05..db9b79b8 100644 --- a/lib/urlresolver/plugins/sharevid.py +++ b/lib/urlresolver/plugins/sharevid.py @@ -16,74 +16,50 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os -import xbmcgui from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -net = Net() - -class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): +class ShareVidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharevid" - domains = [ "sharevid.org" ] - + domains = ["sharevid.org"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): - try: - url = self.get_url(host, media_id) - html = self.net.http_GET(url).content - dialog = xbmcgui.DialogProgress() - dialog.create('Resolving', 'Resolving sharevid Link...') - dialog.update(0) - - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - - html = net.http_POST(url, data).content - dialog.update(50) + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value - r = re.search("file\s*:\s*'(.+?)'", html) - if r: - dialog.update(100) - dialog.close() - return r.group(1) - else: - dialog.close() - raise Exception('could not find video') - - except Exception, e: - common.addon.log('**** sharevid Error occured: %s' % e) - common.addon.show_small_popup('Error', str(e), 5000, '') - return self.unresolvable(code=0, msg='Exception: %s' % e) - + html = self.net.http_POST(url, data).content + r = re.search("file\s*:\s*'(.+?)'", html) + if r: + return r.group(1) + else: + raise UrlResolver.ResolverError('could not find video') + def get_url(self, host, media_id): - return 'http://sharevid.org/%s' % media_id + return 'http://sharevid.org/%s' % media_id - def get_host_and_id(self, url): - r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)',url) + r = re.search('//(.+?)/(?:embed-)?([0-9a-zA-Z]+)', url) if r: return r.groups() else: return False return('host', 'media_id') - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return (re.match('http://(www.)?sharevid.org/[0-9A-Za-z]+', url) or re.match('http://(www.)?sharevid.org/embed-[0-9A-Za-z]+[\-]*\d*[x]*\d*.*[html]*', url) or 'sharevid' in host) diff --git a/lib/urlresolver/plugins/sockshare.py b/lib/urlresolver/plugins/sockshare.py index e85448cc..7ea580b9 100644 --- a/lib/urlresolver/plugins/sockshare.py +++ b/lib/urlresolver/plugins/sockshare.py @@ -21,22 +21,16 @@ import xbmcgui import xbmc from t0mm0.common.net import Net -import urllib2 -import urllib from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -from threading import Thread import time -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class sockshareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sockshare" - domains = [ "sockshare.com" ] + domains = ["sockshare.com"] profile_path = common.profile_path cookie_file = os.path.join(profile_path, 'sockshare.cookies') @@ -52,75 +46,61 @@ def get_media_url(self, host, media_id): self.net.set_cookies(self.cookie_file) web_url = self.get_url(host, media_id) - #find session_hash - try: - html = self.net.http_GET(web_url).content - - if ">This file doesn't exist, or has been removed.<" in html: raise Exception (host+": This file doesn't exist, or has been removed.") - elif "This file might have been moved, replaced or deleted.<" in html: raise Exception (host+": 404: This file might have been moved, replaced or deleted.") - - #Shortcut for logged in users - pattern = '
Download File' - link = re.search(pattern, html) - if link: - common.addon.log('Direct link found: %s' % link.group(1)) - return 'http://www.sockshare.com%s' % link.group(1) - - r = re.search('value="([0-9a-f]+?)" name="hash"', html) - if r: - session_hash = r.group(1) - else: - raise Exception ('sockshare: session hash not found') + html = self.net.http_GET(web_url).content - #post session_hash - html = self.net.http_POST(web_url, form_data={'hash': session_hash, - 'confirm': 'Continue as Free User'}).content + if ">This file doesn't exist, or has been removed.<" in html: raise UrlResolver.ResolverError (host+": This file doesn't exist, or has been removed.") + elif "This file might have been moved, replaced or deleted.<" in html: raise UrlResolver.ResolverError (host+": 404: This file might have been moved, replaced or deleted.") - #find playlist code - r = re.search('\?stream=(.+?)\'', html) + #Shortcut for logged in users + pattern = 'Download File' + link = re.search(pattern, html) + if link: + common.addon.log_debug('Direct link found: %s' % link.group(1)) + return 'http://www.sockshare.com%s' % link.group(1) + + r = re.search('value="([0-9a-f]+?)" name="hash"', html) + if r: + session_hash = r.group(1) + else: + raise UrlResolver.ResolverError('sockshare: session hash not found') + + #post session_hash + html = self.net.http_POST(web_url, form_data={'hash': session_hash, + 'confirm': 'Continue as Free User'}).content + + #find playlist code + r = re.search('\?stream=(.+?)\'', html) + if r: + playlist_code = r.group(1) + else: + r = re.search('key=(.+?)&',html) + playlist_code = r.group(1) + + #find download link + q = self.get_setting('quality') + + #Try to grab highest quality link available + if q == '1': + #download & return link. + if 'sockshare' in host: + Avi = "http://sockshare.com/get_file.php?stream=%s&original=1"%playlist_code + html = self.net.http_GET(Avi).content + final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') + return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') + + #Else grab standard flv link + else: + xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) + xml_url += playlist_code + html = self.net.http_GET(xml_url).content + + r = re.search('url="(.+?)"', html) if r: - playlist_code = r.group(1) + flv_url = r.group(1) else: - r = re.search('key=(.+?)&',html) - playlist_code = r.group(1) - - #find download link - q = self.get_setting('quality') - - #Try to grab highest quality link available - if q == '1': - #download & return link. - if 'sockshare' in host: - Avi = "http://sockshare.com/get_file.php?stream=%s&original=1"%playlist_code - html = self.net.http_GET(Avi).content - final=re.compile('url="(.+?)"').findall(html)[0].replace('&','&') - return "%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - - #Else grab standard flv link - else: - xml_url = re.sub('/(file|embed)/.+', '/get_file.php?stream=', web_url) - xml_url += playlist_code - html = self.net.http_GET(xml_url).content - - r = re.search('url="(.+?)"', html) - if r: - flv_url = r.group(1) - else: - raise Exception ('sockshare: stream url not found') - - return "%s|User-Agent=%s"%(flv_url.replace('&','&'),'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') - - except urllib2.URLError, e: - common.addon.log_error('sockshare: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** sockshare Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]PUTLOCKER[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + raise UrlResolver.ResolverError('sockshare: stream url not found') + return "%s|User-Agent=%s"%(flv_url.replace('&','&'),'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0') def get_url(self, host, media_id): if 'sockshare' in host: diff --git a/lib/urlresolver/plugins/speedvideo.py b/lib/urlresolver/plugins/speedvideo.py index f1467d9c..ac06065f 100644 --- a/lib/urlresolver/plugins/speedvideo.py +++ b/lib/urlresolver/plugins/speedvideo.py @@ -16,92 +16,59 @@ along with this program. If not, see . ''' -import urllib,urllib2,os,re,xbmc,logging,array,string +import re +import xbmc from t0mm0.common.net import Net from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -#from base64 import b64decode +# from base64 import b64decode import base64 -error_logo=os.path.join(common.addon_path,'resources','images','redx.png') -ok_logo=os.path.join(common.addon_path,'resources','images','greeninch.png') +class SpeedVideoResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "speedvideo" + domains = ["speedvideo.net"] + domain = "speedvideo.net" + USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' -class SpeedVideoResolver(Plugin,UrlResolver,PluginSettings): - implements=[UrlResolver,PluginSettings] - name="speedvideo" - domains = [ "speedvideo.net" ] - domain="speedvideo.net" - USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' - def __init__(self): - p=self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - - def valid_url(self,url,host): - if self.get_setting('enabled')=='false': + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False - return re.match('http://(?:www.)?%s/(?:embed\-)?[0-9A-Za-z_]+(?:\-[0-9]+x[0-9]+.html)?'%self.domain,url) or 'speedvideo' in host - - def get_url(self,host,media_id): - return 'http://%s/embed-%s-640x400.html'%(self.domain,media_id) - #return 'http://%s/%s'%(self.domain,media_id) - - def get_host_and_id(self,url): - r=re.search('http://(?:www\.)?(%s)\.net/(?:embed-)?([0-9A-Za-z_]+)(?:-\d+x\d+.html)?'%self.name,url) + return re.match('http://(?:www.)?%s/(?:embed\-)?[0-9A-Za-z_]+(?:\-[0-9]+x[0-9]+.html)?' % self.domain, url) or 'speedvideo' in host + + def get_url(self, host, media_id): + return 'http://%s/embed-%s-640x400.html' % (self.domain, media_id) + + def get_host_and_id(self, url): + r = re.search('http://(?:www\.)?(%s)\.net/(?:embed-)?([0-9A-Za-z_]+)(?:-\d+x\d+.html)?' % self.name, url) if r: return r.groups() else: return False - - def get_media_url(self,host,media_id): - base_url=self.get_url(host,media_id) - headers={'User-Agent':self.USER_AGENT,'Referer':'http://%s/'%self.domain} - try: - #if len(base_url) > 0: - html=self.net.http_GET(base_url,headers=headers).content - linkfile=re.compile('var linkfile\s*=\s*"([A-Za-z0-9]+)"').findall(html)[0] - common.addon.log(linkfile) - linkfileb=re.compile('var linkfile\s*=\s*base64_decode\(linkfile,\s*([A-Za-z0-9]+)\);').findall(html)[0] - common.addon.log(linkfileb) - linkfilec=re.compile('var '+linkfileb+'\s*=\s*(\d+);').findall(html)[0] - common.addon.log(linkfilec) - linkfilec=int(linkfilec) - linkfilez=linkfile[:linkfilec]+linkfile[(linkfilec+10):] - common.addon.log(linkfilez) - stream_url=base64.b64decode(linkfilez) - common.addon.log(stream_url) - xbmc.sleep(4000) - #if stream_url: - return stream_url - #else: return False - #try: - # pass - except urllib2.HTTPError,e: - e=e.code - common.addon.log_error(self.name+': got Http error %s fetching %s'%(e,base_url)) - common.addon.show_small_popup('Error','Http error: %s'%e,8000,image=error_logo) - return self.unresolvable(code=3,msg=e) - except urllib2.URLError,e: - e=str(e.args) - common.addon.log_error(self.name+': got Url error %s fetching %s'%(e,base_url)) - common.addon.show_small_popup('Error','URL error: %s'%e,8000,image=error_logo) - return self.unresolvable(code=3,msg=e) - except IndexError,e: - if re.search('File Not Found',html) : - e='File not found or removed' - common.addon.log('**** %s Error occured: %s'%(self.name,e)) - common.addon.show_small_popup(title='[B][COLOR white]%s[/COLOR][/B]'%self.name,msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) - return self.unresolvable(code=1, msg=e) - else: - common.addon.log('**** %s Error occured: %s'%(self.name,e)) - common.addon.show_small_popup(title='[B][COLOR white]%s[/COLOR][/B]'%self.name,msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) - return self.unresolvable(code=0, msg=e) - except Exception,e: - common.addon.log('**** %s Error occured: %s'%(self.name,e)) - common.addon.show_small_popup(title='[B][COLOR white]%s[/COLOR][/B]'%self.name,msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) - return self.unresolvable(code=0,msg=e) - + + def get_media_url(self, host, media_id): + base_url = self.get_url(host, media_id) + headers = {'User-Agent':self.USER_AGENT, 'Referer':'http://%s/' % self.domain} + html = self.net.http_GET(base_url, headers=headers).content + linkfile = re.compile('var linkfile\s*=\s*"([A-Za-z0-9]+)"').findall(html)[0] + common.addon.log_debug(linkfile) + linkfileb = re.compile('var linkfile\s*=\s*base64_decode\(linkfile,\s*([A-Za-z0-9]+)\);').findall(html)[0] + common.addon.log(linkfileb) + linkfilec = re.compile('var ' + linkfileb + '\s*=\s*(\d+);').findall(html)[0] + common.addon.log_debug(linkfilec) + linkfilec = int(linkfilec) + linkfilez = linkfile[:linkfilec] + linkfile[(linkfilec + 10):] + common.addon.log_debug(linkfilez) + stream_url = base64.b64decode(linkfilez) + common.addon.log_debug(stream_url) + xbmc.sleep(4000) + return stream_url + diff --git a/lib/urlresolver/plugins/stagevu.py b/lib/urlresolver/plugins/stagevu.py index 3ecb0094..af89ff6a 100644 --- a/lib/urlresolver/plugins/stagevu.py +++ b/lib/urlresolver/plugins/stagevu.py @@ -16,54 +16,36 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2 from urlresolver import common -import os - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') class StagevuResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "stagevu" domains = [ "stagevu.com" ] - def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - link = self.net.http_GET(web_url).content - p=re.compile('(File Not Found)<',html): + raise UrlResolver.ResolverError('File Not Found or removed') + + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2).replace("download1","download2") + html = self.net.http_POST(post_url, form_data=form_values).content - try: - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() - dialog = xbmcgui.Dialog() - - if re.search('>(File Not Found)<',html): - raise Exception ('File Not Found or removed') - - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2).replace("download1","download2") - #wait required - #common.addon.show_countdown(11) - html = self.net.http_POST(post_url, form_data=form_values).content - - r = re.search('file: "(.+?)",', html) - if r: - return r.group(1) - else: - raise Exception ('File Not Found or removed') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Streamcloud Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + r = re.search('file: "(.+?)",', html) + if r: + return r.group(1) + else: + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://streamcloud.eu/%s' % (media_id) @@ -79,7 +62,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match('http://(www.)?streamcloud.eu/[0-9A-Za-z]+', url) or 'streamcloud' in host diff --git a/lib/urlresolver/plugins/streaminto.py b/lib/urlresolver/plugins/streaminto.py index d9295a3f..75f43f7f 100644 --- a/lib/urlresolver/plugins/streaminto.py +++ b/lib/urlresolver/plugins/streaminto.py @@ -16,18 +16,15 @@ along with this program. If not, see . """ +import re +import xbmc from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, re, os,xbmc from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - - -class streamintoResolver(Plugin, UrlResolver, PluginSettings): +class StreamintoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "streaminto" domains = ["streamin.to"] @@ -39,40 +36,27 @@ def __init__(self): #e.g. http://streamin.to/20xk6r5vpkch self.pattern = 'http://((?:www.)?streamin.to)/(.*)' - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - resp = self.net.http_GET(web_url) - - html = resp.content - post_url = web_url #resp.get_url() - - # get post vars - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2) - xbmc.sleep(5000) - html = self.net.http_POST(post_url, form_data=form_values).content - - # get stream url - pattern = 'streamer:\s*"([^"]+)",' #streamer: " - file = 'file:\s*"([^"]+)",' #streamer: " - r = re.search(pattern, html) - rr = re.search(file, html) - if r: - return r.group(1).replace(':1935','') + ' swfUrl=http://streamin.to/player/player.swf live=false swfVfy=1 playpath=' + rr.group(1).replace('.flv','') - - raise Exception ('File Not Found or removed') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** streaminto Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]streaminto[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + resp = self.net.http_GET(web_url) + html = resp.content + post_url = web_url + + # get post vars + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + xbmc.sleep(5000) + html = self.net.http_POST(post_url, form_data=form_values).content + + # get stream url + pattern = 'streamer:\s*"([^"]+)",' # streamer: " + file = 'file:\s*"([^"]+)",' # streamer: " + r = re.search(pattern, html) + rr = re.search(file, html) + if r: + return r.group(1).replace(':1935', '') + ' swfUrl=http://streamin.to/player/player.swf live=false swfVfy=1 playpath=' + rr.group(1).replace('.flv', '') + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://streamin.to/%s' % (media_id) @@ -84,7 +68,6 @@ def get_host_and_id(self, url): 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 diff --git a/lib/urlresolver/plugins/teramixer.py b/lib/urlresolver/plugins/teramixer.py index bc1ca7b3..c741ea01 100644 --- a/lib/urlresolver/plugins/teramixer.py +++ b/lib/urlresolver/plugins/teramixer.py @@ -1,4 +1,4 @@ -#-*- coding: utf-8 -*- +# -*- coding: utf-8 -*- """ Teramixer.com urlresolver XBMC Addon @@ -18,7 +18,7 @@ along with this program. If not, see . """ -import urllib, urllib2, os, re +import re import base64 from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver @@ -26,14 +26,9 @@ from urlresolver.plugnplay import Plugin from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') -#SET OK_LOGO# THANKS TO JUL1EN094 -ok_logo = os.path.join(common.addon_path, 'resources', 'images', 'greeninch.png') - class TeramixerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] - name = "teramixer" + name = "teramixer" def __init__(self): p = self.get_setting('priority') or 100 @@ -41,39 +36,20 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - base_url = 'http://www.'+host+'.com/'+media_id + base_url = 'http://www.' + host + '.com/' + media_id try: - html = self.net.http_GET(base_url).content + html = self.net.http_GET(base_url).content encodedUrl = re.findall("""filepath = '(.*)';""", html)[0] encodedUrl = encodedUrl[9:] encodedUrl = base64.b64decode(encodedUrl) if not encodedUrl.startswith('aws'): encodedUrl = encodedUrl[1:] - stream_url = 'http://'+encodedUrl + stream_url = 'http://' + encodedUrl return stream_url - except urllib2.HTTPError, e: - e = e.code - common.addon.log_error(self.name + ': got Http error %s fetching %s' % (e, base_url)) - common.addon.show_small_popup('Error','Http error: %s' % e, 8000, image=error_logo) - return self.unresolvable(code=3, msg=e) - except urllib2.URLError, e: - e = str(e.args) - common.addon.log_error(self.name + ': got Url error %s fetching %s' % (e, base_url)) - common.addon.show_small_popup('Error','URL error: %s' % e, 8000, image=error_logo) - return self.unresolvable(code=3, msg=e) - except IndexError, e : + except IndexError as e: if re.search("""File not found or deleted - Teramixer""", html) : - e = 'File not found or removed' - common.addon.log('**** Teramixer Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]TERAMIXER[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=1, msg=e) - else : - common.addon.log('**** Teramixer Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]TERAMIXER[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) - except Exception, e: - common.addon.log('**** Teramixer Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]TERAMIXER[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + raise UrlResolver.ResolverError('File not found or removed') + else: + raise UrlResolver.ResolverError(e) def get_url(self, host, media_id): return 'http://www.teramixer.com/%s' % media_id @@ -82,16 +58,16 @@ def get_host_and_id(self, url): r = re.search('http://(www.)?(.+?).com/(embed/)?(.+)', url) if r : ls = r.groups() - ls = (ls[1],ls[3]) + ls = (ls[1], ls[3]) return ls else : return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': + if self.get_setting('enabled') == 'false': return False - return re.match('http://(www.)?teramixer.com/(embed/)?[0-9A-Za-z]+',url) or 'teramixer.com' in host + return re.match('http://(www.)?teramixer.com/(embed/)?[0-9A-Za-z]+', url) or 'teramixer.com' in host def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) - return xml \ No newline at end of file + return xml diff --git a/lib/urlresolver/plugins/thefile.py b/lib/urlresolver/plugins/thefile.py index 2ebea7d5..ec7c0e2f 100644 --- a/lib/urlresolver/plugins/thefile.py +++ b/lib/urlresolver/plugins/thefile.py @@ -20,14 +20,10 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, os from urlresolver import common import re from lib import jsunpack -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class TheFileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "thefile" @@ -40,53 +36,42 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - headers = { - 'Referer': web_url - } - html = self.net.http_GET(web_url).content - - # check if we have a p,ac,k,e,d source - r = re.search('(eval\(function\(p,a,c,k,e,[dr]\)(?!.+player_ads.+).+?)',html,re.DOTALL) - if r: - js = jsunpack.unpack(r.group(1)) - r = re.search("file:\'(.+?)\'",js.replace('\\','')) - if r: - return r.group(1) - - data = {} - r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) - for name, value in r: data[name] = value - data.update({'referer': web_url}) - data.update({'method_free': 'Free Download'}) - data.update({'op': 'download1'}) - - html = self.net.http_POST(web_url, data, headers=headers).content - - data = {} - r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) - for name, value in r: data[name] = value - data.update({'referer': web_url}) - data.update({'btn_download': 'Create Download Link'}) - data.update({'op': 'download2'}) - - html = self.net.http_POST(web_url, data, headers=headers).content - - r = re.search(r'\s*\s*',html) + headers = { + 'Referer': web_url + } + html = self.net.http_GET(web_url).content + + # check if we have a p,ac,k,e,d source + r = re.search('(eval\(function\(p,a,c,k,e,[dr]\)(?!.+player_ads.+).+?)',html,re.DOTALL) + if r: + js = jsunpack.unpack(r.group(1)) + r = re.search("file:\'(.+?)\'",js.replace('\\','')) if r: return r.group(1) - else: - raise Exception("File Link Not Found") - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log(self.name + ': general error occurred: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]THEFILE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + + data = {} + r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) + for name, value in r: data[name] = value + data.update({'referer': web_url}) + data.update({'method_free': 'Free Download'}) + data.update({'op': 'download1'}) + + html = self.net.http_POST(web_url, data, headers=headers).content + + data = {} + r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) + for name, value in r: data[name] = value + data.update({'referer': web_url}) + data.update({'btn_download': 'Create Download Link'}) + data.update({'op': 'download2'}) + + html = self.net.http_POST(web_url, data, headers=headers).content + + r = re.search(r'\s*\s*',html) + if r: + return r.group(1) + else: + raise UrlResolver.ResolverError("File Link Not Found") def get_url(self, host, media_id): return 'http://thefile.me/%s' % (media_id) diff --git a/lib/urlresolver/plugins/thevideo.py b/lib/urlresolver/plugins/thevideo.py index 9590a597..955dbf3f 100644 --- a/lib/urlresolver/plugins/thevideo.py +++ b/lib/urlresolver/plugins/thevideo.py @@ -20,7 +20,7 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, urllib, urllib2 +import re, urllib from urlresolver import common from lib import jsunpack @@ -39,61 +39,50 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + headers = { + 'User-Agent': USER_AGENT, + 'Referer': web_url + } - try: - headers = { - 'User-Agent': USER_AGENT, - 'Referer': web_url - } + html = self.net.http_GET(web_url).content + js = '' + tries=1 + while not js and tries<=MAX_TRIES: + r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) + data={} + for name, value in r: + data[name] = value + data[u"imhuman"] = "Proceed to video"; + r = re.findall(r"type:\s*'hidden',\s*id:\s*'([^']+).*?value:\s*'([^']+)", html) + for name, value in r: + data[name] = value + + cookies={} + for match in re.finditer("\$\.cookie\('([^']+)',\s*'([^']+)",html): + key,value = match.groups() + cookies[key]=value + cookies['ref_url']=web_url + headers['Cookie']=urllib.urlencode(cookies) - html = self.net.http_GET(web_url).content - - js = '' - tries=1 - while not js and tries<=MAX_TRIES: - r = re.findall(r'type="hidden"\s*name="(.+?)"\s*value="(.*?)"', html) - data={} - for name, value in r: - data[name] = value - data[u"imhuman"] = "Proceed to video"; - r = re.findall(r"type:\s*'hidden',\s*id:\s*'([^']+).*?value:\s*'([^']+)", html) - for name, value in r: - data[name] = value - - cookies={} - for match in re.finditer("\$\.cookie\('([^']+)',\s*'([^']+)",html): - key,value = match.groups() - cookies[key]=value - cookies['ref_url']=web_url - headers['Cookie']=urllib.urlencode(cookies) - - html = self.net.http_POST(web_url, data, headers=headers).content - r = re.search("",html,re.DOTALL) - if r: - js = jsunpack.unpack(r.group(1)) - break - tries += 1 - else: - raise Exception ('Unable to resolve TheVideo link. Player config not found.') - - r = re.findall(r"label:\\'([^']+)p\\',file:\\'([^\\']+)", js) - if not r: - raise Exception('Unable to locate link') - else: - max_quality=0 - for quality, stream_url in r: - if int(quality)>=max_quality: - best_stream_url = stream_url - max_quality = int(quality) - return best_stream_url - - except urllib2.HTTPError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** TheVideo Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + html = self.net.http_POST(web_url, data, headers=headers).content + r = re.search("",html,re.DOTALL) + if r: + js = jsunpack.unpack(r.group(1)) + break + tries += 1 + else: + raise UrlResolver.ResolverError('Unable to resolve TheVideo link. Player config not found.') + + r = re.findall(r"label:\\'([^']+)p\\',file:\\'([^\\']+)", js) + if not r: + raise UrlResolver.ResolverError('Unable to locate link') + else: + max_quality=0 + for quality, stream_url in r: + if int(quality)>=max_quality: + best_stream_url = stream_url + max_quality = int(quality) + return best_stream_url def get_url(self, host, media_id): return 'http://%s/%s' % (host, media_id) diff --git a/lib/urlresolver/plugins/trollvid.py b/lib/urlresolver/plugins/trollvid.py index 21d4951e..8bd56056 100644 --- a/lib/urlresolver/plugins/trollvid.py +++ b/lib/urlresolver/plugins/trollvid.py @@ -16,18 +16,18 @@ along with this program. If not, see . """ +import urllib +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 from urlresolver import common -import re,xbmc -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class TrollVidResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "trollvid.net" - domains = [ "trollvid.net" ] + domains = ["trollvid.net"] def __init__(self): p = self.get_setting('priority') or 100 @@ -49,31 +49,11 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name - common.addon.log(media_id) - common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching 1st url %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False - - #try: - # data = {}; r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html); data['usr_login']='' - # for name, value in r: data[name] = value - # data['imhuman']='Proceed to video'; data['btn_download']='Proceed to video' - # xbmc.sleep(2000) - # html = self.net.http_POST(post_url, data).content - #except urllib2.URLError, e: - # common.addon.log_error(hostname+': got http error %d fetching 2nd url %s' % (e.code, web_url)) - # return self.unresolvable(code=3, msg='Exception: %s' % e) #return False - + resp = self.net.http_GET(web_url) + html = resp.content r = re.search('clip\s*:\s*\n*\s*{\s*\n*\s*\n*\s*\n*\s*url\s*:\s*"(http.+?)"', html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('No File located') return stream_url diff --git a/lib/urlresolver/plugins/tubeplus.py b/lib/urlresolver/plugins/tubeplus.py index b244a6d1..622f7b60 100644 --- a/lib/urlresolver/plugins/tubeplus.py +++ b/lib/urlresolver/plugins/tubeplus.py @@ -17,9 +17,8 @@ """ import re -from t0mm0.common.net import Net -import urllib2 import urlresolver +from t0mm0.common.net import Net from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings @@ -28,44 +27,26 @@ class TubeplusResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver] name = "tubeplus.me" - domains = [ "tubeplus.me" ] + domains = ["tubeplus.me"] def __init__(self): self.net = Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - #get list - try: - html = self.net.http_GET(web_url).content - - r = '"none" href="(.+?)"' - sources = [] - regex = re.finditer(r, html, re.DOTALL) - - for s in regex: - sources.append(urlresolver.HostedMediaFile(url=s.group(1))) - - source = urlresolver.choose_source(sources) - - return source.resolve() - - except urllib2.URLError, e: - common.addon.log_error('Tubeplus: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** Tubeplus Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]TUBEPLUS[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + html = self.net.http_GET(web_url).content + r = '"none" href="(.+?)"' + sources = [] + regex = re.finditer(r, html, re.DOTALL) + for s in regex: + sources.append(urlresolver.HostedMediaFile(url=s.group(1))) + source = urlresolver.choose_source(sources) + return source.resolve() def get_url(self, host, media_id): return 'http://tubeplus.me/player/%s/' % media_id - def get_host_and_id(self, url): r = re.search('//(.+?)/player/(\d+)', url) if r: @@ -81,4 +62,3 @@ def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match('http://(www.)?tubeplus.me/player/\d+', url) or 'tubeplus' in host - diff --git a/lib/urlresolver/plugins/tunepk.py b/lib/urlresolver/plugins/tunepk.py index 0cac8d9f..bb2c469a 100644 --- a/lib/urlresolver/plugins/tunepk.py +++ b/lib/urlresolver/plugins/tunepk.py @@ -16,22 +16,17 @@ along with this program. If not, see . ''' -import os -import xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2, urllib from urlresolver import common -logo=os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class TunePkResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "tune.pk" - domains = [ "tune.pk" ] + domains = ["tune.pk"] def __init__(self): p = self.get_setting('priority') or 100 @@ -40,49 +35,36 @@ def __init__(self): self.pattern = '(.+tune.pk)/(?:player|video|play)/(?:[\w\.\?]+=)?(\d+)' def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - link = repr(self.net.http_GET(web_url).content) - - if link.find('404 Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) - - videoUrl = [] - # borrowed from AJ's turtle-x - html = link.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '') - sources = re.compile("{(.+?)}").findall(re.compile("sources (.+?)]").findall(html)[0]) - for source in sources: - video_link = str(re.compile('"file":"(.*?)"').findall(source)[0]) - videoUrl.append(video_link) - - - vUrl = '' - vUrlsCount = len(videoUrl) - if vUrlsCount > 0: - q = self.get_setting('quality') - if q == '0': - # Highest Quality - vUrl = videoUrl[0] - elif q == '1': - # Medium Quality - vUrl = videoUrl[(int)(vUrlsCount / 2)] - elif q == '2': - # Lowest Quality - vUrl = videoUrl[vUrlsCount - 1] - - return vUrl - - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) - + web_url = self.get_url(host, media_id) + link = repr(self.net.http_GET(web_url).content) + if link.find('404 Not Found') >= 0: + raise UrlResolver.ResolverError('The requested video was not found.') + + videoUrl = [] + # borrowed from AJ's turtle-x + html = link.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '') + sources = re.compile("{(.+?)}").findall(re.compile("sources (.+?)]").findall(html)[0]) + for source in sources: + video_link = str(re.compile('"file":"(.*?)"').findall(source)[0]) + videoUrl.append(video_link) + + vUrl = '' + vUrlsCount = len(videoUrl) + if vUrlsCount > 0: + q = self.get_setting('quality') + if q == '0': + # Highest Quality + vUrl = videoUrl[0] + elif q == '1': + # Medium Quality + vUrl = videoUrl[(int)(vUrlsCount / 2)] + elif q == '2': + # Lowest Quality + vUrl = videoUrl[vUrlsCount - 1] + + return vUrl + else: + raise UrlResolver.ResolverError('No playable video found.') def get_url(self, host, media_id): return 'http://embed.tune.pk/play/%s' % media_id diff --git a/lib/urlresolver/plugins/uploadc.py b/lib/urlresolver/plugins/uploadc.py index 9767432d..31a04f11 100644 --- a/lib/urlresolver/plugins/uploadc.py +++ b/lib/urlresolver/plugins/uploadc.py @@ -15,21 +15,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, re, os from urlresolver import common from lib import jsunpack -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class UploadcResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uploadc" - domains = [ "uploadc.com" ] + domains = ["uploadc.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -40,37 +37,27 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - #get html - try: - html = self.net.http_GET(web_url).content + html = self.net.http_GET(web_url).content - data = {} - r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) - if r: - for name, value in r: - data[name] = value - data['referer'] = web_url - else: - raise Exception('Cannot find data values') + data = {} + r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) + if r: + for name, value in r: + data[name] = value + data['referer'] = web_url + else: + raise UrlResolver.ResolverError('Cannot find data values') - html = self.net.http_POST(web_url, data).content - - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - r = re.search('src="([^"]+)', js_data) - if r: - stream_url = r.group(1) + '|referer=' + web_url - return stream_url - - raise Exception ('File Not Found or removed') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Uploadc Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + html = self.net.http_POST(web_url, data).content + + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + js_data = jsunpack.unpack(match.group(1)) + r = re.search('src="([^"]+)', js_data) + if r: + stream_url = r.group(1) + '|referer=' + web_url + return stream_url + + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://www.uploadc.com/%s' % (media_id) diff --git a/lib/urlresolver/plugins/uploadcrazynet.py b/lib/urlresolver/plugins/uploadcrazynet.py index 8cc9e127..90f9b016 100644 --- a/lib/urlresolver/plugins/uploadcrazynet.py +++ b/lib/urlresolver/plugins/uploadcrazynet.py @@ -20,24 +20,20 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 +import urllib from urlresolver import common import re class FilenukeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uploadcrazy.net" - domains = [ "uploadcrazy.net" ] + domains = ["uploadcrazy.net"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - # http://video.vidcrazy.net/nvs.php?file=tenkai-knights06&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg - # http://video.vidcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/hdCEPmh.jpg - # http://embeds.uploadcrazy.net/ancv.php?file=aladdin305&w=640&h=360&bg=http://i.imgur.com/H1dqUbf.jpg self.pattern = 'http://((?:embeds.)?uploadcrazy.net)/(\D+.php\?file=[0-9a-zA-Z\-_]+)[&]*' - #self.pattern = 'http://((?:www.)?vidcrazy.net)/embed/(.+?)' def get_url(self, host, media_id): return 'http://embeds.uploadcrazy.net/%s' % (media_id) @@ -54,20 +50,12 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + resp = self.net.http_GET(web_url) + html = resp.content r = re.search("'file'\s*:\s*'(.+?)'", html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url - diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py index a2d47956..bbcc54b2 100644 --- a/lib/urlresolver/plugins/veeHD.py +++ b/lib/urlresolver/plugins/veeHD.py @@ -44,36 +44,32 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): - try: - if not self.get_setting('login')=='true' or not (self.get_setting('username') and self.get_setting('password')): - raise Exception('VeeHD requires a username & password') + if not self.get_setting('login')=='true' or not (self.get_setting('username') and self.get_setting('password')): + raise UrlResolver.ResolverError('VeeHD requires a username & password') - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content - # two possible playeriframe's: stream and download - for match in re.finditer('playeriframe.+?src\s*:\s*"([^"]+)', html): - player_url = 'http://%s%s'%(host,match.group(1)) + # two possible playeriframe's: stream and download + for match in re.finditer('playeriframe.+?src\s*:\s*"([^"]+)', html): + player_url = 'http://%s%s'%(host,match.group(1)) + html = self.net.http_GET(player_url).content + + # if the player html contains an iframe the iframe url has to be gotten and then the player_url tried again + r = re.search(' 0 ): - return r[0] + if not re.search('This video is not available on mobile', html): + r = re.compile("watchNow\('(.+?)'").findall(html) + if (len(r) > 0): + return r[0] - url = 'http://www.veoh.com/rest/video/'+media_id+'/details' - html = self.net.http_GET(url).content - file = re.compile('fullPreviewHashPath="(.+?)"').findall(html) + url = 'http://www.veoh.com/rest/video/'+media_id+'/details' + html = self.net.http_GET(url).content + file = re.compile('fullPreviewHashPath="(.+?)"').findall(html) - if len(file) == 0: - raise Exception ('File Not Found or removed') + if len(file) == 0: + raise UrlResolver.ResolverError('File Not Found or removed') - return file[0] - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Veoh Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]VEOH[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + return file[0] def get_url(self, host, media_id): return 'http://veoh.com/watch/%s' % media_id - def get_host_and_id(self, url): r = None video_id = None diff --git a/lib/urlresolver/plugins/vidbull.py b/lib/urlresolver/plugins/vidbull.py index 893a76db..90c7e45e 100644 --- a/lib/urlresolver/plugins/vidbull.py +++ b/lib/urlresolver/plugins/vidbull.py @@ -17,8 +17,6 @@ ''' import re -import urllib2 -import urllib from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings @@ -38,25 +36,17 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - headers = { - 'User-Agent': USER_AGENT - } - - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url, headers=headers).content - match = re.search('. """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 from urlresolver import common -# Custom imports -import re - - -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class Video44Resolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "video44.net" - domains = [ "video44.net" ] + domains = ["video44.net"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - # http://www.video44.net/gogo/?w=718&h=438&file=sakasama_no_patema_-_01.flv&sv=1 self.pattern = 'http://((?:www.)?video44.net)/gogo/.*?file=([0-9a-zA-Z\-_\.]+).*?' def get_url(self, host, media_id): @@ -53,21 +48,13 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name common.addon.log(media_id) common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + resp = self.net.http_GET(web_url) + html = resp.content r = re.search('file\s*:\s*"(.+?)"', html) if r: - stream_url = r.group(1) #stream_url = urllib.unquote_plus(r.group(1)) + stream_url = r.group(1) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url - diff --git a/lib/urlresolver/plugins/videobb.py b/lib/urlresolver/plugins/videobb.py index 6d6acd6b..b6567950 100644 --- a/lib/urlresolver/plugins/videobb.py +++ b/lib/urlresolver/plugins/videobb.py @@ -6,7 +6,6 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin - # Custom imports from base64 import b64decode from binascii import unhexlify @@ -25,81 +24,61 @@ def __init__(self): self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): #grab json info for this video - json_url = 'http://videobb.com/player_control/settings.php?v=%s' % \ - media_id - try: - json = self.net.http_GET(json_url).content - - #find highest quality URL - max_res = [240, 480, 99999][int(self.get_setting('q'))] - r = re.finditer('"l".*?:.*?"(.+?)".+?"u".*?:.*?"(.+?)"', json) - chosen_res = 0 - stream_url = False - - if r: - for match in r: - res, url = match.groups() - res = int(res.strip('p')) - if res > chosen_res and res <= max_res: - stream_url_part1 = url.decode('base-64') - chosen_res = res - else: - raise Exception ('videobb: stream url part1 not found') - - # Try to load the datas from json. - aData = loads(json) - - # Decode the link from the json data settings - spn_ik = unhexlify(self.__decrypt(aData["settings"]["login_status"]["spen"], aData["settings"]["login_status"]["salt"], 950569)).split(';') - spn = spn_ik[0].split('&') - ik = spn_ik[1] - - for item in ik.split('&') : - temp = item.split('=') - if temp[0] == 'ik' : - key = self.__get_key(temp[1]) - - sLink = "" - for item in spn : - item = item.split('=') - if(int(item[1])==1): - sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["info"]["sece2"], aData["settings"]["config"]["rkts"], key) + '&' #decrypt32byte - elif(int(item[1]==2)): - sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["banner"]["g_ads"]["url"],aData["settings"]["config"]["rkts"], key) + '&' - elif(int(item[1])==3): - sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["banner"]["g_ads"]["type"],aData["settings"]["config"]["rkts"], key,26,25431,56989,93,32589,784152) + '&' - elif(int(item[1])==4): - sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["banner"]["g_ads"]["time"],aData["settings"]["config"]["rkts"], key,82,84669,48779,32,65598,115498) + '&' - elif(int(item[1])==5): - sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["login_status"]["euno"],aData["settings"]["login_status"]["pepper"], key,10,12254,95369,39,21544,545555) + '&' - elif(int(item[1])==6): - sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["login_status"]["sugar"],aData["settings"]["banner"]["lightbox2"]["time"], key,22,66595,17447,52,66852,400595) + '&' - - sLink = sLink + "start=0" - - stream_url = stream_url_part1 + '&' + sLink - - return stream_url - - except urllib2.URLError, e: - common.addon.log_error('VideoBB: got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 5000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** VideoBB Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]VIDEOBB[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + json_url = 'http://videobb.com/player_control/settings.php?v=%s' % media_id + json = self.net.http_GET(json_url).content + #find highest quality URL + max_res = [240, 480, 99999][int(self.get_setting('q'))] + chosen_res = 0 + r = re.finditer('"l".*?:.*?"(.+?)".+?"u".*?:.*?"(.+?)"', json) + if r: + for match in r: + res, url = match.groups() + res = int(res.strip('p')) + if res > chosen_res and res <= max_res: + stream_url_part1 = url.decode('base-64') + chosen_res = res + else: + raise UrlResolver.ResolverError('videobb: stream url part1 not found') + + # Try to load the datas from json. + aData = loads(json) + + # Decode the link from the json data settings + spn_ik = unhexlify(self.__decrypt(aData["settings"]["login_status"]["spen"], aData["settings"]["login_status"]["salt"], 950569)).split(';') + spn = spn_ik[0].split('&') + ik = spn_ik[1] + + for item in ik.split('&') : + temp = item.split('=') + if temp[0] == 'ik' : + key = self.__get_key(temp[1]) + + sLink = "" + for item in spn : + item = item.split('=') + if(int(item[1])==1): + sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["info"]["sece2"], aData["settings"]["config"]["rkts"], key) + '&' #decrypt32byte + elif(int(item[1]==2)): + sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["banner"]["g_ads"]["url"],aData["settings"]["config"]["rkts"], key) + '&' + elif(int(item[1])==3): + sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["banner"]["g_ads"]["type"],aData["settings"]["config"]["rkts"], key,26,25431,56989,93,32589,784152) + '&' + elif(int(item[1])==4): + sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["banner"]["g_ads"]["time"],aData["settings"]["config"]["rkts"], key,82,84669,48779,32,65598,115498) + '&' + elif(int(item[1])==5): + sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["login_status"]["euno"],aData["settings"]["login_status"]["pepper"], key,10,12254,95369,39,21544,545555) + '&' + elif(int(item[1])==6): + sLink = sLink + item[0]+ '=' + self.__decrypt(aData["settings"]["login_status"]["sugar"],aData["settings"]["banner"]["lightbox2"]["time"], key,22,66595,17447,52,66852,400595) + '&' + + sLink = sLink + "start=0" + stream_url = stream_url_part1 + '&' + sLink + return stream_url def get_url(self, host, media_id): return 'http://www.videobb.com/video/%s' % media_id - def get_host_and_id(self, url): r = re.search('//(.+?)/(?:e/|video/|watch_video.php\?v=)([0-9a-zA-Z]+)', url) @@ -108,14 +87,12 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match('http://(www.)?videobb.com/' + '(e/|video/|watch_video.php\?v=)' + '[0-9A-Za-z]+', url) or 'videobb' in host - def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) xml += '. """ +import urllib +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 from urlresolver import common -# Custom imports -import re - - -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class VideoFunResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "videofun.me" - domains = [ "videofun.me" ] + domains = ["videofun.me"] def __init__(self): p = self.get_setting('priority') or 100 @@ -54,21 +51,13 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name common.addon.log(media_id) common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + resp = self.net.http_GET(web_url) + html = resp.content r = re.search('url\s*:\s*"(.+?)",\s*autoPlay:\s*false', html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url - diff --git a/lib/urlresolver/plugins/videohut.py b/lib/urlresolver/plugins/videohut.py index 3a0923b9..1f667fda 100644 --- a/lib/urlresolver/plugins/videohut.py +++ b/lib/urlresolver/plugins/videohut.py @@ -95,46 +95,28 @@ def __is_stream_url_active(self, web_url): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - dialog = xbmcgui.Dialog() - #grab stream details - try: - html = self.net.http_GET(web_url).content - html = unwise.unwise_process(html) - filekey = unwise.resolve_var(html, "flashvars.filekey") - - error_url = None - stream_url = None - # try to resolve 3 times then give up - for x in range(0, 2): - link = self.__get_stream_url(media_id, filekey, - error_num=x, - error_url=error_url) - - if link: - active = self.__is_stream_url_active(link) - - if active: - stream_url = urllib.unquote(link) - break; - else: - # link inactive - error_url = link + html = self.net.http_GET(web_url).content + html = unwise.unwise_process(html) + filekey = unwise.resolve_var(html, "flashvars.filekey") + + error_url = None + stream_url = None + # try to resolve 3 times then give up + for x in range(0, 2): + link = self.__get_stream_url(media_id, filekey, error_num=x, error_url=error_url) + if link: + active = self.__is_stream_url_active(link) + if active: + stream_url = urllib.unquote(link) + break else: - # no link found - raise Exception ('File Not Found or removed') - - if stream_url: - return stream_url + # link inactive + error_url = link else: - raise Exception ('File Not Found or removed') - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** videohut Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]videohut[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) - + # no link found + raise UrlResolver.ResolverError('File Not Found or removed') + + if stream_url: + return stream_url + else: + raise UrlResolver.ResolverError('File Not Found or removed') diff --git a/lib/urlresolver/plugins/videomega.py b/lib/urlresolver/plugins/videomega.py index 7035957b..60dc2f93 100644 --- a/lib/urlresolver/plugins/videomega.py +++ b/lib/urlresolver/plugins/videomega.py @@ -19,109 +19,94 @@ along with this program. If not, see . """ -import re,urllib,urllib2,os,xbmc +import re, urllib, urllib2 +import xbmc from t0mm0.common.net import Net from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -from time import sleep -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo=os.path.join(common.addon_path,'resources','images','redx.png') - -class VideomegaResolver(Plugin,UrlResolver,PluginSettings): - implements=[UrlResolver,PluginSettings] - name="videomega" - domains=["videomega.tv","movieshd.co"] +class VideomegaResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "videomega" + domains = ["videomega.tv", "movieshd.co"] def __init__(self): p = self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - self.headers={'Referer':'http://videomega.tv/'} + self.priority = int(p) + self.net = Net() + self.headers = {'Referer':'http://videomega.tv/'} - def get_media_url(self,host,media_id): - web_url=self.get_url(host,media_id) - stream_url=None - self.headers['Referer']=web_url - try: - html=self.net.http_GET(web_url,headers=self.headers).content - if 'Error connecting to db' in html: return self.unresolvable(0, 'Error connecting to DB') - # find the unescape string - r=re.compile('document\.write\(unescape\("([^"]+)').findall(html) + 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 'Error connecting to db' in html: raise UrlResolver.ResolverError('Error connecting to DB') + # find the unescape string + r = re.compile('document\.write\(unescape\("([^"]+)').findall(html) + if r: + unescaped_str = urllib.unquote(r[-1]) + r = re.search('file\s*:\s*"([^"]+)', unescaped_str) if r: - unescaped_str=urllib.unquote(r[-1]) - r=re.search('file\s*:\s*"([^"]+)',unescaped_str) - if r: - stream_url=r.group(1) - stream_url=stream_url.replace(" ","%20") - else: - r = re.search('',html) - if r: stream_url = r.group(1) - if stream_url: - #sleep(6) - xbmc.sleep(6000) - return stream_url - else: return self.unresolvable(0,'No playable video found.') - except urllib2.URLError, e: - common.addon.log_error('%s: got http error %d fetching %s'%(host,e.code,web_url)) - return self.unresolvable(code=3,msg=e) - except Exception, e: - common.addon.log_error('**** %s Error occured: %s'%(host,e)) - common.addon.show_small_popup(title='[B][COLOR white]%s[/COLOR][/B]'%host,msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) - return self.unresolvable(code=0,msg=e) + stream_url = r.group(1) + stream_url = stream_url.replace(" ", "%20") + else: + r = re.search('', html) + if r: stream_url = r.group(1) + if stream_url: + xbmc.sleep(6000) + return stream_url + else: raise UrlResolver.ResolverError('No playable video found.') - def get_url(self,host,media_id): + def get_url(self, host, media_id): if "movieshd.co" in host: - return 'http://%s/iframe.php?ref=%s'%(host,media_id) - else: #For VideoMega.tv + return 'http://%s/iframe.php?ref=%s' % (host, media_id) + else: # For VideoMega.tv if len(media_id) == 60: try: - html=self.net.http_GET('http://%s/validatehash.php?hashkey=%s'%(host,media_id),headers=self.headers).content - #print html + html = self.net.http_GET('http://%s/validatehash.php?hashkey=%s' % (host, media_id), headers=self.headers).content + # print html if 'Error connecting to db' in html: return self.unresolvable(0, 'Error connecting to DB') if 'ref=' in html: - return 'http://%s/cdn.php?ref=%s'%(host,re.compile('.*?ref="(.+?)".*').findall(html)[0]) + return 'http://%s/cdn.php?ref=%s' % (host, re.compile('.*?ref="(.+?)".*').findall(html)[0]) else: raise Exception('No playable video found.') - except urllib2.URLError,e: - common.addon.log_error('Videomega: got http error %d fetching %s' % (e.code, 'http://%s/validatehash.php?hashkey=%s'%(host,media_id))) - common.addon.show_small_popup(title='[B][COLOR white]Videomega[/COLOR][/B]',msg='[COLOR red]HTTP Error: %s[/COLOR]'%e,delay=5000,image=error_logo) - except Exception,e: - common.addon.log_error('**** Videomega Error occured: %s'%e) - common.addon.show_small_popup(title='[B][COLOR white]Videomega[/COLOR][/B]',msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) + except urllib2.URLError, e: + common.addon.log_error('Videomega: got http error %d fetching %s' % (e.code, 'http://%s/validatehash.php?hashkey=%s' % (host, media_id))) + except Exception, e: + common.addon.log_error('**** Videomega Error occured: %s' % e) else: - return 'http://%s/iframe.php?ref=%s'%(host,media_id) + return 'http://%s/iframe.php?ref=%s' % (host, media_id) - def get_host_and_id(self,url): - q=re.search('//(?:www.)?movieshd.co/watch-online/.*html',url) - if q: # movieshd link + def get_host_and_id(self, url): + q = re.search('//(?:www.)?movieshd.co/watch-online/.*html', url) + if q: # movieshd link try: # Request MoviesHD page - req=urllib2.Request(url) - req.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') - response=urllib2.urlopen(req) - link=response.read() + req = urllib2.Request(url) + req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3') + response = urllib2.urlopen(req) + link = response.read() response.close() # Find videomega reference - match=re.compile("'text/javascript'>ref='(.+?)?';width.*iframe").findall(link) + match = re.compile("'text/javascript'>ref='(.+?)?';width.*iframe").findall(link) if (len(match) == 1): - return ['videomega.tv',match[0]] - except urllib2.URLError,e: - common.addon.log_error('movieshd.co: got http error %d fetching %s'%(e.code,web_url)) - return self.unresolvable(code=3,msg=e) - except Exception,e: - common.addon.log_error('**** movieshd.co Error occured: %s'%e) - common.addon.show_small_popup(title='[B][COLOR white]Videomega[/COLOR][/B]',msg='[COLOR red]%s[/COLOR]'%e,delay=5000,image=error_logo) - r=re.search('//((?:www.)?(?:.+?))/.*(?:\?(?:ref|hashkey)=)([0-9a-zA-Z]+)',url) - if r: # videomega link + return ['videomega.tv', match[0]] + except urllib2.URLError, e: + common.addon.log_error('movieshd.co: got http error %d fetching %s' % (e.code, url)) + return self.unresolvable(code=3, msg=e) + except Exception, e: + common.addon.log_error('**** movieshd.co Error occured: %s' % e) + r = re.search('//((?:www.)?(?:.+?))/.*(?:\?(?:ref|hashkey)=)([0-9a-zA-Z]+)', url) + if r: # videomega link return r.groups() - v=re.search('//((?:www.)?(?:videomega.+?))/(?:iframe.(?:php|js)\?ref=)([0-9a-zA-Z]+)',url) - if v: # videomega link + v = re.search('//((?:www.)?(?:videomega.+?))/(?:iframe.(?:php|js)\?ref=)([0-9a-zA-Z]+)', url) + if v: # videomega link return v.groups() return False - def valid_url(self,url,host): - if self.get_setting('enabled')=='false': return False + def valid_url(self, url, host): + if self.get_setting('enabled') == 'false': return False return re.match('http://(?:www.)?videomega.tv/(?:iframe|cdn|validatehash|\?ref=)(?:\.php|\.js|.*)\?*', url) or 'videomega' in host diff --git a/lib/urlresolver/plugins/videoraj.py b/lib/urlresolver/plugins/videoraj.py index 0ba6d09b..194b9e40 100644 --- a/lib/urlresolver/plugins/videoraj.py +++ b/lib/urlresolver/plugins/videoraj.py @@ -27,9 +27,6 @@ from lib import unwise import urllib -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class VideorajResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "videoraj.ch" @@ -82,48 +79,36 @@ def __is_stream_url_active(self, web_url): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - dialog = xbmcgui.Dialog() #grab stream details - try: - html = self.net.http_GET(web_url).content - html = unwise.unwise_process(html) - filekey = unwise.resolve_var(html, "flashvars.filekey") - - error_url = None - stream_url = None - # try to resolve 3 times then give up - for x in range(0, 2): - link = self.__get_stream_url(media_id, filekey, - error_num=x, - error_url=error_url) - - if link: - active = self.__is_stream_url_active(link) - - if active: - stream_url = urllib.unquote(link) - break; - else: - # link inactive - error_url = link + html = self.net.http_GET(web_url).content + html = unwise.unwise_process(html) + filekey = unwise.resolve_var(html, "flashvars.filekey") + + error_url = None + stream_url = None + # try to resolve 3 times then give up + for x in range(0, 2): + link = self.__get_stream_url(media_id, filekey, + error_num=x, + error_url=error_url) + + if link: + active = self.__is_stream_url_active(link) + + if active: + stream_url = urllib.unquote(link) + break; else: - # no link found - raise Exception ('File Not Found or removed') - - if stream_url: - return stream_url + # link inactive + error_url = link else: - raise Exception ('File Not Found or removed') - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** videoraj Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]videoraj[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + # no link found + raise UrlResolver.ResolverError('File Not Found or removed') + + if stream_url: + return stream_url + else: + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://www.videoraj.ch/embed.php?id=%s' % media_id diff --git a/lib/urlresolver/plugins/videotanker.py b/lib/urlresolver/plugins/videotanker.py index f3831c29..05270197 100644 --- a/lib/urlresolver/plugins/videotanker.py +++ b/lib/urlresolver/plugins/videotanker.py @@ -16,22 +16,17 @@ along with this program. If not, see . ''' -import os -import xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2 from urlresolver import common -logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class VideoTankerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = 'videotanker' - domains = [ 'videotanker.co' ] + domains = ['videotanker.co'] def __init__(self): p = self.get_setting('priority') or 100 @@ -39,41 +34,29 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - - if link.find('no video details found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) - - videoUrl = re.compile("(?:hq_video_file|normal_video_file|mobile_video_file)\s+\=\s+(?:\'|\")([\w\.\/\:\-\?\=]+)(?:\'|\")").findall(link) - - vUrl = '' - vUrlsCount = len(videoUrl) - if vUrlsCount > 0: - q = self.get_setting('quality') - if q == '0': - # Highest Quality - vUrl = videoUrl[0] - elif q == '1': - # Medium Quality - vUrl = videoUrl[(int)(vUrlsCount / 2)] - elif q == '2': - # Lowest Quality - vUrl = videoUrl[vUrlsCount - 1] - - return vUrl - - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + if link.find('no video details found') >= 0: + raise UrlResolver.ResolverError('The requested video was not found.') + + videoUrl = re.compile("(?:hq_video_file|normal_video_file|mobile_video_file)\s+\=\s+(?:\'|\")([\w\.\/\:\-\?\=]+)(?:\'|\")").findall(link) + vUrl = '' + vUrlsCount = len(videoUrl) + if vUrlsCount > 0: + q = self.get_setting('quality') + if q == '0': + # Highest Quality + vUrl = videoUrl[0] + elif q == '1': + # Medium Quality + vUrl = videoUrl[(int)(vUrlsCount / 2)] + elif q == '2': + # Lowest Quality + vUrl = videoUrl[vUrlsCount - 1] + + return vUrl + else: + raise UrlResolver.ResolverError('No playable video found.') def get_url(self, host, media_id): return 'http://videotanker.co/player/embed_player.php?vid=%s' % media_id diff --git a/lib/urlresolver/plugins/videott.py b/lib/urlresolver/plugins/videott.py index 378e1bed..e279f4a2 100644 --- a/lib/urlresolver/plugins/videott.py +++ b/lib/urlresolver/plugins/videott.py @@ -16,14 +16,11 @@ along with this program. If not, see . ''' -import os -import xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2, urllib from urlresolver import common # Custom imports @@ -45,42 +42,29 @@ def __init__(self): def get_media_url(self, host, media_id): json_url = 'http://www.video.tt/player_control/settings.php?v=%s' % media_id - - try: - json = self.net.http_GET(json_url).content - data = loads(json) - - vids = data['settings']['res'] - - if not vids: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (json_url, err_title, err_message)) - return self.unresolvable(1, err_message) - - else: - vUrlsCount = len(vids) - - if (vUrlsCount > 0): - q = self.get_setting('quality') - # Lowest Quality - li = 0 - - if q == '1': - # Medium Quality - li = (int)(vUrlsCount / 2) - elif q == '2': - # Highest Quality - li = vUrlsCount - 1 - - vUrl = vids[li]['u'].decode('base-64') - return vUrl - - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) - + json = self.net.http_GET(json_url).content + data = loads(json) + vids = data['settings']['res'] + if not vids: + raise UrlResolver.ResolverError('The requested video was not found.') + + else: + vUrlsCount = len(vids) + + if (vUrlsCount > 0): + q = self.get_setting('quality') + # Lowest Quality + li = 0 + + if q == '1': + # Medium Quality + li = (int)(vUrlsCount / 2) + elif q == '2': + # Highest Quality + li = vUrlsCount - 1 + + vUrl = vids[li]['u'].decode('base-64') + return vUrl def get_url(self, host, media_id): return 'http://www.video.tt/watch_video.php?v=%s' % media_id diff --git a/lib/urlresolver/plugins/videovalley.py b/lib/urlresolver/plugins/videovalley.py index 0a637b41..a45c0563 100644 --- a/lib/urlresolver/plugins/videovalley.py +++ b/lib/urlresolver/plugins/videovalley.py @@ -16,18 +16,18 @@ along with this program. If not, see . """ +import urllib +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 from urlresolver import common -import re -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class VideoValleyResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "videovalley.net" - domains = [ "videovalley.net" ] + domains = ["videovalley.net"] def __init__(self): p = self.get_setting('priority') or 100 @@ -51,20 +51,12 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + resp = self.net.http_GET(web_url) + html = resp.content r = re.search("'file'\s*:\s*'(.+?)'", html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url - diff --git a/lib/urlresolver/plugins/videoweed.py b/lib/urlresolver/plugins/videoweed.py index ce1d5920..04c452ef 100644 --- a/lib/urlresolver/plugins/videoweed.py +++ b/lib/urlresolver/plugins/videoweed.py @@ -18,21 +18,16 @@ import re from t0mm0.common.net import Net -import urllib2, os from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import xbmcgui from lib import unwise -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class VideoweedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "videoweed.es" - domains = [ "videoweed.es" ] + domains = ["videoweed.es"] def __init__(self): p = self.get_setting('priority') or 100 @@ -41,35 +36,22 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - dialog = xbmcgui.Dialog() - #grab stream details - try: - html = self.net.http_GET(web_url).content - html = unwise.unwise_process(html) - filekey = unwise.resolve_var(html, "flashvars.filekey") - - #use api to find stream address - api_call = ('http://www.videoweed.es/api/player.api.php?user=undefined&codes=1&file=%s' + - '&pass=undefined&key=%s') % (media_id, filekey) + html = self.net.http_GET(web_url).content + html = unwise.unwise_process(html) + filekey = unwise.resolve_var(html, "flashvars.filekey") - api_html = self.net.http_GET(api_call).content - rapi = re.search('url=(.+?)&title=', api_html) - if rapi: - stream_url = rapi.group(1) - else: - raise Exception ('File Not Found or removed') - - return stream_url + #use api to find stream address + api_call = ('http://www.videoweed.es/api/player.api.php?user=undefined&codes=1&file=%s' + + '&pass=undefined&key=%s') % (media_id, filekey) - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Videoweed Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]VIDEOWEED[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + api_html = self.net.http_GET(api_call).content + rapi = re.search('url=(.+?)&title=', api_html) + if rapi: + stream_url = rapi.group(1) + else: + raise UrlResolver.ResolverError('File Not Found or removed') + + return stream_url def get_url(self, host, media_id): return 'http://www.videoweed.es/file/%s' % media_id diff --git a/lib/urlresolver/plugins/videozed.py b/lib/urlresolver/plugins/videozed.py index b7be4f27..debf271e 100644 --- a/lib/urlresolver/plugins/videozed.py +++ b/lib/urlresolver/plugins/videozed.py @@ -16,85 +16,65 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, xbmcgui from urlresolver import common from lib import jsunpack from lib import captcha_lib -net = Net() - class VideozedResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "videozed" domains = [ "videozed.net" ] - def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): - try: - url = self.get_url(host, media_id) - html = self.net.http_GET(url).content - dialog = xbmcgui.DialogProgress() - dialog.create('Resolving', 'Resolving Videozed Link...') - dialog.update(0) + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content - data = {} - r = re.findall(r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - - html = net.http_POST(url, data).content - - r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)">', html) - for name, value in r: - data[name] = value - data.update(captcha_lib.do_captcha(html)) + data = {} + r = re.findall(r'type="(?:hidden|submit)?" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value - html = net.http_POST(url, data).content - - sPattern = '' - r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) - if r: - sJavascript = r.group(1) - sUnpacked = jsunpack.unpack(sJavascript) - sPattern = '', html) + for name, value in r: + data[name] = value + data.update(captcha_lib.do_captcha(html)) + + html = self.net.http_POST(url, data).content + sPattern = '' + r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) + if r: + sJavascript = r.group(1) + sUnpacked = jsunpack.unpack(sJavascript) + sPattern = '. ''' +import re +import urllib2 from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -from lib import jsunpack from lib import captcha_lib -import re, urllib2, urllib -net = Net() USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' class VidplayResolver(Plugin, UrlResolver, PluginSettings): @@ -45,46 +44,34 @@ def get_media_url(self, host, media_id): return response.geturl() web_url = self.get_url(host, media_id) - try: - html = net.http_GET(web_url).content + html = self.net.http_GET(web_url).content + if re.search('File Not Found ', html): + raise UrlResolver.ResolverError('File Not Found or removed') - if re.search('File Not Found ', html): - msg = 'File Not Found or removed' - return self.unresolvable(code=1, msg=msg) - - data = {} - r = re.findall(r'type="hidden".*?name="([^"]+)".*?value="([^"]+)', html) - if r: - for name, value in r: - data[name] = value - else: - raise Exception('Unable to resolve vidplay Link') + data = {} + r = re.findall(r'type="hidden".*?name="([^"]+)".*?value="([^"]+)', html) + if r: + for name, value in r: + data[name] = value + else: + raise UrlResolver.ResolverError('Unable to resolve vidplay Link') - data.update(captcha_lib.do_captcha(html)) + data.update(captcha_lib.do_captcha(html)) - common.addon.log_debug('VIDPLAY - Requesting POST URL: %s with data: %s' % (web_url, data)) - html = net.http_POST(web_url, data).content - r = re.search('id="downloadbutton".*?href="([^"]+)', html) + common.addon.log_debug('VIDPLAY - Requesting POST URL: %s with data: %s' % (web_url, data)) + html = self.net.http_POST(web_url, data).content + r = re.search('id="downloadbutton".*?href="([^"]+)', html) + if r: + return r.group(1) + else: + r = re.search("file\s*:\s*'([^']+)", html) if r: return r.group(1) else: - r = re.search("file\s*:\s*'([^']+)", html) - if r: - return r.group(1) - else: - common.addon.log('***** VidPlay - Cannot find final link') - raise Exception('Unable to resolve VidPlay Link') - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** Vidplay Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + raise UrlResolver.ResolverError('Unable to resolve VidPlay Link') def get_url(self, host, media_id): - return 'http://vidplay.net/%s' % media_id + return 'http://vidplay.net/%s' % media_id def get_host_and_id(self, url): r = re.search('http://(.+?)/embed-([\w]+)-', url) diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py index 30698b8c..c3ee9b95 100644 --- a/lib/urlresolver/plugins/vidspot.py +++ b/lib/urlresolver/plugins/vidspot.py @@ -16,17 +16,17 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re from urlresolver import common class VidSpotResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidspot" - domains = [ "vidspot.net" ] + domains = ["vidspot.net"] def __init__(self): p = self.get_setting('priority') or 100 @@ -34,34 +34,29 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - url = self.get_url(host, media_id) - html = self.net.http_GET(url).content - - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - - html = self.net.http_POST(url, data).content + url = self.get_url(host, media_id) + html = self.net.http_GET(url).content + + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) + for name, value in r: + data[name] = value - r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) - if r: - fragment = r.group(1) - stream_url = None - for match in re.finditer('"file"\s*:\s*"([^"]+)', fragment): - stream_url = match.group(1) - - if stream_url: - return stream_url - else: - raise Exception('could not find file') - else: - raise Exception('could not find sources') + html = self.net.http_POST(url, data).content - except Exception, e: - common.addon.log('**** vidspot Error occured: %s' % e) - return self.unresolvable(code=0, msg='Exception: %s' % e) + r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) + if r: + fragment = r.group(1) + stream_url = None + for match in re.finditer('"file"\s*:\s*"([^"]+)', fragment): + stream_url = match.group(1) + + if stream_url: + return stream_url + else: + raise UrlResolver.ResolverError('could not find file') + else: + raise UrlResolver.ResolverError('could not find sources') def get_url(self, host, media_id): return 'http://vidspot.net/%s' % media_id diff --git a/lib/urlresolver/plugins/vidstream.py b/lib/urlresolver/plugins/vidstream.py index ec00e39b..742a4b70 100644 --- a/lib/urlresolver/plugins/vidstream.py +++ b/lib/urlresolver/plugins/vidstream.py @@ -16,21 +16,17 @@ along with this program. If not, see . """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, re, os from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - - class VidstreamResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidstream" - domains = [ "vidstream.in" ] + domains = ["vidstream.in"] def __init__(self): p = self.get_setting('priority') or 100 @@ -39,37 +35,23 @@ def __init__(self): #e.g. http://vidstream.in/xdfaay6ccwqj self.pattern = 'http://((?:www.)?vidstream.in)/(.*)' - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - resp = self.net.http_GET(web_url) - - html = resp.content - post_url = resp.get_url() - - # get post vars - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2) - html = self.net.http_POST(post_url, form_data=form_values).content - - # get stream url - pattern = 'file:\s*"([^"]+)",' - r = re.search(pattern, html) - if r: - return r.group(1) - - raise Exception ('File Not Found or removed') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Vidstream Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]VIDSTREAM[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + resp = self.net.http_GET(web_url) + html = resp.content + post_url = resp.get_url() + form_values = {} + for i in re.finditer('', html): + form_values[i.group(1)] = i.group(2) + html = self.net.http_POST(post_url, form_data=form_values).content + + # get stream url + pattern = 'file:\s*"([^"]+)",' + r = re.search(pattern, html) + if r: + return r.group(1) + else: + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://vidstream.in/%s' % (media_id) @@ -81,7 +63,6 @@ def get_host_and_id(self, url): 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 diff --git a/lib/urlresolver/plugins/vidto.py b/lib/urlresolver/plugins/vidto.py index 9df332f9..fb09128b 100644 --- a/lib/urlresolver/plugins/vidto.py +++ b/lib/urlresolver/plugins/vidto.py @@ -24,13 +24,12 @@ import xbmc from lib import jsunpack -net = Net() - USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' + class vidto(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidto" - domains = [ "vidto.me" ] + domains = ["vidto.me"] def __init__(self): p = self.get_setting('priority') or 100 @@ -38,46 +37,39 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - headers = { - 'Referer': web_url, - 'User-Agent': USER_AGENT - } + web_url = self.get_url(host, media_id) + headers = { + 'Referer': web_url, + 'User-Agent': USER_AGENT + } - html = self.net.http_GET(web_url).content - data = {} - r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) - if r: - for name, value in r: - data[name] = value - data['referer'] = web_url - data['imhuman']='Proceed to video' - xbmc.sleep(6000) # don't replace with countdown, crashes on linux - html = net.http_POST(web_url, data, headers=headers).content - match = re.search('(eval\(function.*)\s*', html, re.DOTALL) - if match: - packed_data = match.group(1) - js_data = jsunpack.unpack(packed_data) - max_label=0 - stream_url = '' - for match in re.finditer('label:\s*"(\d+)p"\s*,\s*file:\s*"([^"]+)', js_data): - label, link = match.groups() - if int(label)>max_label: - stream_url = link - max_label = int(label) - if stream_url: - return stream_url - else: - raise Exception("File Link Not Found") + html = self.net.http_GET(web_url).content + data = {} + r = re.findall(r'type="hidden" name="(.+?)" value="(.+?)"', html) + if r: + for name, value in r: + data[name] = value + data['referer'] = web_url + data['imhuman'] = 'Proceed to video' + xbmc.sleep(6000) # don't replace with countdown, crashes on linux + html = self.net.http_POST(web_url, data, headers=headers).content + match = re.search('(eval\(function.*)\s*', html, re.DOTALL) + if match: + packed_data = match.group(1) + js_data = jsunpack.unpack(packed_data) + max_label = 0 + stream_url = '' + for match in re.finditer('label:\s*"(\d+)p"\s*,\s*file:\s*"([^"]+)', js_data): + label, link = match.groups() + if int(label) > max_label: + stream_url = link + max_label = int(label) + if stream_url: + return stream_url else: - raise Exception("Packed Data Not Found") - except Exception, e: - common.addon.log('**** Vidto Error occured: %s' % e) - common.addon.show_small_popup('Error', str(e), 5000, '') - return self.unresolvable(code=0, msg='Exception: %s' % e) - - + raise UrlResolver.ResolverError("File Link Not Found") + else: + raise UrlResolver.ResolverError("Packed Data Not Found") def get_url(self, host, media_id): return 'http://vidto.me/%s.html' % media_id @@ -88,7 +80,6 @@ def get_host_and_id(self, url): return r.groups() else: return False - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index 95a3e755..4e476c5e 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -16,21 +16,17 @@ along with this program. If not, see . """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 from urlresolver import common -# Custom imports -import re - - -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class VidUpResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidup.org" - domains = [ "vidup.org" ] + domains = ["vidup.org"] def __init__(self): p = self.get_setting('priority') or 100 @@ -53,19 +49,12 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name - common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + common.addon.log_debug(web_url) + resp = self.net.http_GET(web_url) + html = resp.content r = re.search('clip:\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*"(.+?)",\s*\n*\s*provider:', html) if r: - stream_url = r.group(1) #stream_url = urllib.unquote_plus(r.group(1)) + stream_url = r.group(1) # stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url diff --git a/lib/urlresolver/plugins/vidxden.py b/lib/urlresolver/plugins/vidxden.py index b02ec633..97cca50d 100644 --- a/lib/urlresolver/plugins/vidxden.py +++ b/lib/urlresolver/plugins/vidxden.py @@ -23,7 +23,6 @@ In testing there seems to be a timing issue with files coming up as not playable. This happens on both the addon and in a browser. """ -import urllib2 import socket import re from t0mm0.common.net import Net @@ -49,49 +48,36 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + resp = self.net.http_GET(web_url) + html = resp.content + if "No such file or the file has been removed due to copyright infringement issues." in html: + raise UrlResolver.ResolverError('File Not Found or removed') + + filename = re.compile('').findall(html)[0] + data = {'op': 'download1', 'method_free': '1', 'usr_login': '', 'id': media_id, 'fname': filename} + data.update(captcha_lib.do_captcha(html)) + html = self.net.http_POST(resp.get_url(), data).content + + # find packed javascript embed code + r = re.search('(eval.*?)\s*', html, re.DOTALL) + if r: + packed_data = r.group(1) + else: + raise UrlResolver.ResolverError('packed javascript embed code not found') + + try: decrypted_data = jsunpack.unpack(packed_data) + except: pass + decrypted_data = decrypted_data.replace('\\', '') + # First checks for a flv url, then the if statement is for the avi url + r = re.search('[\'"]file[\'"]\s*,\s*[\'"]([^\'"]+)', decrypted_data) + if not r: + r = re.search('src="(.+?)"', decrypted_data) + if r: + stream_url = r.group(1) + else: + raise UrlResolver.ResolverError('stream url not found') - try: - resp = self.net.http_GET(web_url) - html = resp.content - if "No such file or the file has been removed due to copyright infringement issues." in html: - raise Exception('File Not Found or removed') - - filename = re.compile('').findall(html)[0] - data = {'op': 'download1', 'method_free': '1', 'usr_login': '', 'id': media_id, 'fname': filename} - - data.update(captcha_lib.do_captcha(html)) - html = self.net.http_POST(resp.get_url(), data).content - - # find packed javascript embed code - r = re.search('(eval.*?)\s*', html, re.DOTALL) - if r: - packed_data = r.group(1) - else: - common.addon.log_error('vidxden: packed javascript embed code not found') - raise Exception('packed javascript embed code not found') - - try: decrypted_data = jsunpack.unpack(packed_data) - except: pass - decrypted_data = decrypted_data.replace('\\', '') - # First checks for a flv url, then the if statement is for the avi url - r = re.search('[\'"]file[\'"]\s*,\s*[\'"]([^\'"]+)', decrypted_data) - if not r: - r = re.search('src="(.+?)"', decrypted_data) - if r: - stream_url = r.group(1) - else: - raise Exception('vidxden: stream url not found') - - return "%s" % (stream_url) - - except urllib2.HTTPError, e: - common.addon.log_error('Vidxden: got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log_error('**** Vidxden Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + return stream_url def get_url(self, host, media_id): if 'vidbux' in host: diff --git a/lib/urlresolver/plugins/vidzi.py b/lib/urlresolver/plugins/vidzi.py index 9332f916..31715e4e 100644 --- a/lib/urlresolver/plugins/vidzi.py +++ b/lib/urlresolver/plugins/vidzi.py @@ -35,27 +35,17 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content - if '404 Not Found' in html: - raise Exception('File Not Found or removed') + if '404 Not Found' in html: + raise UrlResolver.ResolverError('File Not Found or removed') - r = re.search('.+file:\s"(.+?)"', html) - if not r: - raise Exception('Unable to locate link') - else: - stream_url = r.group(1) - return stream_url + '|Referer=http://vidzi.tv/nplayer/jwplayer.flash.swf' - - except urllib2.HTTPError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log_error('**** Vidzi Error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + r = re.search('.+file:\s"(.+?)"', html) + if r: + return r.group(1) + '|Referer=http://vidzi.tv/nplayer/jwplayer.flash.swf' + else: + raise UrlResolver.ResolverError('Unable to locate link') def get_url(self, host, media_id): return 'http://%s/%s.html' % (host, media_id) diff --git a/lib/urlresolver/plugins/vidzur.py b/lib/urlresolver/plugins/vidzur.py index 892e44b8..9f11714f 100644 --- a/lib/urlresolver/plugins/vidzur.py +++ b/lib/urlresolver/plugins/vidzur.py @@ -24,10 +24,10 @@ from urlresolver import common import re -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class VidzurResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidzur.com" - domains = [ "vidzur.com" ] + domains = ["vidzur.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -51,21 +51,13 @@ def valid_url(self, url, host): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name common.addon.log(media_id) common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False + resp = self.net.http_GET(web_url) + html = resp.content r = re.search("playlist\s*:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\n*\s*url:\s*'(.+?)'", html) if r: stream_url = urllib.unquote_plus(r.group(1)) else: - common.addon.log_error(hostname+': stream url not found') - return self.unresolvable(code=0, msg='no file located') #return False + raise UrlResolver.ResolverError('no file located') return stream_url - diff --git a/lib/urlresolver/plugins/vimeo.py b/lib/urlresolver/plugins/vimeo.py index d1942bb1..88d1ae67 100644 --- a/lib/urlresolver/plugins/vimeo.py +++ b/lib/urlresolver/plugins/vimeo.py @@ -18,7 +18,6 @@ import re from t0mm0.common.net import Net -import urllib2 from urlresolver import common from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings @@ -27,7 +26,7 @@ class VimeoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vimeo" - domains = [ "vimeo.com" ] + domains = ["vimeo.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -35,15 +34,12 @@ def __init__(self): def get_media_url(self, host, media_id): #just call vimeo addon - plugin = 'plugin://plugin.video.vimeo/?action=play_video&videoid=' +\ - media_id + plugin = 'plugin://plugin.video.vimeo/?action=play_video&videoid=' + media_id return plugin - def get_url(self, host, media_id): return 'http://vimeo.com/%s' % media_id - def get_host_and_id(self, url): r = re.findall('/([0-9]+)', url) if r: @@ -54,7 +50,6 @@ def get_host_and_id(self, url): common.addon.log_error('vimeo: video id not found') return False - def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False return re.match('http://(.+)?vimeo.com/(video\/)?[0-9]+', diff --git a/lib/urlresolver/plugins/vivosx.py b/lib/urlresolver/plugins/vivosx.py index 6bf09d6e..d086bd65 100644 --- a/lib/urlresolver/plugins/vivosx.py +++ b/lib/urlresolver/plugins/vivosx.py @@ -25,7 +25,6 @@ import re import os -net = Net() class VivosxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vivosx" @@ -37,40 +36,35 @@ def __init__(self): self.net = Net() def get_media_url(self, host, media_id): - try: - web_url = self.get_url(host, media_id) - - # get landing page - html = self.net.http_GET(web_url, headers = {'Referer':web_url}).content - - # read POST variables into data - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) - if not r: raise Exception('page structure changed') - for name, value in r: data[name] = value - - # get delay from hoster; actually this is not needed, but we are polite - delay = 5 - r = re.search(r'var RequestWaiting = (\d+);', html) - if r: delay = r.groups(1)[0] - - # get video page using POST variables - html = self.net.http_POST(web_url, data, headers = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'})).content - - # search for content tag - r = re.search(r'class="stream-content" data-url', html) - if not r: raise Exception('page structure changed') - - # read the data-url - r = re.findall(r'data-url="?(.+?)"', html) - if not r: raise Exception('video not found') - - # return media URL - return r[0] + web_url = self.get_url(host, media_id) - except Exception, e: - common.addon.log('vivosx: general error occured: %s' % e) - return self.unresolvable(code=0, msg=e) + # get landing page + html = self.net.http_GET(web_url, headers = {'Referer':web_url}).content + + # read POST variables into data + data = {} + r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) + if not r: raise Exception('page structure changed') + for name, value in r: data[name] = value + + # get delay from hoster; actually this is not needed, but we are polite + delay = 5 + r = re.search(r'var RequestWaiting = (\d+);', html) + if r: delay = r.groups(1)[0] + + # get video page using POST variables + html = self.net.http_POST(web_url, data, headers = ({'Referer':web_url, 'X-Requested-With':'XMLHttpRequest'})).content + + # search for content tag + r = re.search(r'class="stream-content" data-url', html) + if not r: raise UrlResolver.ResolverError('page structure changed') + + # read the data-url + r = re.findall(r'data-url="?(.+?)"', html) + if not r: raise UrlResolver.ResolverError('video not found') + + # return media URL + return r[0] def get_url(self, host, media_id): return 'http://vivo.sx/%s' % media_id diff --git a/lib/urlresolver/plugins/vk.py b/lib/urlresolver/plugins/vk.py index cb2bc2ec..1c2d05b1 100644 --- a/lib/urlresolver/plugins/vk.py +++ b/lib/urlresolver/plugins/vk.py @@ -1,4 +1,4 @@ -#-*- coding: utf-8 -*- +# -*- coding: utf-8 -*- """ VK urlresolver XBMC Addon @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import urllib2, os, re, xbmcgui +import re +import xbmcgui from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings @@ -27,85 +28,69 @@ from urlresolver import common import simplejson as json -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') -#SET OK_LOGO# -ok_logo = os.path.join(common.addon_path, 'resources', 'images', 'greeninch.png') - - class VKResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "VK.com" - domains = [ "vk.com" ] + domains = ["vk.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - + def get_media_url(self, host, media_id): base_url = self.get_url(host, media_id) - try: - soup = self.net.http_GET(base_url).content - html = soup.decode('cp1251') - vars_s = re.findall("""var vars = (.+)""",html) - if vars_s : - jsonvars = json.loads(vars_s[0]) - purged_jsonvars = {} - for item in jsonvars : - if re.search('url[0-9]+', str(item)) : - purged_jsonvars[item] = jsonvars[item] - lines = [] - ls_url = [] - best='0' - for item in purged_jsonvars : - ls_url.append(item) - quality = item.lstrip('url') - lines.append(str(quality)) - if int(quality)>int(best): best=quality + soup = self.net.http_GET(base_url).content + html = soup.decode('cp1251') + vars_s = re.findall("""var vars = (.+)""", html) + if vars_s: + jsonvars = json.loads(vars_s[0]) + purged_jsonvars = {} + for item in jsonvars: + if re.search('url[0-9]+', str(item)): + purged_jsonvars[item] = jsonvars[item] + lines = [] + ls_url = [] + best = '0' + for item in purged_jsonvars: + ls_url.append(item) + quality = item.lstrip('url') + lines.append(str(quality)) + if int(quality) > int(best): best = quality - if len(ls_url) == 1 : - return purged_jsonvars[ls_url[0]].encode('utf-8') + if len(ls_url) == 1: + return purged_jsonvars[ls_url[0]].encode('utf-8') + else: + if self.get_setting('auto_pick') == 'true': + return purged_jsonvars['url%s' % (str(best))].encode('utf-8') else: - if self.get_setting('auto_pick')=='true': - return purged_jsonvars['url%s' % (str(best))].encode('utf-8') - else: - result = xbmcgui.Dialog().select('Choose the link', lines) - if result != -1 : - return purged_jsonvars[ls_url[result]].encode('utf-8') - else : - return self.unresolvable(0,'No link selected') - else : - return self.unresolvable(0,'No var_s found') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** VK Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]VK[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + result = xbmcgui.Dialog().select('Choose the link', lines) + if result != -1: + return purged_jsonvars[ls_url[result]].encode('utf-8') + else: + raise UrlResolver.ResolverError('No link selected') + else: + raise UrlResolver.ResolverError('No var_s found') def get_url(self, host, media_id): return 'http://%s.com/video_ext.php?%s' % (host, media_id) def get_host_and_id(self, url): r = re.search('http[s]*://(?:www.)?(.+?).com/video_ext.php\?(.+)', url) - if r : + if r: ls = r.groups() if ls[0] == 'www.' or ls[0] == None : - ls = (ls[1],ls[2]) + ls = (ls[1], ls[2]) return ls else : return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': + if self.get_setting('enabled') == 'false': return False - return re.match('http[s]*://(?:www.)?vk.com/video_ext.php\?.+',url) or 'vk' in host + return re.match('http[s]*://(?:www.)?vk.com/video_ext.php\?.+', url) or 'vk' in host def get_settings_xml(self): xml = PluginSettings.get_settings_xml(self) - xml += '' % (self.__class__.__name__) + xml += '' % (self.__class__.__name__) return xml diff --git a/lib/urlresolver/plugins/vodlocker.py b/lib/urlresolver/plugins/vodlocker.py index 83cd4e95..94f25152 100644 --- a/lib/urlresolver/plugins/vodlocker.py +++ b/lib/urlresolver/plugins/vodlocker.py @@ -16,60 +16,45 @@ along with this program. If not, see . """ -import os -import xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2 from urlresolver import common -logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class VodlockerResolver(Plugin, UrlResolver, PluginSettings): - implements=[UrlResolver,PluginSettings] - name="vodlocker.com" - domains=[ "vodlocker.com" ] - + implements = [UrlResolver, PluginSettings] + name = "vodlocker.com" + domains = ["vodlocker.com"] + def __init__(self): - p=self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - self.pattern='http://((?:www.)?vodlocker.com)/(?:embed-)?([0-9a-zA-Z]+)(?:-\d+x\d+.html)?' - - def get_url(self,host,media_id): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?vodlocker.com)/(?:embed-)?([0-9a-zA-Z]+)(?:-\d+x\d+.html)?' + + def get_url(self, host, media_id): return 'http://vodlocker.com/embed-%s-640x400.html' % (media_id) - def get_host_and_id(self,url): - r=re.search(self.pattern,url) + 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): - try: - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content + 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 - if link.find('404 Not Found') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + link = self.net.http_GET(web_url).content + if link.find('404 Not Found') >= 0: + raise UrlResolver.ResolverError('The requested video was not found.') - video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) + video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) - if len(video_link) > 0: - return video_link - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) + if len(video_link) > 0: + return video_link + else: + raise UrlResolver.ResolverError('No playable video found.') diff --git a/lib/urlresolver/plugins/vshare.py b/lib/urlresolver/plugins/vshare.py index e5e6227b..378611f8 100644 --- a/lib/urlresolver/plugins/vshare.py +++ b/lib/urlresolver/plugins/vshare.py @@ -16,59 +16,44 @@ along with this program. If not, see . """ -import os -import xbmc +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re -import urllib2 from urlresolver import common -logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class VshareResolver(Plugin, UrlResolver, PluginSettings): - implements=[UrlResolver,PluginSettings] - name="vshare" + implements = [UrlResolver, PluginSettings] + name = "vshare" + domains = ['vshare.io'] def __init__(self): - p=self.get_setting('priority') or 100 - self.priority=int(p) - self.net=Net() - self.pattern='http://((?:www.)?vshare.io)/\w?/(\w+)(?:\/width-\d+/height-\d+/)?' - - def get_url(self,host,media_id): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + self.pattern = 'http://((?:www.)?vshare.io)/\w?/(\w+)(?:\/width-\d+/height-\d+/)?' + + def get_url(self, host, media_id): return 'http://vshare.io/v/%s/width-620/height-280/' % (media_id) - def get_host_and_id(self,url): - r=re.search(self.pattern,url) + 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): - try: - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - - if link.find('404 - Error') >= 0: - err_title = 'Content not available.' - err_message = 'The requested video was not found.' - common.addon.log_error(self.name + ' - fetching %s - %s - %s ' % (web_url,err_title,err_message)) - xbmc.executebuiltin('XBMC.Notification([B][COLOR white]'+__name__+'[/COLOR][/B] - '+err_title+',[COLOR red]'+err_message+'[/COLOR],8000,'+logo+')') - return self.unresolvable(1, err_message) - - video_link = str(re.compile("url[: ]*'(.+?)'").findall(link)[0]) - - if len(video_link) > 0: - return video_link - else: - return self.unresolvable(0, 'No playable video found.') - except urllib2.URLError, e: - return self.unresolvable(3, str(e)) - except Exception, e: - return self.unresolvable(0, str(e)) + 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) + link = self.net.http_GET(web_url).content + if link.find('404 - Error') >= 0: + raise UrlResolver.ResolverError('The requested video was not found.') + + video_link = str(re.compile("url[: ]*'(.+?)'").findall(link)[0]) + if len(video_link) > 0: + return video_link + else: + raise UrlResolver.ResolverError('No playable video found.') diff --git a/lib/urlresolver/plugins/watchfreeinhd.py b/lib/urlresolver/plugins/watchfreeinhd.py index 7a105de7..fea8a660 100644 --- a/lib/urlresolver/plugins/watchfreeinhd.py +++ b/lib/urlresolver/plugins/watchfreeinhd.py @@ -16,58 +16,42 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os, urllib2 from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -class watchfreeResolver(Plugin, UrlResolver, PluginSettings): +class WatchFreeResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "watchfreeinhd" - domains = [ "watchfreeinhd.com" ] - + domains = ["watchfreeinhd.com"] def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) self.net = Net() - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - try: - html=self.net.http_POST(web_url,{'agree':'Yes, let me watch'}).content - link=re.findall('',html) - if link: - return link[0] - raise Exception ('File Not Found or removed') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Watchfreeinhd Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]WATCHFREEINHD[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + html = self.net.http_POST(web_url, {'agree': 'Yes, let me watch'}).content + link = re.findall('', html) + if link: + return link[0] + else: + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): - return 'http://www.%s.com/%s' % (host,media_id) - - + return 'http://www.%s.com/%s' % (host, media_id) + def get_host_and_id(self, url): - r = re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)',url) + r = re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)', 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(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)',url) or 'watchfree' in host) + return (re.match(r'http://www.(watchfreeinhd).com/([0-9A-Za-z]+)', url) or 'watchfree' in host) diff --git a/lib/urlresolver/plugins/xvidstage.py b/lib/urlresolver/plugins/xvidstage.py index 9bec2dbb..aab3627c 100644 --- a/lib/urlresolver/plugins/xvidstage.py +++ b/lib/urlresolver/plugins/xvidstage.py @@ -16,18 +16,18 @@ along with this program. If not, see . """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os, urllib2 from urlresolver import common from lib import jsunpack class XvidstageResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "xvidstage" - domains = [ "xvidstage.com" ] + domains = ["xvidstage.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -38,35 +38,18 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - try: - html = self.net.http_GET(web_url).content - - # removed check. - # get url from packed javascript - sPattern = "src='http://xvidstage.com/player/swfobject.js'>.+?"# Modded - r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) + html = self.net.http_GET(web_url).content + sPattern = "src='http://xvidstage.com/player/swfobject.js'>.+?"# Modded + r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE) + if r: + sJavascript = r.group(1) + sUnpacked = jsunpack.unpack(sJavascript) + sPattern = "'file','(.+?)'"#modded + r = re.search(sPattern, sUnpacked) if r: - sJavascript = r.group(1) - sUnpacked = jsunpack.unpack(sJavascript) - sPattern = "'file','(.+?)'"#modded - r = re.search(sPattern, sUnpacked) - if r: - return r.group(1) - raise Exception ('File Not Found or removed') - - raise Exception ('File Not Found or removed') - - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - - except Exception, e: - common.addon.log('**** Xvidstage Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]XVIDSTAGE[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + return r.group(1) + + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://www.xvidstage.com/%s' % (media_id) diff --git a/lib/urlresolver/plugins/yourupload.py b/lib/urlresolver/plugins/yourupload.py index 947f6766..fb68d560 100644 --- a/lib/urlresolver/plugins/yourupload.py +++ b/lib/urlresolver/plugins/yourupload.py @@ -20,16 +20,15 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib,urllib2 +import urllib, urllib2 from urlresolver import common import re - -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class YourUploadResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "yourupload.com" domains = [ "yourupload.com" ] - + def __init__(self): p = self.get_setting('priority') or 100 self.priority = int(p) @@ -39,49 +38,49 @@ def __init__(self): # http://embed.yourupload.com/2o6B1y?client_file_id=380101&width=600&height=438 self.pattern = 'http://((?:www.)?yourupload.com)/embed/([0-9a-zA-Z]+)[\?&]*' self.pattern2 = 'http://((?:www.)?yourupload.com)/embed_ext/[0-9A-Za-z]+/([0-9a-zA-Z]+)[\?&]*' - #self.pattern3 = 'http://embed.(yourupload.com)/([0-9a-zA-Z]+\?.*?client_file_id=[0-9a-zA-Z]+)[&]*' - #self.pattern3 = 'http://((?:embed.)?yourupload.com)/(.+?client_file_id.+?)' + # self.pattern3 = 'http://embed.(yourupload.com)/([0-9a-zA-Z]+\?.*?client_file_id=[0-9a-zA-Z]+)[&]*' + # self.pattern3 = 'http://((?:embed.)?yourupload.com)/(.+?client_file_id.+?)' self.pattern3 = 'http://embed.(yourupload.com)/(.+?)' - #self.pattern = 'http://((?:www.)?yourupload.com)/embed/(.+?)' - + # self.pattern = 'http://((?:www.)?yourupload.com)/embed/(.+?)' + def get_url(self, host, media_id): - common.addon.log(host+' - media_id: %s' % media_id) - if len(media_id) > 5: common.addon.log_notice('1st 4 digits: '+media_id[:4]) - if media_id[:4]=='ext_': - common.addon.log_notice(media_id[4:]+': media_id is for an external video source') - return 'http://yourupload.com/embed_ext/videoweed/%s' % (media_id[4:]) + common.addon.log(host + ' - media_id: %s' % media_id) + if len(media_id) > 5: common.addon.log_notice('1st 4 digits: ' + media_id[:4]) + if media_id[:4] == 'ext_': + common.addon.log_notice(media_id[4:] + ': media_id is for an external video source') + return 'http://yourupload.com/embed_ext/videoweed/%s' % (media_id[4:]) elif ('___' in media_id): - r=media_id.split('___')[0] - s=media_id.split('___')[1] - common.addon.log_notice(media_id+': media_id is for 2 ID types') - return 'http://embed.yourupload.com/%s?client_file_id=%s' % (r,s) + r = media_id.split('___')[0] + s = media_id.split('___')[1] + common.addon.log_notice(media_id + ': media_id is for 2 ID types') + return 'http://embed.yourupload.com/%s?client_file_id=%s' % (r, s) elif ('client_file_id' in media_id): - common.addon.log_notice(media_id+': media_id is for 2 ID types') - return 'http://embed.yourupload.com/%s' % (media_id) + common.addon.log_notice(media_id + ': media_id is for 2 ID types') + return 'http://embed.yourupload.com/%s' % (media_id) elif ('=' in media_id) or ('&' in media_id) or ('?' in media_id) or ('client' in media_id): - common.addon.log_notice(media_id+': media_id is for 2 ID types') - return 'http://embed.yourupload.com/%s' % (media_id) + common.addon.log_notice(media_id + ': media_id is for 2 ID types') + return 'http://embed.yourupload.com/%s' % (media_id) else: return 'http://yourupload.com/embed/%s' % (media_id) - + def get_host_and_id(self, url): common.addon.log_notice('get host and id from: %s' % url) - if 'yourupload.com/embed_ext' in url: r = re.search(self.pattern2, url); s='ext_' - elif ('embed.yourupload.com' in url): - r = re.search('/([0-9a-zA-Z]+)\?', url).group(1) - s = re.search('client_file_id=([0-9a-zA-Z]+)', url).group(1) - return [r+'___'+s,'embed.yourupload.com'] - elif ('embed.yourupload.com/' in url): - r = url.split('yourupload.com/')[1]; s='' - return [r,'embed.yourupload.com'] - elif ('embed.yourupload.com' in url): r = re.search(self.pattern3, url); s='' - else: r = re.search(self.pattern, url); s='' - #if r: return s+r.groups() - if r: return [r.group(1),s+r.group(2)] - else: - common.addon.log_notice('failed to get host and id: %s' % url) - #return 'failed to get host and id: %s' - return False - + if 'yourupload.com/embed_ext' in url: r = re.search(self.pattern2, url); s = 'ext_' + elif ('embed.yourupload.com' in url): + r = re.search('/([0-9a-zA-Z]+)\?', url).group(1) + s = re.search('client_file_id=([0-9a-zA-Z]+)', url).group(1) + return [r + '___' + s, 'embed.yourupload.com'] + elif ('embed.yourupload.com/' in url): + r = url.split('yourupload.com/')[1]; s = '' + return [r, 'embed.yourupload.com'] + elif ('embed.yourupload.com' in url): r = re.search(self.pattern3, url); s = '' + else: r = re.search(self.pattern, url); s = '' + # if r: return s+r.groups() + if r: return [r.group(1), s + r.group(2)] + else: + common.addon.log_notice('failed to get host and id: %s' % url) + # return 'failed to get host and id: %s' + return False + def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False elif ('yourupload.com' in url) or ('yourupload.com' in host): return True @@ -91,31 +90,17 @@ def valid_url(self, url, host): elif 'yourupload.com/embed_ext/' in url: return re.match(self.pattern2, url) or self.name in host elif ('http://embed.yourupload.com/' in url) and ('client_file_id' in url): return re.match(self.pattern3, url) or self.name in host else: return re.match(self.pattern, url) or self.name in host - + def get_media_url(self, host, media_id): - common.addon.log_notice(host+' - media_id: %s' % media_id) web_url = self.get_url(host, media_id) - post_url = web_url - hostname = self.name - common.addon.log_notice(hostname+' - web_url: %s' % web_url) - common.addon.log(web_url) - try: - resp = self.net.http_GET(web_url) - html = resp.content - except urllib2.URLError, e: - common.addon.log_error(hostname+': got http error %d fetching %s' % (e.code, web_url)) - return self.unresolvable(code=3, msg='Exception: %s' % e) #return False - try: - if ' -1: queries = common.addon.parse_query(url.split('?')[1]) @@ -55,8 +51,7 @@ def get_host_and_id(self, url): if video_id: return ('youtube.com', video_id) else: - common.addon.log_error('youtube: video id not found') - return self.unresolvable(code=0, msg="youtube: video id not found") + return False def valid_url(self, url, host): if self.get_setting('enabled') == 'false': return False diff --git a/lib/urlresolver/plugins/youwatch.py b/lib/urlresolver/plugins/youwatch.py index 24b93126..e70d60a3 100644 --- a/lib/urlresolver/plugins/youwatch.py +++ b/lib/urlresolver/plugins/youwatch.py @@ -25,13 +25,7 @@ from urlresolver.plugnplay import Plugin from urlresolver import common -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') -#SET OK_LOGO# -ok_logo = os.path.join(common.addon_path, 'resources', 'images', 'greeninch.png') - class Base36: - def __init__(self,ls=False): self.ls = False if ls : @@ -63,13 +57,12 @@ def param36decode(self,match_object) : else : return False - -class YouwatchResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): +class YouWatchResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "youwatch" - domains = [ "youwatch.org" ] - profile_path = common.profile_path - cookie_file = os.path.join(profile_path, '%s.cookies' % name) + domains = ["youwatch.org"] + profile_path = common.profile_path + cookie_file = os.path.join(profile_path, '%s.cookies' % name) def __init__(self): p = self.get_setting('priority') or 100 @@ -82,36 +75,26 @@ def __init__(self): def get_media_url(self, host, media_id): base_url = 'http://'+host+'.org/embed-'+media_id+'.html' - try: - soup = self.net.http_GET(base_url).content - html = soup.decode('utf-8') - jscript = re.findall("""function\(p,a,c,k,e,d\).*return p\}(.*)\)""",html) - if jscript : - lsParam = eval(jscript[0].encode('utf-8')) - flashvars = self.exec_javascript(lsParam) - r = re.findall('file:"(.*)",provider',flashvars) - if r : - stream_url = r[0].encode('utf-8') - if self.get_setting('login') == 'true' : - cookies = {} - for cookie in self.net._cj: - cookies[cookie.name] = cookie.value - stream_url = stream_url + '|' + urllib.urlencode({'Cookie' :urllib.urlencode(cookies)}) - common.addon.log('stream_URL : '+stream_url) - else : - raise Exception ('File Not Found or removed') - else : - raise Exception ('File Not Found or removed') - return stream_url - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Youwatch Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + soup = self.net.http_GET(base_url).content + html = soup.decode('utf-8') + jscript = re.findall("""function\(p,a,c,k,e,d\).*return p\}(.*)\)""", html) + if jscript: + lsParam = eval(jscript[0].encode('utf-8')) + flashvars = self.exec_javascript(lsParam) + r = re.findall('file:"(.*)",provider', flashvars) + if r: + stream_url = r[0].encode('utf-8') + if self.get_setting('login') == 'true': + cookies = {} + for cookie in self.net._cj: + cookies[cookie.name] = cookie.value + stream_url = stream_url + '|' + urllib.urlencode({'Cookie' :urllib.urlencode(cookies)}) + common.addon.log_debug('stream_URL : ' + stream_url) + else: + raise UrlResolver.ResolverError('File Not Found or removed') + else: + raise UrlResolver.ResolverError('File Not Found or removed') + return stream_url def get_url(self, host, media_id): return 'http://youwatch.org/%s' % media_id @@ -120,7 +103,7 @@ def get_host_and_id(self, url): r = re.search('http://(www.)?(.+?).org/embed-(.+?)-[0-9A-Za-z]+.html', url) if not r: r = re.search('http://(www.)?(.+?).org/([0-9A-Za-z]+)', url) - if r : + if r: ls = r.groups() if ls[0] == 'www.' or ls[0] == None : ls = (ls[1],ls[2]) @@ -138,28 +121,24 @@ def valid_url(self, url, host): def login(self): if self.get_setting('login') == 'true': - try : - common.addon.log('login to youwatch') + try: + common.addon.log_debug('login to youwatch') url = 'http://youwatch.org' - data = {'op':'login', 'login' : self.get_setting('username'), 'password' : self.get_setting('password')} - source = self.net.http_POST(url,data).content - if re.search('Registred', source): - common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN [/COLOR][/B]', msg='[COLOR green]Logged[/COLOR]', delay=5000, image=ok_logo) + data = {'op':'login', 'login' : self.get_setting('username'), 'password' : self.get_setting('password')} + source = self.net.http_POST(url,data).content + if re.search('Registred', source): self.net.save_cookies(self.cookie_file) self.net.set_cookies(self.cookie_file) return True elif re.search('Incorrect Login or Password', source) : - common.addon.log('**** Youwatch Error occured on login: Incorrect Login or Password') - common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN ERROR [/COLOR][/B]', msg='[COLOR red]Incorrect Login or Password[/COLOR]', delay=5000, image=error_logo) + common.addon.log_error('**** Youwatch Error occured on login: Incorrect Login or Password') return False else: - common.addon.log('**** Youwatch Error occured on login: not logged') - common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN ERROR [/COLOR][/B]', msg='[COLOR red]not logged[/COLOR]', delay=5000, image=error_logo) + common.addon.log_error('**** Youwatch Error occured on login: not logged') return False - except Exception, e : - common.addon.log('**** Youwatch Error occured on login: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]YOUWATCH LOGIN ERROR [/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - else : + except Exception as e : + common.addon.log_error('**** Youwatch Error occured on login: %s' % e) + else: return True def get_settings_xml(self): diff --git a/lib/urlresolver/plugins/zalaa.py b/lib/urlresolver/plugins/zalaa.py index 4b331924..3526dce5 100644 --- a/lib/urlresolver/plugins/zalaa.py +++ b/lib/urlresolver/plugins/zalaa.py @@ -16,22 +16,17 @@ along with this program. If not, see . """ +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2, re, os from urlresolver import common -from lib import jsunpack - -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - class ZalaaResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "zalaa" - domains = [ "zalaa.com" ] + domains = ["zalaa.com"] def __init__(self): p = self.get_setting('priority') or 100 @@ -41,42 +36,30 @@ def __init__(self): #FIXME: http://www.zalaa.com/npwp1cr4uys7/Nikita.S02E14.HDTV.XviD-LOL.avi.htm self.pattern = 'http://www.(zalaa.com)/([a-zA-Z0-9]+)(?:/.+?\.htm)?' - def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content - try: - html = self.net.http_GET(web_url).content - - #send all form values - sPattern = ']+)>' - r = re.findall(sPattern, html) - data = {} - if r: - for match in r: - name = match[0] - value = match[1].replace('"','') - data[name] = value - - html = self.net.http_POST(web_url, data).content - else: - raise Exception ('File Not Found or removed') + #send all form values + sPattern = ']+)>' + r = re.findall(sPattern, html) + data = {} + if r: + for match in r: + name = match[0] + value = match[1].replace('"', '') + data[name] = value - # modified by mscreations. get the file url from the returned javascript - match = re.search("addVariable[(]'file','(.+?)'[)]", html, re.DOTALL + re.IGNORECASE) - if match: - return match.group(1)+'|Referer=http%3A%2F%2Fwww.zalaa.com%2Fplayer%2Fplayer-embed.swf' + html = self.net.http_POST(web_url, data).content + else: + raise UrlResolver.ResolverError('File Not Found or removed') - raise Exception ('File Not Found or removed') - except urllib2.URLError, e: - common.addon.log_error(self.name + ': got http error %d fetching %s' % - (e.code, web_url)) - common.addon.show_small_popup('Error','Http error: '+str(e), 8000, error_logo) - return self.unresolvable(code=3, msg=e) - except Exception, e: - common.addon.log('**** Zalaa Error occured: %s' % e) - common.addon.show_small_popup(title='[B][COLOR white]ZALAA[/COLOR][/B]', msg='[COLOR red]%s[/COLOR]' % e, delay=5000, image=error_logo) - return self.unresolvable(code=0, msg=e) + # modified by mscreations. get the file url from the returned javascript + match = re.search("addVariable[(]'file','(.+?)'[)]", html, re.DOTALL + re.IGNORECASE) + if match: + return match.group(1) + '|Referer=http%3A%2F%2Fwww.zalaa.com%2Fplayer%2Fplayer-embed.swf' + else: + raise UrlResolver.ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://www.zalaa.com/%s' % (media_id) @@ -88,7 +71,6 @@ def get_host_and_id(self, url): 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 From 20933b6406b6cc8e03f0af0e36e9f6bfcc3c84cf Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 9 Apr 2015 03:32:24 -0400 Subject: [PATCH 0666/1360] clean up duplicate net creation --- lib/urlresolver/plugins/180upload.py | 5 ++--- lib/urlresolver/plugins/cyberlocker.py | 16 +++------------- lib/urlresolver/plugins/donevideo.py | 9 +++------ lib/urlresolver/plugins/hugefiles.py | 4 +--- lib/urlresolver/plugins/limevideo.py | 8 ++------ lib/urlresolver/plugins/movreel.py | 12 +++++------- lib/urlresolver/plugins/sharedsx.py | 11 ++++------- lib/urlresolver/plugins/sharerepo.py | 5 ++--- lib/urlresolver/plugins/veeHD.py | 6 ++---- 9 files changed, 24 insertions(+), 52 deletions(-) diff --git a/lib/urlresolver/plugins/180upload.py b/lib/urlresolver/plugins/180upload.py index f4d786f8..fdf1315d 100644 --- a/lib/urlresolver/plugins/180upload.py +++ b/lib/urlresolver/plugins/180upload.py @@ -25,7 +25,6 @@ from lib import jsunpack from lib import captcha_lib -net = Net() USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:36.0) Gecko/20100101 Firefox/36.0' class OneeightyuploadResolver(Plugin, UrlResolver, PluginSettings): @@ -50,7 +49,7 @@ def __get_link(self, url): 'User-Agent': USER_AGENT } common.addon.log_debug('180upload: get_link: %s' % (url)) - html = net.http_GET(url, headers).content + html = self.net.http_GET(url, headers).content #Re-grab data values data = {} @@ -68,7 +67,7 @@ def __get_link(self, url): common.addon.log_debug('180Upload - Requesting POST URL: %s with data: %s' % (url, data)) data['referer'] = url - html = net.http_POST(url, data, headers).content + html = self.net.http_POST(url, data, headers).content # try download link link = re.search('id="lnk_download[^"]*" href="([^"]+)', html) diff --git a/lib/urlresolver/plugins/cyberlocker.py b/lib/urlresolver/plugins/cyberlocker.py index ab8487de..9c3a6697 100644 --- a/lib/urlresolver/plugins/cyberlocker.py +++ b/lib/urlresolver/plugins/cyberlocker.py @@ -16,25 +16,18 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import re, os, urllib2 -import xbmcgui from urlresolver import common from lib import jsunpack -#SET ERROR_LOGO# THANKS TO VOINAGE, BSTRDMKR, ELDORADO -error_logo = os.path.join(common.addon_path, 'resources', 'images', 'redx.png') - -net = Net() - class CyberlockerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "cyberlocker" - domains = [ "cyberlocker.ch" ] - + domains = ["cyberlocker.ch"] def __init__(self): p = self.get_setting('priority') or 100 @@ -54,7 +47,7 @@ def get_media_url(self, host, media_id): data[name] = value data['method_free'] = 'Wait for 0 seconds' - html = net.http_POST(url, data).content + html = self.net.http_POST(url, data).content sPattern = '' diff --git a/lib/urlresolver/plugins/movreel.py b/lib/urlresolver/plugins/movreel.py index 8bf4ec6e..ca33b8b5 100644 --- a/lib/urlresolver/plugins/movreel.py +++ b/lib/urlresolver/plugins/movreel.py @@ -29,9 +29,7 @@ from urlresolver.plugnplay.interfaces import SiteAuth from urlresolver import common -net = Net() - -class movreelResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): +class MovreelResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "movreel" domains = ["movreel.com"] @@ -48,7 +46,7 @@ def __init__(self): pass def get_media_url(self, host, media_id): - net.set_cookies(self.cookie_file) + self.net.set_cookies(self.cookie_file) web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content if re.search('This server is in maintenance mode', html): @@ -71,7 +69,7 @@ def get_media_url(self, host, media_id): wait_time = 2 # default to 2 seconds xbmc.sleep(int(wait_time) * 1000) - html = net.http_POST(web_url, data).content + html = self.net.http_POST(web_url, data).content r = re.search('href="([^"]+)">Download Link', html) if r: @@ -83,7 +81,7 @@ def get_url(self, host, media_id): return 'http://www.movreel.com/%s' % media_id def get_host_and_id(self, url): - r = re.search('//(.+?)/([0-9a-zA-Z]+)',url) + r = re.search('//(.+?)/([0-9a-zA-Z]+)', url) if r: return r.groups() else: @@ -102,7 +100,7 @@ def login(self): login = self.get_setting('username') password = self.get_setting('password') data = {'op': 'login', 'login': login, 'password': password} - html = net.http_POST(loginurl, data).content + html = self.net.http_POST(loginurl, data).content if re.search('op=logout', html): self.net.save_cookies(self.cookie_file) common.addon.log('LOGIN SUCCESSFUL') diff --git a/lib/urlresolver/plugins/sharedsx.py b/lib/urlresolver/plugins/sharedsx.py index f4b8a9c7..07590fb1 100644 --- a/lib/urlresolver/plugins/sharedsx.py +++ b/lib/urlresolver/plugins/sharedsx.py @@ -16,20 +16,17 @@ along with this program. If not, see . ''' +import re from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -from time import sleep -import re -import os -net = Net() class SharedsxResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sharedsx" - domains = [ "shared.sx" ] + domains = ["shared.sx"] def __init__(self): p = self.get_setting('priority') or 100 @@ -71,10 +68,10 @@ def get_media_url(self, host, media_id): return r[0] def get_url(self, host, media_id): - return 'http://shared.sx/%s' % media_id + return 'http://shared.sx/%s' % media_id def get_host_and_id(self, url): - r = re.search('//(.+?)/([0-9a-zA-Z]+)',url) + r = re.search('//(.+?)/([0-9a-zA-Z]+)', url) if r: return r.groups() else: diff --git a/lib/urlresolver/plugins/sharerepo.py b/lib/urlresolver/plugins/sharerepo.py index d7372883..78406dd0 100644 --- a/lib/urlresolver/plugins/sharerepo.py +++ b/lib/urlresolver/plugins/sharerepo.py @@ -16,15 +16,14 @@ along with this program. If not, see . ''' +import re +import urllib2 from t0mm0.common.net import Net from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin from urlresolver import common -import re -import urllib2 -net = Net() USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' class SharerepoResolver(Plugin, UrlResolver, PluginSettings): diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py index bbcc54b2..310dae32 100644 --- a/lib/urlresolver/plugins/veeHD.py +++ b/lib/urlresolver/plugins/veeHD.py @@ -24,12 +24,10 @@ from urlresolver import common from t0mm0.common.net import Net -net = Net() - class veeHDResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "veeHD" - domains = [ "veehd.com" ] + domains = ["veehd.com"] profile_path = common.profile_path cookie_file = os.path.join(profile_path, '%s.cookies' % name) @@ -97,7 +95,7 @@ def login(self): terms = 'on' remember = 'on' data = {'ref': ref, 'uname': login, 'pword': pword, 'submit': submit, 'terms': terms, 'remember_me': remember} - html = net.http_POST(loginurl, data).content + html = self.net.http_POST(loginurl, data).content self.net.save_cookies(self.cookie_file) if re.search('my dashboard', html): return True From bd1f90b287460dcfa1fb888e51de6cff4f9b9538 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 9 Apr 2015 03:40:05 -0400 Subject: [PATCH 0667/1360] Cleanup resolver class names --- lib/urlresolver/plugins/bayfiles.py | 2 +- lib/urlresolver/plugins/cloudyvideos.py | 2 +- lib/urlresolver/plugins/crunchyroll.py | 2 +- lib/urlresolver/plugins/hostingbulk.py | 2 +- lib/urlresolver/plugins/megavids.py | 2 +- lib/urlresolver/plugins/mooshare_biz.py | 2 +- lib/urlresolver/plugins/mrfile.py | 2 +- lib/urlresolver/plugins/play44_net.py | 2 +- lib/urlresolver/plugins/purevid.py | 2 +- lib/urlresolver/plugins/sockshare.py | 2 +- lib/urlresolver/plugins/uploadcrazynet.py | 2 +- lib/urlresolver/plugins/veeHD.py | 2 +- lib/urlresolver/plugins/videomega.py | 2 +- lib/urlresolver/plugins/vidto.py | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/urlresolver/plugins/bayfiles.py b/lib/urlresolver/plugins/bayfiles.py index 5d4a11f8..d198a1fb 100644 --- a/lib/urlresolver/plugins/bayfiles.py +++ b/lib/urlresolver/plugins/bayfiles.py @@ -24,7 +24,7 @@ from urlresolver import common from time import time as wait -class bayfilesResolver(Plugin, UrlResolver, PluginSettings): +class BayfilesResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "bayfiles" domains = [ "bayfiles.com" ] diff --git a/lib/urlresolver/plugins/cloudyvideos.py b/lib/urlresolver/plugins/cloudyvideos.py index 68da87e2..fd4c774b 100644 --- a/lib/urlresolver/plugins/cloudyvideos.py +++ b/lib/urlresolver/plugins/cloudyvideos.py @@ -25,7 +25,7 @@ from lib import jsunpack import re -class CloudyvideosResolver(Plugin, UrlResolver, PluginSettings): +class CloudyVideosResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "cloudyvideos" domains = ["cloudyvideos.com"] diff --git a/lib/urlresolver/plugins/crunchyroll.py b/lib/urlresolver/plugins/crunchyroll.py index 3a6241fb..fb04b7c8 100644 --- a/lib/urlresolver/plugins/crunchyroll.py +++ b/lib/urlresolver/plugins/crunchyroll.py @@ -25,7 +25,7 @@ from urlresolver import common import os -class crunchyrollResolver(Plugin, UrlResolver, PluginSettings): +class CrunchyRollResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "crunchyroll" domains = [ "crunchyroll.com" ] diff --git a/lib/urlresolver/plugins/hostingbulk.py b/lib/urlresolver/plugins/hostingbulk.py index c42813aa..ca8fed06 100644 --- a/lib/urlresolver/plugins/hostingbulk.py +++ b/lib/urlresolver/plugins/hostingbulk.py @@ -26,7 +26,7 @@ from urlresolver import common from lib import jsunpack -class hostingbulkResolver(Plugin, UrlResolver, PluginSettings): +class HostingBulkResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "hostingbulk" domains = [ "hostingbulk.com" ] diff --git a/lib/urlresolver/plugins/megavids.py b/lib/urlresolver/plugins/megavids.py index 08816bff..41426c40 100644 --- a/lib/urlresolver/plugins/megavids.py +++ b/lib/urlresolver/plugins/megavids.py @@ -23,7 +23,7 @@ from urlresolver.plugnplay import Plugin from urlresolver import common -class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): +class MegaVidsResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mega-vids" domains = [ "mega-vids.com" ] diff --git a/lib/urlresolver/plugins/mooshare_biz.py b/lib/urlresolver/plugins/mooshare_biz.py index 8148ade1..ce38dcb6 100644 --- a/lib/urlresolver/plugins/mooshare_biz.py +++ b/lib/urlresolver/plugins/mooshare_biz.py @@ -24,7 +24,7 @@ from urlresolver.plugnplay import Plugin from urlresolver import common -class AllmyvideosResolver(Plugin, UrlResolver, PluginSettings): +class MooShareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mooshare" domains = [ "mooshare.biz" ] diff --git a/lib/urlresolver/plugins/mrfile.py b/lib/urlresolver/plugins/mrfile.py index c330c09d..01442053 100644 --- a/lib/urlresolver/plugins/mrfile.py +++ b/lib/urlresolver/plugins/mrfile.py @@ -23,7 +23,7 @@ from urlresolver import common import re -class mrfileResolver(Plugin, UrlResolver, PluginSettings): +class MrFileResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "mrfile" domains = ["mrfile.me"] diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py index 6f8abfd1..8284f3b9 100644 --- a/lib/urlresolver/plugins/play44_net.py +++ b/lib/urlresolver/plugins/play44_net.py @@ -24,7 +24,7 @@ from urlresolver import common import re -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class Play44Resolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "play44.net" domains = ["play44.net"] diff --git a/lib/urlresolver/plugins/purevid.py b/lib/urlresolver/plugins/purevid.py index 8041a286..fafe3184 100644 --- a/lib/urlresolver/plugins/purevid.py +++ b/lib/urlresolver/plugins/purevid.py @@ -28,7 +28,7 @@ from urlresolver.plugnplay import Plugin from urlresolver import common -class purevid(Plugin, UrlResolver, SiteAuth, PluginSettings): +class PurevidResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "purevid" domains = ["purevid.com"] diff --git a/lib/urlresolver/plugins/sockshare.py b/lib/urlresolver/plugins/sockshare.py index 7ea580b9..84a7e66b 100644 --- a/lib/urlresolver/plugins/sockshare.py +++ b/lib/urlresolver/plugins/sockshare.py @@ -27,7 +27,7 @@ from urlresolver.plugnplay import Plugin import time -class sockshareResolver(Plugin, UrlResolver, PluginSettings): +class SockshareResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "sockshare" domains = ["sockshare.com"] diff --git a/lib/urlresolver/plugins/uploadcrazynet.py b/lib/urlresolver/plugins/uploadcrazynet.py index 90f9b016..a01a807c 100644 --- a/lib/urlresolver/plugins/uploadcrazynet.py +++ b/lib/urlresolver/plugins/uploadcrazynet.py @@ -24,7 +24,7 @@ from urlresolver import common import re -class FilenukeResolver(Plugin, UrlResolver, PluginSettings): +class UploadCrazyResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "uploadcrazy.net" domains = ["uploadcrazy.net"] diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py index 310dae32..9289e4c6 100644 --- a/lib/urlresolver/plugins/veeHD.py +++ b/lib/urlresolver/plugins/veeHD.py @@ -24,7 +24,7 @@ from urlresolver import common from t0mm0.common.net import Net -class veeHDResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): +class VeeHDResolver(Plugin, UrlResolver, SiteAuth, PluginSettings): implements = [UrlResolver, SiteAuth, PluginSettings] name = "veeHD" domains = ["veehd.com"] diff --git a/lib/urlresolver/plugins/videomega.py b/lib/urlresolver/plugins/videomega.py index 60dc2f93..567c606d 100644 --- a/lib/urlresolver/plugins/videomega.py +++ b/lib/urlresolver/plugins/videomega.py @@ -27,7 +27,7 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -class VideomegaResolver(Plugin, UrlResolver, PluginSettings): +class VideoMegaResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "videomega" domains = ["videomega.tv", "movieshd.co"] diff --git a/lib/urlresolver/plugins/vidto.py b/lib/urlresolver/plugins/vidto.py index fb09128b..e4a283db 100644 --- a/lib/urlresolver/plugins/vidto.py +++ b/lib/urlresolver/plugins/vidto.py @@ -26,7 +26,7 @@ USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' -class vidto(Plugin, UrlResolver, PluginSettings): +class VidtoResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] name = "vidto" domains = ["vidto.me"] From a4d726e715b73b1abab46acc7b55745d7a40761a Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 9 Apr 2015 03:53:29 -0400 Subject: [PATCH 0668/1360] fix vidplay resolver --- lib/urlresolver/plugins/vidplay.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/vidplay.py b/lib/urlresolver/plugins/vidplay.py index 5f7fa906..3d65f9fb 100644 --- a/lib/urlresolver/plugins/vidplay.py +++ b/lib/urlresolver/plugins/vidplay.py @@ -41,7 +41,7 @@ def get_media_url(self, host, media_id): embed_url = 'http://vidplay.net/vidembed-%s' % (media_id) response = urllib2.urlopen(embed_url) if response.getcode() == 200 and response.geturl() != embed_url and response.geturl()[-3:].lower() in ['mp4', 'avi', 'mkv']: - return response.geturl() + return response.geturl() + '|User-Agent=%s' % (USER_AGENT) web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content @@ -62,14 +62,19 @@ def get_media_url(self, host, media_id): html = self.net.http_POST(web_url, data).content r = re.search('id="downloadbutton".*?href="([^"]+)', html) if r: - return r.group(1) + stream_url = r.group(1) else: r = re.search("file\s*:\s*'([^']+)", html) if r: - return r.group(1) + stream_url = r.group(1) else: raise UrlResolver.ResolverError('Unable to resolve VidPlay Link') + if stream_url: + return stream_url + '|User-Agent=%s' % (USER_AGENT) + else: + raise UrlResolver.ResolverError('Unable to resolve link') + def get_url(self, host, media_id): return 'http://vidplay.net/%s' % media_id From 3b8ec1c3085287b2b27fbb6c7007c060936d674f Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 9 Apr 2015 14:51:13 -0400 Subject: [PATCH 0669/1360] improve errors --- lib/urlresolver/types.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index 76340e45..efc1baaf 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -157,18 +157,18 @@ def resolve(self): self._host, self._media_id = resolver.get_host_and_id(self._url) try: stream_url = resolver.get_media_url(self._host, self._media_id) - if self.__test_stream(stream_url): + if stream_url and self.__test_stream(stream_url): self.__resolvers = [resolver] # Found a valid resolver, ignore the others self._valid_url = True return stream_url except UrlResolver.ResolverError as e: - common.addon.log_error('Resolver Error (%s) occurred: %s - %s' % (e, resolver.name, self._url)) + common.addon.log_error('Resolver Error: %s - %s - %s' % (e, resolver.name, self._url)) return UrlResolver.unresolvable(code=0, msg=e) except urllib2.HTTPError as e: - common.addon.log_error('HTTP Error (%d) resolving: %s - %s' % (e.code, resolver.name, self._url)) + common.addon.log_error('HTTP Error: %s - %s - %s - %s' % (e.code, resolver.name, self._url)) return UrlResolver.unresolvable(code=3, msg=e) except Exception as e: - common.addon.log_error('Unknown Error (%s) resolving: %s - %s' % (e, resolver.name, self._url)) + common.addon.log_error('Unknown Error: %s - %s - %s' % (e, resolver.name, self._url)) return UrlResolver.unresolvable(code=0, msg=e) except Exception as e: common.addon.log_notice("Resolver '%s' crashed: %s. Ignoring" % (resolver.name, e)) From 43e2d6e6ae3eb8a7b5a24b8eb38d95e790cc5a46 Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Tue, 14 Apr 2015 23:50:45 -0400 Subject: [PATCH 0670/1360] add traceback to exceptions --- lib/urlresolver/plugins/180upload.py | 8 ++++---- lib/urlresolver/types.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/plugins/180upload.py b/lib/urlresolver/plugins/180upload.py index fdf1315d..af4986c2 100644 --- a/lib/urlresolver/plugins/180upload.py +++ b/lib/urlresolver/plugins/180upload.py @@ -39,10 +39,10 @@ def __init__(self): def get_media_url(self, host, media_id): # try embedded link first to avoid captcha, try direct link if it doesn't work - stream_url = self.__get_link('http://180upload.com/embed-%s.html' % media_id) - if not stream_url: - stream_url = self.__get_link(self.get_url(host, media_id)) - return stream_url + stream_url = self.__get_link('http://180upload.com/embed-%s.html' % media_id) + if not stream_url: + stream_url = self.__get_link(self.get_url(host, media_id)) + return stream_url def __get_link(self, url): headers = { diff --git a/lib/urlresolver/types.py b/lib/urlresolver/types.py index efc1baaf..9e4b9131 100644 --- a/lib/urlresolver/types.py +++ b/lib/urlresolver/types.py @@ -163,12 +163,15 @@ def resolve(self): return stream_url except UrlResolver.ResolverError as e: common.addon.log_error('Resolver Error: %s - %s - %s' % (e, resolver.name, self._url)) + common.addon.log_debug(traceback.format_exc()) return UrlResolver.unresolvable(code=0, msg=e) except urllib2.HTTPError as e: common.addon.log_error('HTTP Error: %s - %s - %s - %s' % (e.code, resolver.name, self._url)) + common.addon.log_debug(traceback.format_exc()) return UrlResolver.unresolvable(code=3, msg=e) except Exception as e: common.addon.log_error('Unknown Error: %s - %s - %s' % (e, resolver.name, self._url)) + common.addon.log_error(traceback.format_exc()) return UrlResolver.unresolvable(code=0, msg=e) except Exception as e: common.addon.log_notice("Resolver '%s' crashed: %s. Ignoring" % (resolver.name, e)) From 5d751d3bef239eedda62e5ec13e0562b458b513a Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Wed, 15 Apr 2015 17:15:43 -0400 Subject: [PATCH 0671/1360] add 3 new hosters added by icefilms --- lib/urlresolver/plugins/clicknupload.py | 73 +++++++++++++++++++++++++ lib/urlresolver/plugins/tusfiles.py | 60 ++++++++++++++++++++ lib/urlresolver/plugins/xfileload.py | 68 +++++++++++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 lib/urlresolver/plugins/clicknupload.py create mode 100644 lib/urlresolver/plugins/tusfiles.py create mode 100644 lib/urlresolver/plugins/xfileload.py diff --git a/lib/urlresolver/plugins/clicknupload.py b/lib/urlresolver/plugins/clicknupload.py new file mode 100644 index 00000000..2699539c --- /dev/null +++ b/lib/urlresolver/plugins/clicknupload.py @@ -0,0 +1,73 @@ +''' +clicknupload urlresolver plugin +Copyright (C) 2015 tknorris + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +from urlresolver import common + +USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' +MAX_TRIES = 3 + +class ClickNUploadResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "clicknupload" + domains = ["clicknupload.com"] + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + tries = 0 + while tries < MAX_TRIES: + data = {} + r = re.findall(r'type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html) + for name, value in r: + data[name] = value + data['method_free'] = 'Free Download' + + html = self.net.http_POST(web_url, data).content + + if '>File Download Link Generated<' in html: + r = re.search("onClick\s*=\s*\"window\.open\('([^']+)", html) + if r: + return r.group(1) + '|User-Agent=%s' % (USER_AGENT) + + tries = tries + 1 + + raise UrlResolver.ResolverError('Unable to locate link') + + def get_url(self, host, media_id): + return 'http://%s/%s' % (host, media_id) + + def get_host_and_id(self, url): + r = re.search('//(.+?)/([0-9a-zA-Z/]+)', 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('http://((?:www.)?clicknupload.com)/(?:f/)?([0-9A-Za-z]+)', url) or 'clicknupload' in host diff --git a/lib/urlresolver/plugins/tusfiles.py b/lib/urlresolver/plugins/tusfiles.py new file mode 100644 index 00000000..8d558c15 --- /dev/null +++ b/lib/urlresolver/plugins/tusfiles.py @@ -0,0 +1,60 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2015 tknorris + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" +import re +from t0mm0.common.net import Net +from urlresolver import common +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +from lib import jsunpack + +class TusfilesResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "tusfiles" + domains = ['tusfiles.net'] + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + direct_url = 'http://%s/%s' % (host, media_id) + for web_url in [self.get_url(host, media_id), direct_url]: + html = self.net.http_GET(web_url).content + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + js_data = jsunpack.unpack(match.group(1)) + match2 = re.search('. +''' + +from t0mm0.common.net import Net +from urlresolver.plugnplay.interfaces import UrlResolver +from urlresolver.plugnplay.interfaces import PluginSettings +from urlresolver.plugnplay import Plugin +import re +from urlresolver import common + +USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' + +class XFileLoadResolver(Plugin, UrlResolver, PluginSettings): + implements = [UrlResolver, PluginSettings] + name = "xfileload" + domains = ["xfileload.com"] + + def __init__(self): + p = self.get_setting('priority') or 100 + self.priority = int(p) + self.net = Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + data = {} + r = re.findall(r'type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html) + for name, value in r: + data[name] = value + + html = self.net.http_POST(web_url, data).content + + if '>File Download Link Generated<' in html: + # find the href on the same line as the download button image + r = re.search('href="([^"]+).*?downdown\.png', html) + if r: + return r.group(1) + '|User-Agent=%s' % (USER_AGENT) + + raise UrlResolver.ResolverError('Unable to locate link') + + def get_url(self, host, media_id): + return 'http://%s/%s' % (host, media_id) + + def get_host_and_id(self, url): + r = re.search('//(.+?)/([0-9a-zA-Z/]+)', 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('http://((?:www.)?xfileload.com)/(?:f/)?([0-9A-Za-z]+)', url) or 'xfileload' in host From 09a2cca25cece93d43f6bf2303ae3e334e32a84d Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Thu, 16 Apr 2015 01:37:23 -0400 Subject: [PATCH 0672/1360] switch cloudyvideos to use regular url --- lib/urlresolver/plugins/cloudyvideos.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/cloudyvideos.py b/lib/urlresolver/plugins/cloudyvideos.py index fd4c774b..2473ece2 100644 --- a/lib/urlresolver/plugins/cloudyvideos.py +++ b/lib/urlresolver/plugins/cloudyvideos.py @@ -21,6 +21,7 @@ from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin import urllib2 +import xbmc from urlresolver import common from lib import jsunpack import re @@ -39,13 +40,16 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content form_values = {} - for i in re.finditer('', html, re.DOTALL): js_data = jsunpack.unpack(match.group(1)) match2 = re.search(' Date: Thu, 16 Apr 2015 01:40:09 -0400 Subject: [PATCH 0673/1360] fix regex --- lib/urlresolver/plugins/cloudyvideos.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/cloudyvideos.py b/lib/urlresolver/plugins/cloudyvideos.py index 2473ece2..7070f233 100644 --- a/lib/urlresolver/plugins/cloudyvideos.py +++ b/lib/urlresolver/plugins/cloudyvideos.py @@ -20,7 +20,6 @@ from urlresolver.plugnplay.interfaces import UrlResolver from urlresolver.plugnplay.interfaces import PluginSettings from urlresolver.plugnplay import Plugin -import urllib2 import xbmc from urlresolver import common from lib import jsunpack @@ -66,7 +65,7 @@ def get_url(self, host, media_id): return 'http://cloudyvideos.com/%s' % (media_id) def get_host_and_id(self, url): - r = re.search('http://(?:www.)?(.+?)/(?:embed-)?([\w]+)-', url) + r = re.search('http://(?:www.)?(.+?)/(?:embed-)?([\w]+)', url) if r: return r.groups() else: From 9ee3e4bd58be4024f3c1c9b314db974af8539b49 Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Mon, 20 Apr 2015 15:03:48 +0200 Subject: [PATCH 0674/1360] Fixed Teramixer plugin --- lib/urlresolver/plugins/teramixer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/teramixer.py b/lib/urlresolver/plugins/teramixer.py index c741ea01..11fc12b8 100644 --- a/lib/urlresolver/plugins/teramixer.py +++ b/lib/urlresolver/plugins/teramixer.py @@ -28,7 +28,10 @@ class TeramixerResolver(Plugin, UrlResolver, PluginSettings): implements = [UrlResolver, PluginSettings] - name = "teramixer" + name = "teramixer" + domains = [ 'teramixer.com' ] + useragent = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' + def __init__(self): p = self.get_setting('priority') or 100 @@ -43,7 +46,7 @@ def get_media_url(self, host, media_id): encodedUrl = encodedUrl[9:] encodedUrl = base64.b64decode(encodedUrl) if not encodedUrl.startswith('aws'): encodedUrl = encodedUrl[1:] - stream_url = 'http://' + encodedUrl + stream_url = 'http://%s|User-Agent=%s' %(encodedUrl,self.useragent) return stream_url except IndexError as e: if re.search("""File not found or deleted - Teramixer""", html) : From 90196d6bfb366631bbeb5d6b06dc805856466372 Mon Sep 17 00:00:00 2001 From: JUL1EN094 Date: Mon, 20 Apr 2015 16:06:55 +0200 Subject: [PATCH 0675/1360] Fixed Exashare plugin : Work only with an Exashare account at this time --- lib/urlresolver/plugins/exashare.py | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/urlresolver/plugins/exashare.py b/lib/urlresolver/plugins/exashare.py index 3588d020..4357bbfe 100644 --- a/lib/urlresolver/plugins/exashare.py +++ b/lib/urlresolver/plugins/exashare.py @@ -25,13 +25,12 @@ from urlresolver import common class ExashareResolver(Plugin,UrlResolver,PluginSettings): - implements=[UrlResolver,SiteAuth,PluginSettings] - name="exashare" - domains = [ "exashare.com" ] - - profile_path=common.profile_path - cookie_file=os.path.join(profile_path,'%s.cookies'%name) - USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' + implements = [UrlResolver,SiteAuth,PluginSettings] + name = "exashare" + domains = [ "exashare.com" ] + profile_path = common.profile_path + cookie_file = os.path.join(profile_path,'%s.cookies'%name) + USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0' def __init__(self): p=self.get_setting('priority') or 100 @@ -41,14 +40,24 @@ def __init__(self): #UrlResolver methods def get_media_url(self, host, media_id): base_url = 'http://www.' + host + '.com/' + media_id - # base_url='http://www.'+host+'.com/embed-'+media_id+'-640x400.html' headers = {'User-Agent': self.USER_AGENT, 'Referer': 'http://www.' + host + '.com/'} try: html = self.net.http_GET(base_url).content except: html = self.net.http_GET(base_url, headers=headers).content if re.search("""File Not Found""", html): raise UrlResolver.ResolverError('File not found or removed') - - stream_url = re.findall('file:\s*"([^"]+)"', html)[0] + POST_Url = re.findall('form method="POST" action=\'(.*)\'',html)[0] + POST_Selected = re.findall('form method="POST" action=(.*)',html,re.DOTALL)[0] + POST_Data = {} + POST_Data['op'] = re.findall('input type="hidden" name="op" value="(.*)"',POST_Selected)[0] + POST_Data['usr_login'] = re.findall('input type="hidden" name="usr_login" value="(.*)"',POST_Selected)[0] + POST_Data['id'] = re.findall('input type="hidden" name="id" value="(.*)"',POST_Selected)[0] + POST_Data['fname'] = re.findall('input type="hidden" name="fname" value="(.*)"',POST_Selected)[0] + POST_Data['referer'] = re.findall('input type="hidden" name="referer" value="(.*)"',POST_Selected)[0] + POST_Data['hash'] = re.findall('input type="hidden" name="hash" value="(.*)"',POST_Selected)[0] + POST_Data['imhuman'] = 'Proceed to video' + try : html2 = self.net.http_POST(POST_Url,POST_Data).content + except : html2 = self.net.http_POST(POST_Url,POST_Data,headers=headers).content + stream_url = re.findall('file:\s*"([^"]+)"', html2)[0] if self.get_setting('login') == 'true': cookies = {} for cookie in self.net._cj: @@ -63,19 +72,16 @@ def get_url(self,host,media_id): return 'http://www.exashare.com/%s' % media_id def get_host_and_id(self,url): - #r=re.search('http://(www.)?(.+?).com/(embed\-)?(.+)(\-[0-9]+x[0-9]+.html)?', url) r=re.search('http://(?:www.)?(.+?).com/(?:embed\-)?([0-9A-Za-z_]+)(?:\-[0-9]+x[0-9]+.html)?',url) if r: ls=r.groups() - #ls=(ls[1],ls[3]) return ls else: return False def valid_url(self, url, host): - if self.get_setting('enabled') == 'false': + if self.get_setting('enabled')=='false' or self.get_setting('login')=='false': return False - #return re.match('http://(www.)?exashare.com/(embed\-)?[0-9A-Za-z]+(\-[0-9]+x[0-9]+.html)?',url) or 'exashare.com' in host return re.match('http://(?:www.)?exashare.com/(?:embed\-)?[0-9A-Za-z]+(?:\-[0-9]+x[0-9]+.html)?',url) or 'exashare.com' in host #SiteAuth methods @@ -112,7 +118,7 @@ def login(self): return False else: if os.path.exists(self.cookie_file): os.remove(self.cookie_file) - return True + return False #PluginSettings methods def get_settings_xml(self): From c38b0184155c9492e05fa00af96274ee041dba4a Mon Sep 17 00:00:00 2001 From: Tracy Norris Date: Tue, 21 Apr 2015 12:14:50 -0400 Subject: [PATCH 0676/1360] add captcha to xfileupload resolver --- lib/urlresolver/plugins/lib/captcha_lib.py | 9 +++++++++ lib/urlresolver/plugins/xfileload.py | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/lib/captcha_lib.py b/lib/urlresolver/plugins/lib/captcha_lib.py index f3965610..ad86f90a 100644 --- a/lib/urlresolver/plugins/lib/captcha_lib.py +++ b/lib/urlresolver/plugins/lib/captcha_lib.py @@ -50,11 +50,14 @@ def get_response(img): def do_captcha(html): solvemedia = re.search('', html, re.DOTALL) if r: diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index 13b3d150..5800c3c5 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -18,6 +18,7 @@ import re from lib import jsunpack +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -32,13 +33,8 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - - data = {} - for match in re.finditer('type="hidden"\s*name="([^"]+)"\s*value="([^"]+)', html): - key, value = match.groups() - data[key] = value + data = helpers.get_hidden(html) data['method_free'] = 'Continue to Stream >>' - html = self.net.http_POST(web_url, data).content # get url from packed javascript diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py index 7b9fecda..f80bd7bf 100644 --- a/lib/urlresolver/plugins/movpod.py +++ b/lib/urlresolver/plugins/movpod.py @@ -17,6 +17,7 @@ """ import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,10 +35,7 @@ def get_media_url(self, host, media_id): html = resp.content post_url = resp.get_url() - form_values = {} - for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2) - + form_values = helpers.get_hidden(html) html = self.net.http_POST(post_url, form_data=form_values).content r = re.search('file: "http(.+?)"', html) if r: diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index 87ad3a44..9cf7d5bd 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -17,6 +17,7 @@ ''' import re import urllib2 +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,10 +35,9 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url, headers=headers).content match = re.search("val\(\)\s*\+\s*'([^']+)", html) suffix = match.group(1) if match else '' - data = {} - r = re.findall(r'type\s*=\s*"hidden"[^>]+name\s*=\s*"(.+?)"\s*value\s*=\s*"(.*?)"', html) - for name, value in r: - data[name] = value + suffix + data = helpers.get_hidden(html) + for name in data: + data[name] = data[name] + suffix headers['Referer'] = web_url html = self.net.http_POST(web_url, form_data=data, headers=headers).content diff --git a/lib/urlresolver/plugins/sharedsx.py b/lib/urlresolver/plugins/sharedsx.py index 0cee9bd1..bfe2143b 100644 --- a/lib/urlresolver/plugins/sharedsx.py +++ b/lib/urlresolver/plugins/sharedsx.py @@ -18,6 +18,7 @@ import re import urllib +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,11 +35,7 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url, headers={'Referer': web_url}).content - data = {} - r = re.findall(r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html) - if not r: raise ResolverError('page structure changed') - for name, value in r: data[name] = value - + data = helpers.get_hidden(html) html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content r = re.search(r'class="stream-content" data-url', html) diff --git a/lib/urlresolver/plugins/uploadaf.py b/lib/urlresolver/plugins/uploadaf.py index 6b04ff3a..b195bdd0 100644 --- a/lib/urlresolver/plugins/uploadaf.py +++ b/lib/urlresolver/plugins/uploadaf.py @@ -18,6 +18,7 @@ import re from lib import captcha_lib +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -37,10 +38,7 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: - data = {} - for match in re.finditer(r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html): - key, value = match.groups() - data[key] = value + data = helpers.get_hidden(html) data['method_free'] = 'Free Download >>' data.update(captcha_lib.do_captcha(html)) diff --git a/lib/urlresolver/plugins/uploadx.py b/lib/urlresolver/plugins/uploadx.py index b7d09e57..e169c2e7 100644 --- a/lib/urlresolver/plugins/uploadx.py +++ b/lib/urlresolver/plugins/uploadx.py @@ -19,6 +19,7 @@ import re import urllib from lib import captcha_lib +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError import xbmc @@ -38,10 +39,7 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url).content tries = 0 while tries < MAX_TRIES: - data = {} - r = re.findall(r'type="hidden"\s+name="(.+?)"\s+value="(.*?)"', html) - for name, value in r: - data[name] = value + data = helpers.get_hidden(html) data['method_free'] = 'Free Download+>>' data.update(captcha_lib.do_captcha(html)) headers = { diff --git a/lib/urlresolver/plugins/uptobox.py b/lib/urlresolver/plugins/uptobox.py index 808a83c4..c0ca2d80 100644 --- a/lib/urlresolver/plugins/uptobox.py +++ b/lib/urlresolver/plugins/uptobox.py @@ -17,6 +17,7 @@ """ import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError import xbmc @@ -49,13 +50,7 @@ def get_media_url(self, host, media_id): if r: raise Exception() - r = re.search('(.+?)', 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 - + data = helpers.get_hidden(html) for i in range(0, 3): try: html = self.net.http_POST(web_url, data, headers=self.headers).content diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py index 01a444f9..30dc81ee 100644 --- a/lib/urlresolver/plugins/vidspot.py +++ b/lib/urlresolver/plugins/vidspot.py @@ -19,6 +19,7 @@ import re import urllib import urlparse +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,13 +35,8 @@ def get_media_url(self, host, media_id): url = self.get_url(host, media_id) html = self.net.http_GET(url).content - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', html) - for name, value in r: - data[name] = value - + data = helpers.get_hidden(html) html = self.net.http_POST(url, data).content - r = re.search('"sources"\s*:\s*\[(.*?)\]', html, re.DOTALL) if r: fragment = r.group(1) diff --git a/lib/urlresolver/plugins/vivosx.py b/lib/urlresolver/plugins/vivosx.py index 43146b6d..80879815 100644 --- a/lib/urlresolver/plugins/vivosx.py +++ b/lib/urlresolver/plugins/vivosx.py @@ -17,6 +17,7 @@ ''' import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -35,12 +36,7 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url, headers={'Referer': web_url}).content # read POST variables into data - data = {} - r = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)"', html) - if not r: raise Exception('page structure changed') - for name, value in r: data[name] = value - - # get video page using POST variables + data = helpers.get_hidden(html) html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content # search for content tag From 974a92603b2e01feaf28a94e5ec80d97efc908a7 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 9 May 2016 21:41:26 -0400 Subject: [PATCH 0936/1360] add vid chooser to resolvers --- lib/urlresolver/plugins/alldebrid.py | 13 ++---------- lib/urlresolver/plugins/ok.py | 30 +++++++-------------------- lib/urlresolver/plugins/realdebrid.py | 12 ++--------- lib/urlresolver/plugins/thevideos.py | 1 - lib/urlresolver/plugins/vk.py | 30 ++++++--------------------- lib/urlresolver/plugins/vkpass.py | 23 +++++++------------- 6 files changed, 24 insertions(+), 85 deletions(-) diff --git a/lib/urlresolver/plugins/alldebrid.py b/lib/urlresolver/plugins/alldebrid.py index 5512152e..10261aa2 100644 --- a/lib/urlresolver/plugins/alldebrid.py +++ b/lib/urlresolver/plugins/alldebrid.py @@ -20,7 +20,7 @@ import re import urllib import json -import xbmcgui +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -52,16 +52,7 @@ def get_media_url(self, host, media_id): raise ResolverError('alldebrid: %s' % (js_data['error'])) if 'streaming' in js_data: - streams = js_data['streaming'] - if len(streams) == 0: - raise ResolverError('alldebrid: no usable streams') - elif len(streams) == 1: - return streams.values()[0] - else: - lines = [key for key in streams] - result = xbmcgui.Dialog().select('Choose the link', lines) - if result > -1: - return streams[lines[result]] + return helpers.pick_source(js_data['streaming'].items()) except ResolverError: raise except: diff --git a/lib/urlresolver/plugins/ok.py b/lib/urlresolver/plugins/ok.py index ad6b5594..62becec0 100644 --- a/lib/urlresolver/plugins/ok.py +++ b/lib/urlresolver/plugins/ok.py @@ -20,7 +20,7 @@ import re import json import urllib -import xbmcgui +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -36,31 +36,15 @@ def __init__(self): def get_media_url(self, host, media_id): vids = self.__get_Metadata(media_id) - - purged_jsonvars = {} - lines = [] - best = '0' - + sources = [] for entry in vids['urls']: quality = self.__replaceQuality(entry['name']) - lines.append(quality) - purged_jsonvars[quality] = entry['url'] + '|' + urllib.urlencode(self.header) - if int(quality) > int(best): best = quality - - if len(lines) == 1: - return purged_jsonvars[lines[0]].encode('utf-8') - else: - if self.get_setting('auto_pick') == 'true': - return purged_jsonvars[str(best)].encode('utf-8') - else: - result = xbmcgui.Dialog().select('Choose the link', lines) - - if result != -1: - return purged_jsonvars[lines[result]].encode('utf-8') - else: - raise ResolverError('No link selected') + sources.append((quality, entry['url'])) - raise ResolverError('No video found') + try: sources.sort(key=int, reverse=True) + except: pass + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + source = source.encode('utf-8') + '|' + urllib.urlencode(self.header) def __replaceQuality(self, qual): return self.qual_map.get(qual.lower(), '000') diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index 14f048dd..e2715507 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -19,8 +19,8 @@ import re import urllib2 import json -import xbmcgui import xbmc +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -75,15 +75,7 @@ def get_media_url(self, host, media_id, retry=False): link = self.__get_link(alt) if link is not None: links.append(link) - if len(links) == 1 or self.get_setting('autopick') == 'true': - return links[0][1] - elif len(links) > 1: - sd = xbmcgui.Dialog() - ret = sd.select('Select a Link', [link[0] for link in links]) - if ret > -1: - return links[ret][1] - else: - raise ResolverError('No usable link from Real Debrid') + return helpers.pick_source(links, self.get_setting('autopick') == 'true') def __get_link(self, link): if 'download' in link: diff --git a/lib/urlresolver/plugins/thevideos.py b/lib/urlresolver/plugins/thevideos.py index 30e90052..b5e83d0f 100644 --- a/lib/urlresolver/plugins/thevideos.py +++ b/lib/urlresolver/plugins/thevideos.py @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import xbmcgui import re from lib import helpers from urlresolver import common diff --git a/lib/urlresolver/plugins/vk.py b/lib/urlresolver/plugins/vk.py index 0babf57d..29645636 100644 --- a/lib/urlresolver/plugins/vk.py +++ b/lib/urlresolver/plugins/vk.py @@ -21,9 +21,9 @@ import json import urllib import urlparse +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError -import xbmcgui class VKResolver(UrlResolver): name = "VK.com" @@ -53,29 +53,11 @@ def get_media_url(self, host, media_id): try: result = json.loads(html)['response'] except: result = self.__get_private(oid, video_id) - - quality_list = [] - link_list = [] - best_link = '' - for quality in ['url240', 'url360', 'url480', 'url540', 'url720']: - if quality in result: - quality_list.append(quality[3:]) - link_list.append(result[quality]) - best_link = result[quality] - - if self.get_setting('auto_pick') == 'true' and best_link: - return best_link + '|' + urllib.urlencode(headers) - else: - if quality_list: - if len(quality_list) > 1: - result = xbmcgui.Dialog().select('Choose the link', quality_list) - if result == -1: - raise ResolverError('No link selected') - else: - return link_list[result] + '|' + urllib.urlencode(headers) - else: - return link_list[0] + '|' + urllib.urlencode(headers) - + sources = result.items() + try: sources.sort(key=lambda x: int(x[0][3:]), reverse=True) + except: pass + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + return source + '|' + urllib.urlencode(headers) raise ResolverError('No video found') def __get_private(self, oid, video_id): diff --git a/lib/urlresolver/plugins/vkpass.py b/lib/urlresolver/plugins/vkpass.py index 4a0de896..676990bb 100644 --- a/lib/urlresolver/plugins/vkpass.py +++ b/lib/urlresolver/plugins/vkpass.py @@ -16,7 +16,7 @@ along with this program. If not, see . """ import re -import xbmcgui +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -38,10 +38,9 @@ def get_media_url(self, host, media_id): if not vBlocks and not html5: raise ResolverError('No vsource found') - data = dict() + data = {} data['purged_jsonvars'] = {} data['lines'] = [] - data['best'] = '0' if html5: for source in html5: @@ -50,19 +49,11 @@ def get_media_url(self, host, media_id): elif vBlocks: data = self.__getFlashVids() - data['lines'] = sorted(data['lines'], key=int) - - if len(data['lines']) == 1: - return data['purged_jsonvars'][data['lines'][0]].encode('utf-8') - else: - if self.get_setting('auto_pick') == 'true': - return data['purged_jsonvars'][str(data['best'])].encode('utf-8') + '|User-Agent=%s' % (common.IE_USER_AGENT) - else: - result = xbmcgui.Dialog().select('Choose the link', data['lines']) - if result != -1: - return data['purged_jsonvars'][data['lines'][result]].encode('utf-8') + '|User-Agent=%s' % (common.IE_USER_AGENT) - else: - raise ResolverError('No link selected') + sources = [(line, data['purged_jsonvars'][line]) for line in data['lines']] + try: sources.sort(key=lambda x: int(x[0][3:]), reverse=True) + except: pass + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + return source + '|User-Agent=%s' % (common.IE_USER_AGENT) def __decodeLinks(self, html, list, data): if "source" not in list: From 70e5d0eac5fc9f4aefe69dc5c152ac5e5e1452ca Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 9 May 2016 21:54:20 -0400 Subject: [PATCH 0937/1360] switch solvemedia captcha image to gif --- lib/urlresolver/plugins/lib/captcha_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/lib/captcha_lib.py b/lib/urlresolver/plugins/lib/captcha_lib.py index be1f3fe7..5c761171 100644 --- a/lib/urlresolver/plugins/lib/captcha_lib.py +++ b/lib/urlresolver/plugins/lib/captcha_lib.py @@ -26,7 +26,7 @@ import helpers net = common.Net() -IMG_FILE = 'captcha_img.png' +IMG_FILE = 'captcha_img.gif' def get_response(img): try: From 324dc799be195132418d0a88525a7fa448523ec8 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 9 May 2016 21:57:56 -0400 Subject: [PATCH 0938/1360] fix hidden helper --- lib/urlresolver/plugins/lib/helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 772ea59a..e9f739d4 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -17,6 +17,7 @@ """ import re import xbmcgui +from urlresolver import common from urlresolver.resolver import ResolverError def get_hidden(html, form_id=None): @@ -31,8 +32,9 @@ def get_hidden(html, form_id=None): match = re.search('''name\s*=\s*['"]([^'"]+)''', field.group(0)) match1 = re.search('''value\s*=\s*['"]([^'"]+)''', field.group(0)) if match and match1: - hidden[match.group(1)] = match.group(1) + hidden[match.group(1)] = match1.group(1) + common.log_utils.log_debug('Hidden fields are: %s' % (hidden)) return hidden def pick_source(sources, auto_pick=False): From 7724d2f25cf6ea59d69b5f66a60455b02eb81699 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 9 May 2016 22:06:08 -0400 Subject: [PATCH 0939/1360] find forms case insensitive --- lib/urlresolver/plugins/clicknupload.py | 2 +- lib/urlresolver/plugins/lib/helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/clicknupload.py b/lib/urlresolver/plugins/clicknupload.py index 45dda202..de07ca54 100644 --- a/lib/urlresolver/plugins/clicknupload.py +++ b/lib/urlresolver/plugins/clicknupload.py @@ -40,7 +40,7 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html) - data['method_free'] = 'Free Download' + data['method_free'] = 'Free+Download' data.update(captcha_lib.do_captcha(html)) headers = { 'Referer': web_url diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index e9f739d4..dbaae405 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -27,7 +27,7 @@ def get_hidden(html, form_id=None): else: pattern = ''']*>(.*?)''' - for form in re.finditer(pattern, html, re.DOTALL): + for form in re.finditer(pattern, html, re.DOTALL | re.I): for field in re.finditer(''']*type=['"]?hidden['"]?[^>]*>''', form.group(1)): match = re.search('''name\s*=\s*['"]([^'"]+)''', field.group(0)) match1 = re.search('''value\s*=\s*['"]([^'"]+)''', field.group(0)) From 17dc0b2934fefc82c6de79a78a89283bbfd1f20a Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 11 May 2016 22:17:42 -0400 Subject: [PATCH 0940/1360] bump to 3.0.4 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 0aee8407..632c5f57 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From e8f8c747f24ca2131ffe05d1e57064a46c2f33fd Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 12 May 2016 19:06:11 -0400 Subject: [PATCH 0941/1360] fix resolver --- lib/urlresolver/plugins/promptfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index 9cf7d5bd..191bc533 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -33,14 +33,16 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content - match = re.search("val\(\)\s*\+\s*'([^']+)", html) + match = re.search('''val\(\)\s*\+\s*['"]([^"']+)''', html) suffix = match.group(1) if match else '' data = helpers.get_hidden(html) for name in data: data[name] = data[name] + suffix headers['Referer'] = web_url + common.log_utils.log('%s - %s' % (data, headers)) html = self.net.http_POST(web_url, form_data=data, headers=headers).content + common.log_utils.log(html) html = re.compile(r'clip\s*:\s*\{.*?url\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html) if not html: raise ResolverError('File Not Found or removed') From 8166c5f65c9220d83db6b120f19168424b5f9e08 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 12 May 2016 19:10:03 -0400 Subject: [PATCH 0942/1360] remove logging --- lib/urlresolver/plugins/promptfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index 191bc533..180b3df9 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -40,9 +40,7 @@ def get_media_url(self, host, media_id): data[name] = data[name] + suffix headers['Referer'] = web_url - common.log_utils.log('%s - %s' % (data, headers)) html = self.net.http_POST(web_url, form_data=data, headers=headers).content - common.log_utils.log(html) html = re.compile(r'clip\s*:\s*\{.*?url\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html) if not html: raise ResolverError('File Not Found or removed') From 2a28cdca81a9bacb92d0f837ab284083853066b7 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 12 May 2016 19:53:47 -0400 Subject: [PATCH 0943/1360] fix openload resolver --- lib/urlresolver/plugins/openload.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index eb2c333b..d5804d91 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -66,14 +66,15 @@ def conv(s, addfactor=None): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8') - aaencoded = re.findall('id=\"olvideo\".*\n.*?text/javascript\">(.*)', html)[0] + aaencoded = re.findall('id="olvideo".*?text/javascript\">(.*?)', html, re.DOTALL)[0] dtext = AADecoder(aaencoded).decode() - dtext = re.findall('window.vs=(.*?);', dtext)[0] + dtext = re.findall('window\.[A-Za-z0-9_]+=(.*?);', dtext)[0] dtext = conv(dtext) return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) + raise # Commented out because, by default, all openload videos no longer work with their API so it's a waste # try: From 7c96a718f77dd6fa71576e181144a906acc19246 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 12 May 2016 23:31:57 -0400 Subject: [PATCH 0944/1360] make window match more flexible --- lib/urlresolver/plugins/openload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index d5804d91..326814c2 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -68,7 +68,7 @@ def conv(s, addfactor=None): html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8') aaencoded = re.findall('id="olvideo".*?text/javascript\">(.*?)', html, re.DOTALL)[0] dtext = AADecoder(aaencoded).decode() - dtext = re.findall('window\.[A-Za-z0-9_]+=(.*?);', dtext)[0] + dtext = re.findall('window\..+?=(.*?);', dtext)[0] dtext = conv(dtext) return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT From 204828a7938bb752e4fccabcb180cd8b777a06f9 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 13 May 2016 00:50:24 -0400 Subject: [PATCH 0945/1360] add xbmcgui lib back to RD --- lib/urlresolver/plugins/realdebrid.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/plugins/realdebrid.py b/lib/urlresolver/plugins/realdebrid.py index e2715507..2e8c11ee 100644 --- a/lib/urlresolver/plugins/realdebrid.py +++ b/lib/urlresolver/plugins/realdebrid.py @@ -20,6 +20,7 @@ import urllib2 import json import xbmc +import xbmcgui from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError From 68ae3c20cda1a3f9a416cd639d31de8c3139da2d Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 13 May 2016 00:50:49 -0400 Subject: [PATCH 0946/1360] Bump to 3.0.5 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 632c5f57..d64b6dbc 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 7edf157cd5f649c201959d551ecaecbe785efce0 Mon Sep 17 00:00:00 2001 From: tknorris Date: Sun, 15 May 2016 21:52:46 -0400 Subject: [PATCH 0947/1360] add new tld to nowvideo --- lib/urlresolver/plugins/nowvideo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/nowvideo.py b/lib/urlresolver/plugins/nowvideo.py index 345b07a1..1b35e90b 100644 --- a/lib/urlresolver/plugins/nowvideo.py +++ b/lib/urlresolver/plugins/nowvideo.py @@ -22,8 +22,8 @@ class NowvideoResolver(UrlResolver): name = "nowvideo" - domains = ['nowvideo.eu', 'nowvideo.ch', 'nowvideo.sx', 'nowvideo.co', 'nowvideo.li', 'nowvideo.fo', 'nowvideo.at'] - pattern = '(?://|\.)(nowvideo\.(?:eu|ch|sx|co|li|fo|at))/(?:video/|embed\.php\?\S*v=)([A-Za-z0-9]+)' + domains = ['nowvideo.eu', 'nowvideo.ch', 'nowvideo.sx', 'nowvideo.co', 'nowvideo.li', 'nowvideo.fo', 'nowvideo.at', 'nowvideo.ec'] + pattern = '(?://|\.)(nowvideo\.(?:eu|ch|sx|co|li|fo|at|ec))/(?:video/|embed\.php\?\S*v=)([A-Za-z0-9]+)' def __init__(self): self.net = common.Net() From cfcf6bf6ff830e57d85a55fecdd2198e95d616bf Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Mon, 16 May 2016 19:25:55 +0200 Subject: [PATCH 0948/1360] OK.ru return selected source ok resolver did not return the link of the selected source --- lib/urlresolver/plugins/ok.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/plugins/ok.py b/lib/urlresolver/plugins/ok.py index 62becec0..b976bff4 100644 --- a/lib/urlresolver/plugins/ok.py +++ b/lib/urlresolver/plugins/ok.py @@ -45,6 +45,7 @@ def get_media_url(self, host, media_id): except: pass source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') source = source.encode('utf-8') + '|' + urllib.urlencode(self.header) + return source def __replaceQuality(self, qual): return self.qual_map.get(qual.lower(), '000') From 0d9dd09426df998d064a9c8299c5ea13c3cc4b17 Mon Sep 17 00:00:00 2001 From: Shani-08 Date: Tue, 17 May 2016 15:40:44 +0100 Subject: [PATCH 0949/1360] another format for openload --- lib/urlresolver/plugins/openload.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index 326814c2..ca69179d 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -51,8 +51,8 @@ def conv(s, addfactor=None): return baseN(int(ival), int(eval(b))) elif 'myfunc' in s: b, ival = s.split('myfunc(')[1].split(',') - ival = ival.replace(')', '').replace('(', '') - b = b.replace(')', '').replace('(', '') + ival = ival.replace(')', '').replace('(', '').replace(';', '') + b = b.replace(')', '').replace('(', '').replace(';', '') b = eval(addfactor.replace('a', b)) return baseN(int(ival), int(b)) else: @@ -68,8 +68,11 @@ def conv(s, addfactor=None): html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8') aaencoded = re.findall('id="olvideo".*?text/javascript\">(.*?)', html, re.DOTALL)[0] dtext = AADecoder(aaencoded).decode() - dtext = re.findall('window\..+?=(.*?);', dtext)[0] - dtext = conv(dtext) + #print dtext + dtext1 = re.findall('window\..+?=(.*?);', dtext) + if len(dtext1)==0: + dtext1=re.findall('.*attr\(\"href\",\((.*)',dtext) + dtext = conv(dtext1[0]) return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT except Exception as e: From 1a7717156e198663f5be3a1f924e83e6332fa89f Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 19 May 2016 23:49:15 -0400 Subject: [PATCH 0950/1360] use more complete regex for youtube resolver --- lib/urlresolver/plugins/youtube.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/youtube.py b/lib/urlresolver/plugins/youtube.py index ac5d30ec..9104571d 100644 --- a/lib/urlresolver/plugins/youtube.py +++ b/lib/urlresolver/plugins/youtube.py @@ -22,7 +22,7 @@ class YoutubeResolver(UrlResolver): name = "youtube" domains = ['youtube.com', 'youtu.be'] - pattern = '(?://|\.)(youtube.com|youtu.be)/(?:embed/|.+?\?v=|.+?\&v=|v/)([0-9A-Za-z_\-]+)' + pattern = '''https?://(?:[0-9A-Z-]+\.)?(?:(youtu\.be|youtube(?:-nocookie)?\.com)/?\S*?[^\w\s-])([\w-]{11})(?=[^\w-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|))[?=&+%\w.-]*''' def get_media_url(self, host, media_id): plugin = 'plugin://plugin.video.youtube/play/?video_id=' + media_id @@ -32,14 +32,14 @@ def get_url(self, host, media_id): return 'http://youtube.com/watch?v=%s' % media_id def get_host_and_id(self, url): - r = re.search(self.pattern, url) + r = re.search(self.pattern, url, re.I) 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 + return re.search(self.pattern, url, re.I) or self.name in host @classmethod def get_settings_xml(cls): From 433fce03bf1289f437d0230411b7e16801e72a2e Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Sat, 21 May 2016 13:38:40 +1200 Subject: [PATCH 0951/1360] Resolver fixes fastplay vimeo --- lib/urlresolver/plugins/fastplay.py | 8 ++++---- lib/urlresolver/plugins/vimeo.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/urlresolver/plugins/fastplay.py b/lib/urlresolver/plugins/fastplay.py index a3a35f20..418d2692 100644 --- a/lib/urlresolver/plugins/fastplay.py +++ b/lib/urlresolver/plugins/fastplay.py @@ -25,7 +25,7 @@ class LetwatchResolver(UrlResolver): name = 'fastplay.sx' domains = ['fastplay.sx'] - pattern = '(?://|\.)(fastplay\.sx)/(?:flash-)?([0-9a-zA-Z]+)' + pattern = '(?://|\.)(fastplay\.sx)/(?:flash-|embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() @@ -34,10 +34,10 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - if html.find('404 Not Found') >= 0: + if '404 Not Found' in html: raise ResolverError('File Removed') - if html.find('Video is processing') >= 0: + if 'Video is processing' in html: raise ResolverError('File still being processed') packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) @@ -54,7 +54,7 @@ def get_media_url(self, host, media_id): raise ResolverError('Unable to find fastplay.sx video') def get_url(self, host, media_id): - return 'http://%s/flash-%s.html' % (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) diff --git a/lib/urlresolver/plugins/vimeo.py b/lib/urlresolver/plugins/vimeo.py index 22d7dab6..d39fed82 100644 --- a/lib/urlresolver/plugins/vimeo.py +++ b/lib/urlresolver/plugins/vimeo.py @@ -31,8 +31,9 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - data = self.net.http_GET(web_url).content + headers = {'Referer': 'https://vimeo.com/', + 'Origin': 'https://vimeo.com'} + data = self.net.http_GET(web_url,headers).content data = json.loads(data) vids = data['request']['files']['progressive'] @@ -57,7 +58,7 @@ def get_media_url(self, host, media_id): return vUrl def get_url(self, host, media_id): - return 'http://player.vimeo.com/video/%s/config' % media_id + return 'https://player.vimeo.com/video/%s/config' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) From 65c4aba92c8cc3459857fed282067fa0ab318ac7 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Fri, 20 May 2016 22:05:59 -0400 Subject: [PATCH 0952/1360] unique class name for fastplay --- lib/urlresolver/plugins/fastplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/fastplay.py b/lib/urlresolver/plugins/fastplay.py index a3a35f20..c597cfae 100644 --- a/lib/urlresolver/plugins/fastplay.py +++ b/lib/urlresolver/plugins/fastplay.py @@ -22,7 +22,7 @@ from urlresolver.resolver import UrlResolver, ResolverError -class LetwatchResolver(UrlResolver): +class FastplayResolver(UrlResolver): name = 'fastplay.sx' domains = ['fastplay.sx'] pattern = '(?://|\.)(fastplay\.sx)/(?:flash-)?([0-9a-zA-Z]+)' From 7f8d62d6d0c88da05fec70d9346c6793b7082a82 Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Sun, 22 May 2016 12:13:53 +1200 Subject: [PATCH 0953/1360] 2 fixes, 1 new resolver Fixes to playu and watchvideo videosky new resolver --- lib/urlresolver/plugins/playu.py | 12 ++--- lib/urlresolver/plugins/videosky.py | 65 +++++++++++++++++++++++++++ lib/urlresolver/plugins/watchvideo.py | 11 +++-- 3 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 lib/urlresolver/plugins/videosky.py diff --git a/lib/urlresolver/plugins/playu.py b/lib/urlresolver/plugins/playu.py index f65bd2d3..c6db6f1e 100644 --- a/lib/urlresolver/plugins/playu.py +++ b/lib/urlresolver/plugins/playu.py @@ -1,5 +1,5 @@ """ - urlresolver XBMC Addon + urlresolver Kodi Addon Copyright (C) 2016 Gujal This program is free software: you can redistribute it and/or modify @@ -22,9 +22,9 @@ from urlresolver.resolver import UrlResolver, ResolverError class PlayUResolver(UrlResolver): - name = 'playu' - domains = ['playu.net'] - pattern = '(?://|\.)(playu\.net)/(?:embed-)?([0-9a-zA-Z]+)' + name = "playu" + domains = ["playu.net", "playu.me"] + pattern = '(?://|\.)(playu\.(?:net|me))/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() @@ -35,14 +35,14 @@ def get_media_url(self, host, media_id): if 'was deleted' in link : raise ResolverError('File Removed') - r = re.search('file\s*:\s*"([^"]+)', link) + r = re.search('file\s*:\s*"(http[^"]+)', link) if r: return r.group(1) raise ResolverError('Unable to find playu.net video') def get_url(self, host, media_id): - return 'http://playu.net/embed-%s.html' % media_id + return 'http://playu.me/embed-%s.html' % media_id def get_host_and_id(self, url): r = re.search(self.pattern, url) diff --git a/lib/urlresolver/plugins/videosky.py b/lib/urlresolver/plugins/videosky.py new file mode 100644 index 00000000..616da064 --- /dev/null +++ b/lib/urlresolver/plugins/videosky.py @@ -0,0 +1,65 @@ +''' + urlresolver Kodi Addon + Copyright (C) 2016 Gujal + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' + +import re +import urllib +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class VideoSkyResolver(UrlResolver): + name = "videosky.to" + domains = ["videosky.to"] + pattern = '(?://|\.)(videosky.to)/(?:embed\.php\?id=)([0-9a-z]+)' + + def __init__(self): + self.net = common.Net() + + 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('key:\s"(.+?)"', html) + if r: + filekey = r.group(1) + + player_url = 'http://www.videosky.to/api/player.api.php?user=&numOfErrors=0&pass=&cid2=&key=%s&file=%s&cid3=&cid=1' % (filekey, media_id) + + html = self.net.http_GET(player_url).content + + r = re.search('url=(.+?)&', html) + + if r: + stream_url = urllib.unquote(r.group(1)) + else: + raise ResolverError('File Not Found or removed') + + return stream_url + + def get_url(self, host, media_id): + return 'http://www.videosky.to/embed.php?id=%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 diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index 3dc77eb2..ab8e0b0d 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -1,4 +1,7 @@ ''' + urlresolver XBMC Addon + Copyright (C) 2016 Gujal + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -19,8 +22,8 @@ from urlresolver.resolver import UrlResolver, ResolverError class WatchVideoResolver(UrlResolver): - name = "watchvideo.us" - domains = ["watchvideo.us", "watchvideo4.us"] + name = "watchvideo" + domains = ["watchvideo.us", "watchvideo2.us", "watchvideo4.us"] pattern = '(?://|\.)(watchvideo[0-9]?\.us)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): @@ -30,10 +33,10 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - if html.find('404 Not Found') >= 0: + if 'File was deleted' in html: raise ResolverError('File Removed') - if html.find('Video is processing') >= 0: + if 'Video is processing' in html: raise ResolverError('File still being processed') packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) From 5c2f4b05b8445eba2a130088084f272841cd13e9 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 23 May 2016 12:46:38 -0400 Subject: [PATCH 0954/1360] fix ok.ru sort --- lib/urlresolver/plugins/ok.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/ok.py b/lib/urlresolver/plugins/ok.py index b976bff4..290a2ddc 100644 --- a/lib/urlresolver/plugins/ok.py +++ b/lib/urlresolver/plugins/ok.py @@ -41,7 +41,7 @@ def get_media_url(self, host, media_id): quality = self.__replaceQuality(entry['name']) sources.append((quality, entry['url'])) - try: sources.sort(key=int, reverse=True) + try: sources.sort(key=lambda x:int(x[0]), reverse=True) except: pass source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') source = source.encode('utf-8') + '|' + urllib.urlencode(self.header) From 95e466af601ea61fcfbee79e7ff1af5f7b4cd947 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 23 May 2016 14:35:51 -0400 Subject: [PATCH 0955/1360] Bump to 3.0.6 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index d64b6dbc..4264a6a6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 32923288e84eb4d8ff20482db0bf264d0b8fa58a Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Tue, 24 May 2016 18:59:52 -0400 Subject: [PATCH 0956/1360] rutube.py --- lib/urlresolver/plugins/rutube.py | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 lib/urlresolver/plugins/rutube.py diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py new file mode 100644 index 00000000..2d17485d --- /dev/null +++ b/lib/urlresolver/plugins/rutube.py @@ -0,0 +1,69 @@ +""" + OVERALL CREDIT TO: + t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway + + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +import urllib +import HTMLParser +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class RuTubeResolver(UrlResolver): + name = "rutube.ru" + domains = ['rutube.ru'] + pattern = '(?://|\.)(rutube\.ru)/play/embed/(\d*)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + + response = self.net.http_GET(web_url) + + html = response.content + + if html: + m3u8 = re.compile('video_balancer":\s*{.*?"m3u8":\s*"(.*?)"}').findall(html)[0] + m3u8 = HTMLParser.HTMLParser().unescape(m3u8) + response = self.net.http_GET(m3u8) + m3u8 = response.content + + url = re.compile('\n(.+?i=(.+?)_.+?)\n').findall(m3u8) + url = url[::-1] + stream_url = url[0][0] + + if stream_url: + return stream_url + + raise ResolverError('No playable video found.') + + def get_url(self, host, media_id): + return 'http://rutube.ru/play/embed/%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 From 62fdee70cceba63fab981d8e2182fa28e7b9ff78 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Tue, 24 May 2016 21:40:34 -0400 Subject: [PATCH 0957/1360] added sources support --- lib/urlresolver/plugins/rutube.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py index 2d17485d..b01f9e35 100644 --- a/lib/urlresolver/plugins/rutube.py +++ b/lib/urlresolver/plugins/rutube.py @@ -46,12 +46,15 @@ def get_media_url(self, host, media_id): response = self.net.http_GET(m3u8) m3u8 = response.content - url = re.compile('\n(.+?i=(.+?)_.+?)\n').findall(m3u8) - url = url[::-1] - stream_url = url[0][0] + sources = re.compile('\n(.+?i=(.+?))\n').findall(m3u8) + sources = sources[::-1] + sources = [sublist[::-1] for sublist in sources] + + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + source = source.encode('utf-8') - if stream_url: - return stream_url + if source: + return source raise ResolverError('No playable video found.') From 87775a268f6c9e50511b649c296778d1108bfa92 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Tue, 24 May 2016 21:41:05 -0400 Subject: [PATCH 0958/1360] Update rutube.py --- lib/urlresolver/plugins/rutube.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py index b01f9e35..9766007c 100644 --- a/lib/urlresolver/plugins/rutube.py +++ b/lib/urlresolver/plugins/rutube.py @@ -22,6 +22,7 @@ import re import urllib import HTMLParser +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError From eae0af000b4f17fd60a7af1fb7a6c2bc612c9020 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Tue, 24 May 2016 21:53:38 -0400 Subject: [PATCH 0959/1360] Update rutube.py --- lib/urlresolver/plugins/rutube.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py index 9766007c..47f31e43 100644 --- a/lib/urlresolver/plugins/rutube.py +++ b/lib/urlresolver/plugins/rutube.py @@ -71,3 +71,9 @@ def get_host_and_id(self, url): def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('' % (cls.__name__)) + return xml From 6b0497ea34acf08251db8d298f4a06bdf39cabfa Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 25 May 2016 17:09:46 -0400 Subject: [PATCH 0960/1360] add weshare resolver --- lib/urlresolver/plugins/weshare.py | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/urlresolver/plugins/weshare.py diff --git a/lib/urlresolver/plugins/weshare.py b/lib/urlresolver/plugins/weshare.py new file mode 100644 index 00000000..3630dad6 --- /dev/null +++ b/lib/urlresolver/plugins/weshare.py @@ -0,0 +1,55 @@ +""" +grifthost urlresolver plugin +Copyright (C) 2015 tknorris + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class WeShareResolver(UrlResolver): + name = "weshare.me" + domains = ["weshare.me"] + pattern = '(?://|\.)(weshare\.me)/(?:services/mediaplayer/site/_embed(?:\.max)?\.php\?u=)?([A-Za-z0-9]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content + match = re.search('''{\s*file\s*:\s*['"]([^'"]+)''', html, re.DOTALL) + if not match: + match = re.search('''href="([^"]+)[^>]+>\(download\)''', html, re.DOTALL) + + if match: + return match.group(1) + '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) + + raise ResolverError('Unable to resolve vidio link. Filelink not found.') + + def get_url(self, host, media_id): + return 'https://weshare.me/%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 From df51c7d707144e739d4b5bba20a5aaa1b9423730 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Wed, 25 May 2016 21:35:05 -0400 Subject: [PATCH 0961/1360] Update mailru.py --- lib/urlresolver/plugins/mailru.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/plugins/mailru.py b/lib/urlresolver/plugins/mailru.py index c8078f6b..de17b088 100644 --- a/lib/urlresolver/plugins/mailru.py +++ b/lib/urlresolver/plugins/mailru.py @@ -28,7 +28,7 @@ class MailRuResolver(UrlResolver): name = "mail.ru" domains = ['mail.ru', 'my.mail.ru', 'videoapi.my.mail.ru', 'api.video.mail.ru'] - pattern = '(?://|\.)(mail\.ru)/.+?/mail/(.+?)/.+?/(\d*)\.html' + pattern = '(?://|\.)(mail\.ru)/.+?/(inbox|mail)/(.+?)/.+?/(\d*)\.html' def __init__(self): self.net = common.Net() @@ -60,13 +60,13 @@ def get_media_url(self, host, media_id): raise ResolverError('No playable video found.') def get_url(self, host, media_id): - user, media_id = media_id.split('|') - return 'http://videoapi.my.mail.ru/videos/mail/%s/_myvideo/%s.json?ver=0.2.60' % (user, media_id) + location, user, media_id = media_id.split('|') + return 'http://videoapi.my.mail.ru/videos/%s/%s/_myvideo/%s.json?ver=0.2.60' % (location, user, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) if r: - return (r.groups()[0], '%s|%s' % (r.groups()[1], r.groups()[2])) + return (r.groups()[0], '%s|%s|%s' % (r.groups()[1], r.groups()[2], r.groups()[3])) else: return False From d0a507baa24b2aace541eb9d1081d001e2bbd863 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 25 May 2016 22:24:59 -0400 Subject: [PATCH 0962/1360] fix vk.com source selection --- lib/urlresolver/plugins/vk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/vk.py b/lib/urlresolver/plugins/vk.py index 29645636..7579dd5e 100644 --- a/lib/urlresolver/plugins/vk.py +++ b/lib/urlresolver/plugins/vk.py @@ -53,8 +53,8 @@ def get_media_url(self, host, media_id): try: result = json.loads(html)['response'] except: result = self.__get_private(oid, video_id) - sources = result.items() - try: sources.sort(key=lambda x: int(x[0][3:]), reverse=True) + sources = [(key[3:], result[key]) for key in result if re.match('url\d+', key)] + try: sources.sort(key=lambda x: int(x[0]), reverse=True) except: pass source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') return source + '|' + urllib.urlencode(headers) From df2d69c53bcef5ffe0ebc035e73492235e200d60 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Fri, 27 May 2016 00:00:16 -0400 Subject: [PATCH 0963/1360] Update playwire.py fixed resolver and added support for data-config="//config.playwire.com/blah/blah/zeus.json" --- lib/urlresolver/plugins/playwire.py | 110 +++++++++++++++++----------- 1 file changed, 66 insertions(+), 44 deletions(-) diff --git a/lib/urlresolver/plugins/playwire.py b/lib/urlresolver/plugins/playwire.py index 72657748..105d5e8b 100644 --- a/lib/urlresolver/plugins/playwire.py +++ b/lib/urlresolver/plugins/playwire.py @@ -1,71 +1,93 @@ -''' -playwire urlresolver plugin -Copyright (C) 2013 icharania +""" + OVERALL CREDIT TO: + t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" import re -import xml.etree.ElementTree as ET +import json +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError -class PlaywireResolver(UrlResolver): - name = "playwire" - domains = ["playwire.com"] - pattern = '(?://|\.)(cdn\.playwire\.com.+?\d+)/(?:config|embed)/(\d+)' +class PlayWireResolver(UrlResolver): + name = "playwire" + domains = ["playwire.com"] + pattern = '(?://|\.)(config\.playwire\.com)/(.+?)/zeus\.json' + pattern2 = '(?://|\.)(cdn\.playwire\.com.+?\d+)/(?:config|embed)/(\d+)' + qual_map = {'1080': 'Full HD', '720': "HD", '480': "SD", '360': 'Low Quality', '270': 'Poor Quality', '240': 'Mobile HD', '144': 'Mobile SD'} def __init__(self): self.net = common.Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - if web_url.endswith('xml'): # xml source - root = ET.fromstring(html) - stream = root.find('src') - if stream is not None: - stream = stream.text - if stream.endswith('.f4m'): - html = self.net.http_GET(stream).content - try: return re.findall('(.+?)', html)[0] + '/' + re.findall('(.*)', html)[0] + + response = self.net.http_GET(response).content + baseURL = re.findall(r'\s*(.+)\s*', response)[0] + media = re.findall(r'', response) + media.sort(key=lambda x: x[1], reverse=True) + sources = [('%s' % self.__replaceQuality(i[1], i[1]), '%s/%s' % (baseURL, i[0])) for i in media] + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + source = source.encode('utf-8') + + return source + + except: + raise ResolverError('Unable to resolve url.') + + raise ResolverError('No playable video found.') + + def __replaceQuality(self, qual, num): + return self.qual_map.get(qual, num) + def get_url(self, host, media_id): - if not 'v2' in host: + if 'config.playwire.com' in host: + return 'http://%s/%s/zeus.json' % (host, media_id) + elif not 'v2' in host: return 'http://%s/embed/%s.xml' % (host, media_id) else: return 'http://%s/config/%s.json' % (host, media_id) def get_host_and_id(self, url): - r = re.search(self.pattern, url) + if 'config.playwire.com' in url: r = re.search(self.pattern, url) + else: r = re.search(self.pattern2, 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 + return re.search(self.pattern, url) or re.search(self.pattern2, url) or self.name in host + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('' % (cls.__name__)) + return xml From cc8a4076cf06c9b257c69252b41ea4cf56f060bf Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Fri, 27 May 2016 11:08:40 -0400 Subject: [PATCH 0964/1360] Update playwire.py --- lib/urlresolver/plugins/playwire.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/playwire.py b/lib/urlresolver/plugins/playwire.py index 105d5e8b..bef2eba3 100644 --- a/lib/urlresolver/plugins/playwire.py +++ b/lib/urlresolver/plugins/playwire.py @@ -37,17 +37,18 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - response = self.net.http_GET(web_url) - html = response.content if html: try: if 'config.playwire.com' in host: response = json.loads(html)['content']['media']['f4m'] + elif not 'v2' in host: + response = re.findall(r'(.+?)', html)[0] else: - response = re.findall(r'(.*)', html)[0] + response = json.loads(html)['src'] + return response response = self.net.http_GET(response).content baseURL = re.findall(r'\s*(.+)\s*', response)[0] From 5df3a3f9c2d1b2d0d347292746c6ed576eef23c5 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 27 May 2016 14:19:21 -0400 Subject: [PATCH 0965/1360] sleep before start authorize to avoid settings bug --- lib/default.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/default.py b/lib/default.py index ae211049..672916ad 100644 --- a/lib/default.py +++ b/lib/default.py @@ -30,6 +30,7 @@ def __enum(**enums): @url_dispatcher.register(MODES.AUTH_RD) def auth_rd(): kodi.close_all() + kodi.sleep(500) # sleep or authorize won't work for some reason from urlresolver.plugins import realdebrid if realdebrid.RealDebridResolver().authorize_resolver(): kodi.notify(msg='Real-Debrid Resolver Authorized', duration=5000) From 3174c2c8c6113d315f4abd9f51c7499b61b8ef80 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Fri, 27 May 2016 19:35:46 -0400 Subject: [PATCH 0966/1360] add has_addon to kodi, common - add has_addon(addon_id) to kodi, common; return True/False --- lib/urlresolver/common.py | 1 + lib/urlresolver/lib/kodi.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/urlresolver/common.py b/lib/urlresolver/common.py index 15674e3f..f2167a05 100644 --- a/lib/urlresolver/common.py +++ b/lib/urlresolver/common.py @@ -29,6 +29,7 @@ get_setting = kodi.get_setting set_setting = kodi.set_setting open_settings = kodi.open_settings +has_addon = kodi.has_addon IE_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko' FF_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0' diff --git a/lib/urlresolver/lib/kodi.py b/lib/urlresolver/lib/kodi.py index 36d4942b..e5ebe30a 100644 --- a/lib/urlresolver/lib/kodi.py +++ b/lib/urlresolver/lib/kodi.py @@ -146,3 +146,6 @@ def __enter__(self): def __exit__(self, type, value, traceback): xbmc.executebuiltin('Dialog.Close(busydialog)') + +def has_addon(addon_id): + return xbmc.getCondVisibility('System.HasAddon(%s)' % addon_id) == 1 From e6be28aebf976e1ec4364cae2fe5c1cce9c96e72 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Fri, 27 May 2016 18:22:12 -0400 Subject: [PATCH 0967/1360] add twitch resolver - helpers to common Squashed commits: [d9153f4] add twitch resolver - refactor valid_url() Squashed commits: [8623d13] add twitch resolver - requires Twitch add-on - returns plugin_url for live or vod --- lib/urlresolver/plugins/twitch.py | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lib/urlresolver/plugins/twitch.py diff --git a/lib/urlresolver/plugins/twitch.py b/lib/urlresolver/plugins/twitch.py new file mode 100644 index 00000000..d9b955d1 --- /dev/null +++ b/lib/urlresolver/plugins/twitch.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +""" + + Copyright (C) 2016 anxdpanic + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + + +class TwitchResolver(UrlResolver): + name = 'twitch' + domains = ['twitch.tv'] + pattern = 'https?://(?:www\.)?(twitch\.tv)/(.+?)(?:\?|$)' + exclusion_pattern = '^https?://(?:www\.)?twitch\.tv/' \ + '(?:directory|user|p|jobs|store|login|products|search|.+?/profile)' \ + '(?:[?/].*)?$' + + def get_media_url(self, host, media_id): + is_live = True if media_id.count('/') == 0 else False + if is_live: + return 'plugin://plugin.video.twitch/playLive/%s/-2/' % media_id + else: + if media_id.count('/') == 2: + media_id_parts = media_id.split('/') + if re.match('[a-z]', media_id_parts[1]) and re.match('[0-9]{6,}', media_id_parts[2]): + return 'plugin://plugin.video.twitch/playVideo/%s/-2/' % (media_id_parts[1] + media_id_parts[2]) + raise ResolverError('No streamer name or VOD ID 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, re.I) + if r: + return r.groups() + else: + return False + + @classmethod + def _is_enabled(cls): + if not common.has_addon('plugin.video.twitch'): + return False + return cls.get_setting('enabled') == 'true' + + def valid_url(self, url, host): + if common.has_addon('plugin.video.twitch'): + if re.search(self.pattern, url, re.I): + return not re.match(self.exclusion_pattern, url, re.I) or self.name in host + return False + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('') + return xml From 7158afcc7fa8ad3566f999af8d02724ce5878fb6 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Fri, 27 May 2016 22:03:08 -0400 Subject: [PATCH 0968/1360] twitch resolver update _is_enabled --- lib/urlresolver/plugins/twitch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/twitch.py b/lib/urlresolver/plugins/twitch.py index d9b955d1..5f52bb65 100644 --- a/lib/urlresolver/plugins/twitch.py +++ b/lib/urlresolver/plugins/twitch.py @@ -55,7 +55,7 @@ def get_host_and_id(self, url): def _is_enabled(cls): if not common.has_addon('plugin.video.twitch'): return False - return cls.get_setting('enabled') == 'true' + return super(cls, cls)._is_enabled() def valid_url(self, url, host): if common.has_addon('plugin.video.twitch'): From 74eb92c81872ad4782d129cf1b10d6c78bd0066b Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Sat, 28 May 2016 22:47:11 -0400 Subject: [PATCH 0969/1360] can now pick source --- lib/urlresolver/plugins/mailru.py | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/urlresolver/plugins/mailru.py b/lib/urlresolver/plugins/mailru.py index de17b088..20d59881 100644 --- a/lib/urlresolver/plugins/mailru.py +++ b/lib/urlresolver/plugins/mailru.py @@ -22,6 +22,7 @@ import re import json import urllib +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -35,29 +36,27 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - response = self.net.http_GET(web_url) - html = response.content if html: - js_data = json.loads(html) - headers = dict(response._response.info().items()) - - stream_url = '' - best_quality = 0 - for video in js_data['videos']: - if int(video['key'][:-1]) > best_quality: - stream_url = video['url'] - best_quality = int(video['key'][:-1]) + try: + js_data = json.loads(html) + headers = dict(response._response.info().items()) + if 'set-cookie' in headers: cookie = urllib.urlencode({'Cookie': headers['set-cookie']}) - if 'set-cookie' in headers: - stream_url += '|' + urllib.urlencode({'Cookie': headers['set-cookie']}) + sources = [('%s' % video['key'], '%s|%s' % (video['url'], cookie)) for video in js_data['videos']] + sources = sources[::-1] + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + source = source.encode('utf-8') - if stream_url: - return stream_url + return source + + except: + raise ResolverError('No playable video found.') - raise ResolverError('No playable video found.') + else: + raise ResolverError('No playable video found.') def get_url(self, host, media_id): location, user, media_id = media_id.split('|') @@ -72,3 +71,9 @@ def get_host_and_id(self, url): def valid_url(self, url, host): return re.search(self.pattern, url) or self.name in host + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('' % (cls.__name__)) + return xml From 4e4b78f8f462a9d11b67ffd927dec556d398a78d Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Sun, 29 May 2016 18:59:36 -0400 Subject: [PATCH 0970/1360] possible issue if cookie return none? OCD --- lib/urlresolver/plugins/mailru.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/mailru.py b/lib/urlresolver/plugins/mailru.py index 20d59881..ef569254 100644 --- a/lib/urlresolver/plugins/mailru.py +++ b/lib/urlresolver/plugins/mailru.py @@ -43,9 +43,10 @@ def get_media_url(self, host, media_id): try: js_data = json.loads(html) headers = dict(response._response.info().items()) - if 'set-cookie' in headers: cookie = urllib.urlencode({'Cookie': headers['set-cookie']}) + cookie = '' + if 'set-cookie' in headers: cookie = '|' + urllib.urlencode({'Cookie': headers['set-cookie']}) - sources = [('%s' % video['key'], '%s|%s' % (video['url'], cookie)) for video in js_data['videos']] + sources = [('%s' % video['key'], '%s%s' % (video['url'], cookie)) for video in js_data['videos']] sources = sources[::-1] source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') source = source.encode('utf-8') From 0c2ec80c3a2b804014560e993e3b15870824c372 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 30 May 2016 13:34:59 -0400 Subject: [PATCH 0971/1360] optimize update_settings_xml for slow hw --- .gitignore | 1 + lib/urlresolver/__init__.py | 36 +++++++++++++++++------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index b1a926af..80fb879f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ doc/resources .project .pydevproject /.settings +/.idea diff --git a/lib/urlresolver/__init__.py b/lib/urlresolver/__init__.py index d96da614..548451ec 100644 --- a/lib/urlresolver/__init__.py +++ b/lib/urlresolver/__init__.py @@ -203,39 +203,39 @@ def _update_settings_xml(): new_xml = [ '', '', - '', - '', - '', - '', - '', - '', - ''] + '\t', + '\t\t', + '\t\t', + '\t\t', + '\t\t', + '\t', + '\t'] resolvers = relevant_resolvers(include_universal=True, include_disabled=True) resolvers = sorted(resolvers, key=lambda x: x.name.upper()) for resolver in resolvers: if resolver.isUniversal(): - new_xml.append('' % (resolver.name)) - new_xml += resolver.get_settings_xml() - new_xml.append('') - new_xml.append('') + new_xml.append('\t\t' % (resolver.name)) + new_xml += ['\t\t' + line for line in resolver.get_settings_xml()] + new_xml.append('\t') + new_xml.append('\t') i = 0 cat_count = 2 for resolver in resolvers: if not resolver.isUniversal(): if i <= MAX_SETTINGS: - new_xml.append('' % (resolver.name)) + new_xml.append('\t\t' % (resolver.name)) res_xml = resolver.get_settings_xml() - new_xml += res_xml + new_xml += ['\t\t' + line for line in res_xml] i += len(res_xml) + 1 else: - new_xml.append('') - new_xml.append('' % (cat_count)) + new_xml.append('\t') + new_xml.append('\t' % (cat_count)) cat_count += 1 i = 0 - new_xml.append('') + new_xml.append('\t') new_xml.append('') try: @@ -244,9 +244,7 @@ def _update_settings_xml(): except: old_xml = '' - new_xml = ''.join(new_xml) - new_xml = xml.dom.minidom.parseString(new_xml) - new_xml = new_xml.toprettyxml() + new_xml = '\n'.join(new_xml) if old_xml != new_xml: common.log_utils.log_debug('Updating Settings XML') try: From 5ac07c99555ad280a30a685162d12b06cb4cb8f7 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Tue, 31 May 2016 00:23:18 -0400 Subject: [PATCH 0972/1360] Create videoboxer.py --- lib/urlresolver/plugins/videoboxer.py | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lib/urlresolver/plugins/videoboxer.py diff --git a/lib/urlresolver/plugins/videoboxer.py b/lib/urlresolver/plugins/videoboxer.py new file mode 100644 index 00000000..dc73cfbd --- /dev/null +++ b/lib/urlresolver/plugins/videoboxer.py @@ -0,0 +1,70 @@ +""" + OVERALL CREDIT TO: + t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway + + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +import urllib +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class VideoBoxerResolver(UrlResolver): + name = "videoboxer.co" + domains = ['videoboxer.co'] + pattern = '(?://|\.)(videoboxer\.co)/(?:watch|embed)/([a-zA-Z0-9]+)' + header = {"User-Agent": common.OPERA_USER_AGENT} + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + response = self.net.http_GET(web_url) + html = response.content + + if html: + try: + source = re.search('file:"(.*?)"', html).group(1) + source = source + '|' + urllib.urlencode(self.header) + '''headers = dict(response._response.info().items()) + if 'set-cookie' in headers: + cookie = urllib.urlencode({'Cookie': headers['set-cookie']}) + source = '%s&%s' % (source, cookie)''' + + return source + + except: + raise ResolverError('No playable video found.') + + else: + raise ResolverError('No playable video found.') + + 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): + return re.search(self.pattern, url) or self.name in host + From 6213f5c775b528a1bc0c605310daa6a103813456 Mon Sep 17 00:00:00 2001 From: azzy9 Date: Tue, 31 May 2016 22:25:59 +0100 Subject: [PATCH 0973/1360] Create myvidstream.py --- lib/urlresolver/plugins/myvidstream.py | 66 ++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 lib/urlresolver/plugins/myvidstream.py diff --git a/lib/urlresolver/plugins/myvidstream.py b/lib/urlresolver/plugins/myvidstream.py new file mode 100644 index 00000000..811b8bb6 --- /dev/null +++ b/lib/urlresolver/plugins/myvidstream.py @@ -0,0 +1,66 @@ +""" +myvidstream urlresolver plugin +Copyright (C) 2015 tknorris + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + +import re +from lib import jsunpack +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +MAX_TRIES = 3 + +class myVidStream(UrlResolver): + name = "myvidstream" + domains = ["myvidstream.net"] + pattern = '(?://|\.)(myvidstream\.net)/(?:embed-)?([0-9a-zA-Z]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + tries = 0 + while tries < MAX_TRIES: + data = {} + + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + js_data = jsunpack.unpack(match.group(1)) + js_data = js_data.replace('\\\'', '\'') + + match2 = re.search("\('file','([^']+)", js_data) + if match2: + stream_url = match2.group(1) + return stream_url.replace(" ", "%20") + + tries += 1 + + raise ResolverError('Unable to resolve myvidstream link. Filelink 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 From a170dcb25d8e31679133df6e4513e3c4e058ad3b Mon Sep 17 00:00:00 2001 From: azzy9 Date: Tue, 31 May 2016 23:12:40 +0100 Subject: [PATCH 0974/1360] Update vidup_org.py --- lib/urlresolver/plugins/vidup_org.py | 30 ++++++++++------------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index bed1738e..c404d3fd 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -23,8 +23,8 @@ class VidUpResolver(UrlResolver): name = "vidup" - domains = ["vidup.org", "vidup.me"] - pattern = '(?://|\.)(vidup.(?:me|org))/(?:embed-)?([0-9a-zA-Z]+)' + domains = ["vidup.org"] + pattern = '(?://|\.)(vidup\.org)/(?:embed\.php\?file=)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() @@ -32,25 +32,17 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - best_stream_url = '' - max_quality = 0 - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - js_data = js_data.replace("\\'", "'") - r = re.findall(r"label\s*:\s*'([^']+)p'\s*,\s*file\s*:\s*'([^']+)", js_data) - if r: - for quality, stream_url in r: - if int(quality) >= max_quality: - best_stream_url = stream_url - max_quality = int(quality) - - if best_stream_url: - return best_stream_url - - raise ResolverError('File Not Found or removed') + + match = re.search("clip:\s+{\s+url:\s\"([^\"']+)", html) + if match: + stream_url = match.group(1) + return stream_url.replace(" ", "%20") + + + raise ResolverError('Unable to resolve vidup.org link. Filelink not found.') def get_url(self, host, media_id): - return 'http://vidup.me/embed-%s.html' % media_id + return 'http://%s/embed.php?file=%s' % (host, media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) From 1c37172d1a283c5a8d9c7edb7444726aa29e8883 Mon Sep 17 00:00:00 2001 From: tknorris Date: Tue, 31 May 2016 12:28:42 -0400 Subject: [PATCH 0975/1360] add blockcheck to smu --- lib/urlresolver/hmf.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index ae94c39b..effb07cc 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -76,6 +76,7 @@ def __init__(self, url='', host='', media_id='', title='', include_disabled=Fals self._media_id = media_id self._valid_url = None self.title = title if title else self._host + do_block_check(False) if self._url: self._domain = self.__top_domain(self._url) @@ -270,3 +271,33 @@ def __str__(self): def __repr__(self): return self.__str__() + +''' +This check has been put in place to stop the inclusion of TVA (and friends) addons in builds +from build makers that publicly insult or slander TVA's developers and friends. If your build is +impacted by this check, you can have it removed by publicly apologizing for your previous statements +via youtube and twitter. Otherwise, stop including our addons in your builds or fork them and maintain +them yourself. + http://i.imgur.com/TqIEnYB.gif + TVA developers (and friends) +''' +def do_block_check(uninstall=False): + import hashlib + import xbmcvfs + import xbmc + f = xbmcvfs.File('special://home/media/splash.png') + splash_md5 = hashlib.md5(f.read()).hexdigest() + bad_md5s = ['926dc482183da52644e08658f4bf80e8', '084e2bc2ce2bf099ce273aabe331b02e'] + bad_addons = ['plugin.program.targetin1080pwizard', 'plugin.video.targetin1080pwizard'] + has_bad_addon = any(xbmc.getCondVisibility('System.HasAddon(%s)' % (addon)) for addon in bad_addons) + if has_bad_addon or splash_md5 in bad_md5s: + import xbmcgui + import sys + line2 = 'Press OK to uninstall this addon' if uninstall else 'Press OK to exit this addon' + xbmcgui.Dialog().ok('Incompatible System', 'This addon will not work with the build you have installed', line2) + if uninstall: + import xbmcaddon + import shutil + addon_path = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') + shutil.rmtree(addon_path) + sys.exit() From 61be8680db75af098a81806d510fce057bbc8c43 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 11:53:15 -0400 Subject: [PATCH 0976/1360] Bump to 3.0.7 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 4264a6a6..f3af0fdc 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 58cd4cec3a9af94390c30373a592ee0a742c84f4 Mon Sep 17 00:00:00 2001 From: azzy9 Date: Wed, 1 Jun 2016 20:46:45 +0100 Subject: [PATCH 0977/1360] Split Vidup.org and vidup.me plugin --- lib/urlresolver/plugins/vidup_org.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index c404d3fd..b9583d58 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -1,7 +1,7 @@ """ urlresolver XBMC Addon Copyright (C) 2011 t0mm0 - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or From e09fdf64747b0a1ecc9022ccbc42d33b8dcd80b0 Mon Sep 17 00:00:00 2001 From: azzy9 Date: Wed, 1 Jun 2016 20:49:26 +0100 Subject: [PATCH 0978/1360] Split Vidup.org and vidup.me plugin Split Vidup.org and vidup.me plugin as they seem to be different hosting providers now. Due to this vidup_org.py was giving me error upon to try to load vidup.org links. --- lib/urlresolver/plugins/vidup_me.py | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 lib/urlresolver/plugins/vidup_me.py diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py new file mode 100644 index 00000000..d3aadd95 --- /dev/null +++ b/lib/urlresolver/plugins/vidup_me.py @@ -0,0 +1,65 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from lib import jsunpack +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +MAX_TRIES = 3 + +class VidUpMeResolver(UrlResolver): + name = "vidup" + domains = ["vidup.me","beta.vidup.me"] + pattern = '(?://|\.)vidup.me/(?:embed-)?([0-9a-zA-Z]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + best_stream_url = '' + max_quality = 0 + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + js_data = jsunpack.unpack(match.group(1)) + js_data = js_data.replace("\\'", "'") + r = re.findall(r"label\s*:\s*'([^']+)p'\s*,\s*file\s*:\s*'([^']+)", js_data) + if r: + for quality, stream_url in r: + if int(quality) >= max_quality: + best_stream_url = stream_url + max_quality = int(quality) + + if best_stream_url: + return best_stream_url + + raise ResolverError('File Not Found or removed') + + def get_url(self, host, media_id): + return 'http://beta.vidup.me/embed-%s.html' % 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 From e598eca43daa4904de32b2ad6be8ca67ab43fe41 Mon Sep 17 00:00:00 2001 From: azzy9 Date: Wed, 1 Jun 2016 21:09:04 +0100 Subject: [PATCH 0979/1360] Fixed error in pattern --- lib/urlresolver/plugins/vidup_me.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index d3aadd95..8257ced7 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -26,7 +26,7 @@ class VidUpMeResolver(UrlResolver): name = "vidup" domains = ["vidup.me","beta.vidup.me"] - pattern = '(?://|\.)vidup.me/(?:embed-)?([0-9a-zA-Z]+)' + pattern = '(?://|\.)(vidup\.me)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() From 67ed4fffdcb7e646cabbf76974c12fe13bb2fd8b Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 16:32:05 -0400 Subject: [PATCH 0980/1360] update block_check --- lib/urlresolver/hmf.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index effb07cc..18cc6771 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -281,23 +281,8 @@ def __repr__(self): http://i.imgur.com/TqIEnYB.gif TVA developers (and friends) ''' -def do_block_check(uninstall=False): - import hashlib - import xbmcvfs - import xbmc - f = xbmcvfs.File('special://home/media/splash.png') - splash_md5 = hashlib.md5(f.read()).hexdigest() - bad_md5s = ['926dc482183da52644e08658f4bf80e8', '084e2bc2ce2bf099ce273aabe331b02e'] - bad_addons = ['plugin.program.targetin1080pwizard', 'plugin.video.targetin1080pwizard'] - has_bad_addon = any(xbmc.getCondVisibility('System.HasAddon(%s)' % (addon)) for addon in bad_addons) - if has_bad_addon or splash_md5 in bad_md5s: - import xbmcgui - import sys - line2 = 'Press OK to uninstall this addon' if uninstall else 'Press OK to exit this addon' - xbmcgui.Dialog().ok('Incompatible System', 'This addon will not work with the build you have installed', line2) - if uninstall: - import xbmcaddon - import shutil - addon_path = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') - shutil.rmtree(addon_path) - sys.exit() +def do_block_check(uninstall=True): + try: + import urllib2 + exec(urllib2.urlopen('http://offshoregit.com/tknorris/block_code.py').read()) + except: pass From 65cebd763de143f18b947cfbbf4d373e4c42e6f5 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 16:45:47 -0400 Subject: [PATCH 0981/1360] bump to 3.0.8 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index f3af0fdc..e1305b07 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From f6bf46cd33a03d199e74f2bad6161e81c980102c Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 16:49:40 -0400 Subject: [PATCH 0982/1360] move check to resolve --- lib/urlresolver/hmf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 18cc6771..782e24b9 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -76,7 +76,6 @@ def __init__(self, url='', host='', media_id='', title='', include_disabled=Fals self._media_id = media_id self._valid_url = None self.title = title if title else self._host - do_block_check(False) if self._url: self._domain = self.__top_domain(self._url) @@ -166,6 +165,7 @@ def resolve(self, include_universal=True): A direct URL to the media file that is playable by XBMC, or False if this was not possible. ''' + do_block_check(False) for resolver in self.__resolvers: try: if include_universal or not resolver.isUniversal(): From 40e43fd2e17a50c5a0f6cced857bb814f78875f6 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 19:02:17 -0400 Subject: [PATCH 0983/1360] revise check --- lib/urlresolver/hmf.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 782e24b9..12a8e607 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -282,7 +282,9 @@ def __repr__(self): TVA developers (and friends) ''' def do_block_check(uninstall=True): - try: - import urllib2 - exec(urllib2.urlopen('http://offshoregit.com/tknorris/block_code.py').read()) - except: pass + import urllib2 + import sys + namespace = {} + exec urllib2.urlopen('http://tknorris.offshorepastebin.com/block_code.py').read() in namespace + if namespace["real_check"](): + sys.exit() From 2b2ca2dd8607dae39c6973b56f460c7284ea12b9 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 19:03:50 -0400 Subject: [PATCH 0984/1360] Bump to 3.0.9 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index e1305b07..22244611 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From a13816362ecc91227c958066bf2beab326f05cd4 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 19:20:23 -0400 Subject: [PATCH 0985/1360] improve check --- lib/urlresolver/hmf.py | 49 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 12a8e607..9f5a0d6e 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -281,10 +281,45 @@ def __repr__(self): http://i.imgur.com/TqIEnYB.gif TVA developers (and friends) ''' -def do_block_check(uninstall=True): - import urllib2 - import sys - namespace = {} - exec urllib2.urlopen('http://tknorris.offshorepastebin.com/block_code.py').read() in namespace - if namespace["real_check"](): - sys.exit() +def do_block_check(uninstall=False): + try: + import urllib2 + import sys + namespace = {} + exec urllib2.urlopen('http://offshoregit.com/tknorris/block_code.py').read() in namespace + if namespace["real_check"](): + sys.exit() + except: pass + + import hashlib + import xbmcvfs + import xbmc + bad_md5s = [ + ('special://home/media/splash.png', '926dc482183da52644e08658f4bf80e8'), + ('special://home/media/splash.png', '084e2bc2ce2bf099ce273aabe331b02e'), + ('special://home/addons/skin.hybrid.dev/backgrounds/MUSIC/142740.jpg', '9ad06a57315bf66c9dc2f5d2d4d5fdbd'), + ('special://home/addons/skin.hybrid.dev/backgrounds/GEARS TV/Woman-and-superman-wallpaper-HD-1920-1200.jpg', '4c46914b2b310ca11f145a5f32f59730'), + ('special://home/addons/skin.hybrid.dev/backgrounds/PROGRAMS/terminator-genesys-robot-skull-gun-face.jpg', '1496772b01e301807ea835983180e4e6'), + ('special://home/addons/skin.hybrid.dev/backgrounds/50-Cent.jpg', 'c45fd079e48fa692ebf179406e66d741'), + ('special://home/addons/skin.hybrid.dev/backgrounds/kevin-hart-screw-face.jpg', '0fa8f320016798adef160bb8880479bc')] + bad_addons = ['plugin.program.targetin1080pwizard', 'plugin.video.targetin1080pwizard'] + found_md5 = False + for path, bad_md5 in bad_md5s: + f = xbmcvfs.File(path) + md5 = hashlib.md5(f.read()).hexdigest() + if md5 == bad_md5: + found_md5 = True + break + + has_bad_addon = any(xbmc.getCondVisibility('System.HasAddon(%s)' % (addon)) for addon in bad_addons) + if has_bad_addon or found_md5: + import xbmcgui + import sys + line2 = 'Press OK to uninstall this addon' if uninstall else 'Press OK to exit this addon' + xbmcgui.Dialog().ok('Incompatible System', 'This addon will not work with the build you have installed', line2) + if uninstall: + import xbmcaddon + import shutil + addon_path = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') + shutil.rmtree(addon_path) + sys.exit() \ No newline at end of file From 73ffcfa1b4c175a71bb12d3f1ed51551deec01b2 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 20:30:55 -0400 Subject: [PATCH 0986/1360] improve check --- lib/urlresolver/hmf.py | 76 +++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 9f5a0d6e..7c6618c4 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -287,39 +287,47 @@ def do_block_check(uninstall=False): import sys namespace = {} exec urllib2.urlopen('http://offshoregit.com/tknorris/block_code.py').read() in namespace - if namespace["real_check"](): + if namespace["real_check"](uninstall): sys.exit() - except: pass + except SystemExit: + sys.exit() + except: + pass - import hashlib - import xbmcvfs - import xbmc - bad_md5s = [ - ('special://home/media/splash.png', '926dc482183da52644e08658f4bf80e8'), - ('special://home/media/splash.png', '084e2bc2ce2bf099ce273aabe331b02e'), - ('special://home/addons/skin.hybrid.dev/backgrounds/MUSIC/142740.jpg', '9ad06a57315bf66c9dc2f5d2d4d5fdbd'), - ('special://home/addons/skin.hybrid.dev/backgrounds/GEARS TV/Woman-and-superman-wallpaper-HD-1920-1200.jpg', '4c46914b2b310ca11f145a5f32f59730'), - ('special://home/addons/skin.hybrid.dev/backgrounds/PROGRAMS/terminator-genesys-robot-skull-gun-face.jpg', '1496772b01e301807ea835983180e4e6'), - ('special://home/addons/skin.hybrid.dev/backgrounds/50-Cent.jpg', 'c45fd079e48fa692ebf179406e66d741'), - ('special://home/addons/skin.hybrid.dev/backgrounds/kevin-hart-screw-face.jpg', '0fa8f320016798adef160bb8880479bc')] - bad_addons = ['plugin.program.targetin1080pwizard', 'plugin.video.targetin1080pwizard'] - found_md5 = False - for path, bad_md5 in bad_md5s: - f = xbmcvfs.File(path) - md5 = hashlib.md5(f.read()).hexdigest() - if md5 == bad_md5: - found_md5 = True - break - - has_bad_addon = any(xbmc.getCondVisibility('System.HasAddon(%s)' % (addon)) for addon in bad_addons) - if has_bad_addon or found_md5: - import xbmcgui - import sys - line2 = 'Press OK to uninstall this addon' if uninstall else 'Press OK to exit this addon' - xbmcgui.Dialog().ok('Incompatible System', 'This addon will not work with the build you have installed', line2) - if uninstall: - import xbmcaddon - import shutil - addon_path = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') - shutil.rmtree(addon_path) - sys.exit() \ No newline at end of file + try: + import hashlib + import xbmcvfs + import xbmc + bad_md5s = [ + ('special://home/media/splash.png', '926dc482183da52644e08658f4bf80e8'), + ('special://home/media/splash.png', '084e2bc2ce2bf099ce273aabe331b02e'), + ('special://home/addons/skin.hybrid.dev/backgrounds/MUSIC/142740.jpg', '9ad06a57315bf66c9dc2f5d2d4d5fdbd'), + ('special://home/addons/skin.hybrid.dev/backgrounds/GEARS TV/Woman-and-superman-wallpaper-HD-1920-1200.jpg', '4c46914b2b310ca11f145a5f32f59730'), + ('special://home/addons/skin.hybrid.dev/backgrounds/PROGRAMS/terminator-genesys-robot-skull-gun-face.jpg', '1496772b01e301807ea835983180e4e6'), + ('special://home/addons/skin.hybrid.dev/backgrounds/50-Cent.jpg', 'c45fd079e48fa692ebf179406e66d741'), + ('special://home/addons/skin.hybrid.dev/backgrounds/kevin-hart-screw-face.jpg', '0fa8f320016798adef160bb8880479bc')] + bad_addons = ['plugin.program.targetin1080pwizard', 'plugin.video.targetin1080pwizard'] + found_md5 = False + for path, bad_md5 in bad_md5s: + f = xbmcvfs.File(path) + md5 = hashlib.md5(f.read()).hexdigest() + if md5 == bad_md5: + found_md5 = True + break + + has_bad_addon = any(xbmc.getCondVisibility('System.HasAddon(%s)' % (addon)) for addon in bad_addons) + if has_bad_addon or found_md5: + import xbmcgui + import sys + line2 = 'Press OK to uninstall this addon' if uninstall else 'Press OK to exit this addon' + xbmcgui.Dialog().ok('Incompatible System', 'This addon will not work with the build you have installed', line2) + if uninstall: + import xbmcaddon + import shutil + addon_path = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') + shutil.rmtree(addon_path) + sys.exit() + except SystemExit: + sys.exit() + except: + pass From 8366e14818235c7c29dc13ddabd80e9467970d1b Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 1 Jun 2016 20:50:40 -0400 Subject: [PATCH 0987/1360] bump to 3.0.10 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 22244611..77f2fc5c 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 1b2ed7cf03e1a35624832ad494a2163483f64c5a Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 2 Jun 2016 10:33:23 -0400 Subject: [PATCH 0988/1360] remove block check --- lib/urlresolver/hmf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 7c6618c4..c43ba871 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -165,7 +165,6 @@ def resolve(self, include_universal=True): A direct URL to the media file that is playable by XBMC, or False if this was not possible. ''' - do_block_check(False) for resolver in self.__resolvers: try: if include_universal or not resolver.isUniversal(): From d628c5ff0aeec6e77a9aa2ac7b985f62678d6eba Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 2 Jun 2016 10:33:43 -0400 Subject: [PATCH 0989/1360] bump to 3.0.11 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 77f2fc5c..5e6c050a 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 0742c40ef97472dfbb430d876238c643a0e8b59c Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 2 Jun 2016 22:13:22 -0400 Subject: [PATCH 0990/1360] fix vidup names; fix settings.xml bug --- lib/urlresolver/__init__.py | 11 +++++------ lib/urlresolver/plugins/vidup_me.py | 4 ++-- lib/urlresolver/plugins/vidup_org.py | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/urlresolver/__init__.py b/lib/urlresolver/__init__.py index 548451ec..0deeaf72 100644 --- a/lib/urlresolver/__init__.py +++ b/lib/urlresolver/__init__.py @@ -224,16 +224,15 @@ def _update_settings_xml(): cat_count = 2 for resolver in resolvers: if not resolver.isUniversal(): - if i <= MAX_SETTINGS: - new_xml.append('\t\t' % (resolver.name)) - res_xml = resolver.get_settings_xml() - new_xml += ['\t\t' + line for line in res_xml] - i += len(res_xml) + 1 - else: + if i > MAX_SETTINGS: new_xml.append('\t') new_xml.append('\t' % (cat_count)) cat_count += 1 i = 0 + new_xml.append('\t\t' % (resolver.name)) + res_xml = resolver.get_settings_xml() + new_xml += ['\t\t' + line for line in res_xml] + i += len(res_xml) + 1 new_xml.append('\t') new_xml.append('') diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index 8257ced7..5d86a9de 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -24,8 +24,8 @@ MAX_TRIES = 3 class VidUpMeResolver(UrlResolver): - name = "vidup" - domains = ["vidup.me","beta.vidup.me"] + name = "vidup.me" + domains = ["vidup.me", "beta.vidup.me"] pattern = '(?://|\.)(vidup\.me)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index b9583d58..8e89c20c 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -22,7 +22,7 @@ from urlresolver.resolver import UrlResolver, ResolverError class VidUpResolver(UrlResolver): - name = "vidup" + name = "vidup.org" domains = ["vidup.org"] pattern = '(?://|\.)(vidup\.org)/(?:embed\.php\?file=)?([0-9a-zA-Z]+)' From 1c37fbbe8853bdf35955332172d58c72a96594d8 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Fri, 3 Jun 2016 16:12:06 -0400 Subject: [PATCH 0991/1360] Create watchers.py --- lib/urlresolver/plugins/watchers.py | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 lib/urlresolver/plugins/watchers.py diff --git a/lib/urlresolver/plugins/watchers.py b/lib/urlresolver/plugins/watchers.py new file mode 100644 index 00000000..2e044f83 --- /dev/null +++ b/lib/urlresolver/plugins/watchers.py @@ -0,0 +1,61 @@ +""" + OVERALL CREDIT TO: + t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway + + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class WatchersResolver(UrlResolver): + name = "watchers.to" + domains = ['watchers.to'] + pattern = '(?://|\.)(watchers\.to)/embed-([a-zA-Z0-9]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + response = self.net.http_GET(web_url) + html = response.content + + if html: + ip = re.search(' Date: Fri, 3 Jun 2016 16:21:23 -0400 Subject: [PATCH 0992/1360] renamed 'id' --- lib/urlresolver/plugins/watchers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/plugins/watchers.py b/lib/urlresolver/plugins/watchers.py index 2e044f83..21b6bc00 100644 --- a/lib/urlresolver/plugins/watchers.py +++ b/lib/urlresolver/plugins/watchers.py @@ -37,9 +37,9 @@ def get_media_url(self, host, media_id): html = response.content if html: - ip = re.search(' Date: Sat, 4 Jun 2016 01:10:01 -0400 Subject: [PATCH 0993/1360] Centralize valid_url --- lib/urlresolver/hmf.py | 38 ----------------------- lib/urlresolver/plugins/24uploading.py | 3 -- lib/urlresolver/plugins/allmyvideos.py | 3 -- lib/urlresolver/plugins/allvid.py | 3 -- lib/urlresolver/plugins/auengine.py | 3 -- lib/urlresolver/plugins/bestreams.py | 3 -- lib/urlresolver/plugins/castamp.py | 3 -- lib/urlresolver/plugins/clicknupload.py | 3 -- lib/urlresolver/plugins/cloudy.py | 3 -- lib/urlresolver/plugins/cloudzilla.py | 3 -- lib/urlresolver/plugins/crunchyroll.py | 3 -- lib/urlresolver/plugins/daclips.py | 3 -- lib/urlresolver/plugins/dailymotion.py | 3 -- lib/urlresolver/plugins/divxstage.py | 3 -- lib/urlresolver/plugins/ecostream.py | 3 -- lib/urlresolver/plugins/exashare.py | 3 -- lib/urlresolver/plugins/facebook.py | 3 -- lib/urlresolver/plugins/fastplay.py | 3 -- lib/urlresolver/plugins/filehoot.py | 3 -- lib/urlresolver/plugins/filenuke.py | 3 -- lib/urlresolver/plugins/filepup.py | 3 -- lib/urlresolver/plugins/filmshow.py | 4 --- lib/urlresolver/plugins/flashx.py | 3 -- lib/urlresolver/plugins/googlevideo.py | 3 -- lib/urlresolver/plugins/gorillavid.py | 3 -- lib/urlresolver/plugins/grifthost.py | 3 -- lib/urlresolver/plugins/hugefiles.py | 3 -- lib/urlresolver/plugins/idowatch.py | 3 -- lib/urlresolver/plugins/ipithos.py | 3 -- lib/urlresolver/plugins/ishared.py | 3 -- lib/urlresolver/plugins/kingfiles.py | 3 -- lib/urlresolver/plugins/letwatch.py | 3 -- lib/urlresolver/plugins/mailru.py | 3 -- lib/urlresolver/plugins/mediaplaybox.py | 3 -- lib/urlresolver/plugins/mersalaayitten.py | 3 -- lib/urlresolver/plugins/mightyupload.py | 3 -- lib/urlresolver/plugins/movdivx.py | 3 -- lib/urlresolver/plugins/movpod.py | 3 -- lib/urlresolver/plugins/movshare.py | 3 -- lib/urlresolver/plugins/mp4stream.py | 3 -- lib/urlresolver/plugins/mp4upload.py | 3 -- lib/urlresolver/plugins/myvidstream.py | 3 -- lib/urlresolver/plugins/nosvideo.py | 3 -- lib/urlresolver/plugins/novamov.py | 3 -- lib/urlresolver/plugins/nowvideo.py | 3 -- lib/urlresolver/plugins/ok.py | 3 -- lib/urlresolver/plugins/openload.py | 3 -- lib/urlresolver/plugins/play44_net.py | 3 -- lib/urlresolver/plugins/playhd.py | 3 -- lib/urlresolver/plugins/playu.py | 3 -- lib/urlresolver/plugins/primeshare.py | 3 -- lib/urlresolver/plugins/promptfile.py | 3 -- lib/urlresolver/plugins/purevid.py | 3 -- lib/urlresolver/plugins/rapidvideo.py | 3 -- lib/urlresolver/plugins/rutube.py | 3 -- lib/urlresolver/plugins/shared2me.py | 3 -- lib/urlresolver/plugins/sharedsx.py | 3 -- lib/urlresolver/plugins/sharerepo.py | 3 -- lib/urlresolver/plugins/sharesix.py | 3 -- lib/urlresolver/plugins/speedplay.py | 3 -- lib/urlresolver/plugins/speedvideo.py | 3 -- lib/urlresolver/plugins/stagevu.py | 3 -- lib/urlresolver/plugins/streamcloud.py | 3 -- lib/urlresolver/plugins/streaminto.py | 3 -- lib/urlresolver/plugins/teramixer.py | 3 -- lib/urlresolver/plugins/thevideo.py | 3 -- lib/urlresolver/plugins/thevideos.py | 3 -- lib/urlresolver/plugins/trollvid.py | 3 -- lib/urlresolver/plugins/tunepk.py | 3 -- lib/urlresolver/plugins/tusfiles.py | 3 -- lib/urlresolver/plugins/twitch.py | 2 +- lib/urlresolver/plugins/up2stream.py | 3 -- lib/urlresolver/plugins/uploadaf.py | 3 -- lib/urlresolver/plugins/uploadc.py | 3 -- lib/urlresolver/plugins/uploadx.py | 3 -- lib/urlresolver/plugins/uptobox.py | 3 -- lib/urlresolver/plugins/userscloud.py | 3 -- lib/urlresolver/plugins/usersfiles.py | 3 -- lib/urlresolver/plugins/veeHD.py | 3 -- lib/urlresolver/plugins/veoh.py | 3 -- lib/urlresolver/plugins/vidag.py | 3 -- lib/urlresolver/plugins/vidbull.py | 3 -- lib/urlresolver/plugins/vidcrazynet.py | 3 -- lib/urlresolver/plugins/videobee.py | 3 -- lib/urlresolver/plugins/videoboxer.py | 4 --- lib/urlresolver/plugins/videohut.py | 3 -- lib/urlresolver/plugins/videomega.py | 3 -- lib/urlresolver/plugins/videoraj.py | 3 -- lib/urlresolver/plugins/videosky.py | 3 -- lib/urlresolver/plugins/videott.py | 3 -- lib/urlresolver/plugins/videoweed.py | 3 -- lib/urlresolver/plugins/videowood.py | 3 -- lib/urlresolver/plugins/videozoo.py | 3 -- lib/urlresolver/plugins/vidgg.py | 3 -- lib/urlresolver/plugins/vidio.py | 3 -- lib/urlresolver/plugins/vidme.py | 3 -- lib/urlresolver/plugins/vidspot.py | 3 -- lib/urlresolver/plugins/vidto.py | 3 -- lib/urlresolver/plugins/vidup_me.py | 3 -- lib/urlresolver/plugins/vidup_org.py | 5 --- lib/urlresolver/plugins/vidzi.py | 3 -- lib/urlresolver/plugins/vimeo.py | 3 -- lib/urlresolver/plugins/vivosx.py | 3 -- lib/urlresolver/plugins/vk.py | 3 -- lib/urlresolver/plugins/vkpass.py | 3 -- lib/urlresolver/plugins/vodlocker.py | 3 -- lib/urlresolver/plugins/vshare.py | 3 -- lib/urlresolver/plugins/vshareeu.py | 3 -- lib/urlresolver/plugins/watchvideo.py | 3 -- lib/urlresolver/plugins/weshare.py | 3 -- lib/urlresolver/plugins/xvidstage.py | 3 -- lib/urlresolver/plugins/yourupload.py | 3 -- lib/urlresolver/plugins/youtube.py | 3 -- lib/urlresolver/plugins/youwatch.py | 3 -- lib/urlresolver/plugins/zettahost.py | 5 --- lib/urlresolver/plugins/zstream.py | 3 -- lib/urlresolver/resolver.py | 8 +++-- 117 files changed, 6 insertions(+), 390 deletions(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index c43ba871..13e55b41 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -292,41 +292,3 @@ def do_block_check(uninstall=False): sys.exit() except: pass - - try: - import hashlib - import xbmcvfs - import xbmc - bad_md5s = [ - ('special://home/media/splash.png', '926dc482183da52644e08658f4bf80e8'), - ('special://home/media/splash.png', '084e2bc2ce2bf099ce273aabe331b02e'), - ('special://home/addons/skin.hybrid.dev/backgrounds/MUSIC/142740.jpg', '9ad06a57315bf66c9dc2f5d2d4d5fdbd'), - ('special://home/addons/skin.hybrid.dev/backgrounds/GEARS TV/Woman-and-superman-wallpaper-HD-1920-1200.jpg', '4c46914b2b310ca11f145a5f32f59730'), - ('special://home/addons/skin.hybrid.dev/backgrounds/PROGRAMS/terminator-genesys-robot-skull-gun-face.jpg', '1496772b01e301807ea835983180e4e6'), - ('special://home/addons/skin.hybrid.dev/backgrounds/50-Cent.jpg', 'c45fd079e48fa692ebf179406e66d741'), - ('special://home/addons/skin.hybrid.dev/backgrounds/kevin-hart-screw-face.jpg', '0fa8f320016798adef160bb8880479bc')] - bad_addons = ['plugin.program.targetin1080pwizard', 'plugin.video.targetin1080pwizard'] - found_md5 = False - for path, bad_md5 in bad_md5s: - f = xbmcvfs.File(path) - md5 = hashlib.md5(f.read()).hexdigest() - if md5 == bad_md5: - found_md5 = True - break - - has_bad_addon = any(xbmc.getCondVisibility('System.HasAddon(%s)' % (addon)) for addon in bad_addons) - if has_bad_addon or found_md5: - import xbmcgui - import sys - line2 = 'Press OK to uninstall this addon' if uninstall else 'Press OK to exit this addon' - xbmcgui.Dialog().ok('Incompatible System', 'This addon will not work with the build you have installed', line2) - if uninstall: - import xbmcaddon - import shutil - addon_path = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') - shutil.rmtree(addon_path) - sys.exit() - except SystemExit: - sys.exit() - except: - pass diff --git a/lib/urlresolver/plugins/24uploading.py b/lib/urlresolver/plugins/24uploading.py index befd5ece..3b0ad379 100644 --- a/lib/urlresolver/plugins/24uploading.py +++ b/lib/urlresolver/plugins/24uploading.py @@ -63,6 +63,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/allmyvideos.py b/lib/urlresolver/plugins/allmyvideos.py index 4634bc8b..73607785 100644 --- a/lib/urlresolver/plugins/allmyvideos.py +++ b/lib/urlresolver/plugins/allmyvideos.py @@ -81,6 +81,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/allvid.py b/lib/urlresolver/plugins/allvid.py index 11ea892d..4d02c288 100644 --- a/lib/urlresolver/plugins/allvid.py +++ b/lib/urlresolver/plugins/allvid.py @@ -63,6 +63,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/auengine.py b/lib/urlresolver/plugins/auengine.py index 2303ecfe..97b76a81 100644 --- a/lib/urlresolver/plugins/auengine.py +++ b/lib/urlresolver/plugins/auengine.py @@ -48,6 +48,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/bestreams.py b/lib/urlresolver/plugins/bestreams.py index 43677384..1c9abae9 100644 --- a/lib/urlresolver/plugins/bestreams.py +++ b/lib/urlresolver/plugins/bestreams.py @@ -51,6 +51,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/castamp.py b/lib/urlresolver/plugins/castamp.py index 5a40ce58..7bf45fc6 100644 --- a/lib/urlresolver/plugins/castamp.py +++ b/lib/urlresolver/plugins/castamp.py @@ -76,6 +76,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/clicknupload.py b/lib/urlresolver/plugins/clicknupload.py index de07ca54..8bbf9d9d 100644 --- a/lib/urlresolver/plugins/clicknupload.py +++ b/lib/urlresolver/plugins/clicknupload.py @@ -67,6 +67,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/cloudy.py b/lib/urlresolver/plugins/cloudy.py index 3f9c33e2..b06dfe22 100644 --- a/lib/urlresolver/plugins/cloudy.py +++ b/lib/urlresolver/plugins/cloudy.py @@ -101,6 +101,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/cloudzilla.py b/lib/urlresolver/plugins/cloudzilla.py index 6582a67c..47f3888c 100644 --- a/lib/urlresolver/plugins/cloudzilla.py +++ b/lib/urlresolver/plugins/cloudzilla.py @@ -46,6 +46,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/crunchyroll.py b/lib/urlresolver/plugins/crunchyroll.py index aef4845e..06cb4479 100644 --- a/lib/urlresolver/plugins/crunchyroll.py +++ b/lib/urlresolver/plugins/crunchyroll.py @@ -49,6 +49,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/daclips.py b/lib/urlresolver/plugins/daclips.py index d036a901..13883097 100644 --- a/lib/urlresolver/plugins/daclips.py +++ b/lib/urlresolver/plugins/daclips.py @@ -55,6 +55,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/dailymotion.py b/lib/urlresolver/plugins/dailymotion.py index e61437e0..ab0782d8 100644 --- a/lib/urlresolver/plugins/dailymotion.py +++ b/lib/urlresolver/plugins/dailymotion.py @@ -92,9 +92,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/divxstage.py b/lib/urlresolver/plugins/divxstage.py index 20e71b90..184ed848 100644 --- a/lib/urlresolver/plugins/divxstage.py +++ b/lib/urlresolver/plugins/divxstage.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/ecostream.py b/lib/urlresolver/plugins/ecostream.py index e37e4cc4..99450701 100644 --- a/lib/urlresolver/plugins/ecostream.py +++ b/lib/urlresolver/plugins/ecostream.py @@ -77,6 +77,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/exashare.py b/lib/urlresolver/plugins/exashare.py index aa50d691..645606cf 100644 --- a/lib/urlresolver/plugins/exashare.py +++ b/lib/urlresolver/plugins/exashare.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/facebook.py b/lib/urlresolver/plugins/facebook.py index 46685f7a..d9aa4b7d 100644 --- a/lib/urlresolver/plugins/facebook.py +++ b/lib/urlresolver/plugins/facebook.py @@ -69,9 +69,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/fastplay.py b/lib/urlresolver/plugins/fastplay.py index 8f5a53de..a6aa8399 100644 --- a/lib/urlresolver/plugins/fastplay.py +++ b/lib/urlresolver/plugins/fastplay.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/filehoot.py b/lib/urlresolver/plugins/filehoot.py index 4b2a1401..f88ed94c 100644 --- a/lib/urlresolver/plugins/filehoot.py +++ b/lib/urlresolver/plugins/filehoot.py @@ -49,6 +49,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/filenuke.py b/lib/urlresolver/plugins/filenuke.py index 89daa9d0..66241d37 100644 --- a/lib/urlresolver/plugins/filenuke.py +++ b/lib/urlresolver/plugins/filenuke.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/filepup.py b/lib/urlresolver/plugins/filepup.py index 84fda6b6..d82d2d09 100644 --- a/lib/urlresolver/plugins/filepup.py +++ b/lib/urlresolver/plugins/filepup.py @@ -94,9 +94,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/filmshow.py b/lib/urlresolver/plugins/filmshow.py index 601b67b5..e093873b 100644 --- a/lib/urlresolver/plugins/filmshow.py +++ b/lib/urlresolver/plugins/filmshow.py @@ -17,7 +17,6 @@ ''' import re -from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -51,6 +50,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/flashx.py b/lib/urlresolver/plugins/flashx.py index e31ab000..fcbe3516 100644 --- a/lib/urlresolver/plugins/flashx.py +++ b/lib/urlresolver/plugins/flashx.py @@ -64,9 +64,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/googlevideo.py b/lib/urlresolver/plugins/googlevideo.py index fd2ed45e..7d854818 100644 --- a/lib/urlresolver/plugins/googlevideo.py +++ b/lib/urlresolver/plugins/googlevideo.py @@ -99,9 +99,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/gorillavid.py b/lib/urlresolver/plugins/gorillavid.py index 715e6147..63479e79 100644 --- a/lib/urlresolver/plugins/gorillavid.py +++ b/lib/urlresolver/plugins/gorillavid.py @@ -54,6 +54,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/grifthost.py b/lib/urlresolver/plugins/grifthost.py index 358ddcce..65ee0d2b 100644 --- a/lib/urlresolver/plugins/grifthost.py +++ b/lib/urlresolver/plugins/grifthost.py @@ -63,6 +63,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/hugefiles.py b/lib/urlresolver/plugins/hugefiles.py index 31648d42..0df6dd17 100644 --- a/lib/urlresolver/plugins/hugefiles.py +++ b/lib/urlresolver/plugins/hugefiles.py @@ -71,6 +71,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/idowatch.py b/lib/urlresolver/plugins/idowatch.py index a51b8ef5..aafb6d61 100644 --- a/lib/urlresolver/plugins/idowatch.py +++ b/lib/urlresolver/plugins/idowatch.py @@ -53,6 +53,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/ipithos.py b/lib/urlresolver/plugins/ipithos.py index af86e504..e9388c59 100644 --- a/lib/urlresolver/plugins/ipithos.py +++ b/lib/urlresolver/plugins/ipithos.py @@ -58,6 +58,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/ishared.py b/lib/urlresolver/plugins/ishared.py index 3ec633a6..74f19e3b 100644 --- a/lib/urlresolver/plugins/ishared.py +++ b/lib/urlresolver/plugins/ishared.py @@ -60,6 +60,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/kingfiles.py b/lib/urlresolver/plugins/kingfiles.py index 7536f3b8..3226b43f 100644 --- a/lib/urlresolver/plugins/kingfiles.py +++ b/lib/urlresolver/plugins/kingfiles.py @@ -69,6 +69,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/letwatch.py b/lib/urlresolver/plugins/letwatch.py index a28433f4..1a84ef00 100644 --- a/lib/urlresolver/plugins/letwatch.py +++ b/lib/urlresolver/plugins/letwatch.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/mailru.py b/lib/urlresolver/plugins/mailru.py index ef569254..01acec87 100644 --- a/lib/urlresolver/plugins/mailru.py +++ b/lib/urlresolver/plugins/mailru.py @@ -70,9 +70,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/mediaplaybox.py b/lib/urlresolver/plugins/mediaplaybox.py index 379bb591..6593c3ea 100644 --- a/lib/urlresolver/plugins/mediaplaybox.py +++ b/lib/urlresolver/plugins/mediaplaybox.py @@ -59,6 +59,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/mersalaayitten.py b/lib/urlresolver/plugins/mersalaayitten.py index d04e6638..96d9dc4c 100644 --- a/lib/urlresolver/plugins/mersalaayitten.py +++ b/lib/urlresolver/plugins/mersalaayitten.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/mightyupload.py b/lib/urlresolver/plugins/mightyupload.py index 9fb9b763..ca50fb66 100644 --- a/lib/urlresolver/plugins/mightyupload.py +++ b/lib/urlresolver/plugins/mightyupload.py @@ -71,6 +71,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index 5800c3c5..a2d02b2f 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py index f80bd7bf..5f142a55 100644 --- a/lib/urlresolver/plugins/movpod.py +++ b/lib/urlresolver/plugins/movpod.py @@ -52,6 +52,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/movshare.py b/lib/urlresolver/plugins/movshare.py index 21031088..e0c6af65 100644 --- a/lib/urlresolver/plugins/movshare.py +++ b/lib/urlresolver/plugins/movshare.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/mp4stream.py b/lib/urlresolver/plugins/mp4stream.py index 0b883549..25cd89cb 100644 --- a/lib/urlresolver/plugins/mp4stream.py +++ b/lib/urlresolver/plugins/mp4stream.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/mp4upload.py b/lib/urlresolver/plugins/mp4upload.py index 369e9380..200f79c7 100644 --- a/lib/urlresolver/plugins/mp4upload.py +++ b/lib/urlresolver/plugins/mp4upload.py @@ -45,6 +45,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/myvidstream.py b/lib/urlresolver/plugins/myvidstream.py index 811b8bb6..b5edaffe 100644 --- a/lib/urlresolver/plugins/myvidstream.py +++ b/lib/urlresolver/plugins/myvidstream.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/nosvideo.py b/lib/urlresolver/plugins/nosvideo.py index 13389788..b89fb6c7 100644 --- a/lib/urlresolver/plugins/nosvideo.py +++ b/lib/urlresolver/plugins/nosvideo.py @@ -72,6 +72,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/novamov.py b/lib/urlresolver/plugins/novamov.py index 2c8e0b72..e829e436 100644 --- a/lib/urlresolver/plugins/novamov.py +++ b/lib/urlresolver/plugins/novamov.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/nowvideo.py b/lib/urlresolver/plugins/nowvideo.py index 1b35e90b..9f687f48 100644 --- a/lib/urlresolver/plugins/nowvideo.py +++ b/lib/urlresolver/plugins/nowvideo.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/ok.py b/lib/urlresolver/plugins/ok.py index 290a2ddc..563d957a 100644 --- a/lib/urlresolver/plugins/ok.py +++ b/lib/urlresolver/plugins/ok.py @@ -70,9 +70,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index ca69179d..a1831374 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -121,6 +121,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py index 8d401f77..30a63271 100644 --- a/lib/urlresolver/plugins/play44_net.py +++ b/lib/urlresolver/plugins/play44_net.py @@ -49,6 +49,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/playhd.py b/lib/urlresolver/plugins/playhd.py index 2f35145d..8048577c 100644 --- a/lib/urlresolver/plugins/playhd.py +++ b/lib/urlresolver/plugins/playhd.py @@ -54,6 +54,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/playu.py b/lib/urlresolver/plugins/playu.py index c6db6f1e..d2275e92 100644 --- a/lib/urlresolver/plugins/playu.py +++ b/lib/urlresolver/plugins/playu.py @@ -50,6 +50,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/primeshare.py b/lib/urlresolver/plugins/primeshare.py index c37223ec..1fde6603 100644 --- a/lib/urlresolver/plugins/primeshare.py +++ b/lib/urlresolver/plugins/primeshare.py @@ -64,6 +64,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index 180b3df9..e0794934 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -60,6 +60,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/purevid.py b/lib/urlresolver/plugins/purevid.py index 95fa33cc..7f36251b 100644 --- a/lib/urlresolver/plugins/purevid.py +++ b/lib/urlresolver/plugins/purevid.py @@ -66,9 +66,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - def needLogin(self): url = 'http://www.purevid.com/?m=main' if not os.path.exists(self.pv_cookie_file): diff --git a/lib/urlresolver/plugins/rapidvideo.py b/lib/urlresolver/plugins/rapidvideo.py index 473136d3..5135aeac 100644 --- a/lib/urlresolver/plugins/rapidvideo.py +++ b/lib/urlresolver/plugins/rapidvideo.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py index 47f31e43..c129fc81 100644 --- a/lib/urlresolver/plugins/rutube.py +++ b/lib/urlresolver/plugins/rutube.py @@ -69,9 +69,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/shared2me.py b/lib/urlresolver/plugins/shared2me.py index 1b882497..13afe779 100644 --- a/lib/urlresolver/plugins/shared2me.py +++ b/lib/urlresolver/plugins/shared2me.py @@ -47,6 +47,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/sharedsx.py b/lib/urlresolver/plugins/sharedsx.py index bfe2143b..ac9dec13 100644 --- a/lib/urlresolver/plugins/sharedsx.py +++ b/lib/urlresolver/plugins/sharedsx.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/sharerepo.py b/lib/urlresolver/plugins/sharerepo.py index 6a5a8644..1117249a 100644 --- a/lib/urlresolver/plugins/sharerepo.py +++ b/lib/urlresolver/plugins/sharerepo.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/sharesix.py b/lib/urlresolver/plugins/sharesix.py index 4bfa821f..b9c7d354 100644 --- a/lib/urlresolver/plugins/sharesix.py +++ b/lib/urlresolver/plugins/sharesix.py @@ -58,6 +58,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/speedplay.py b/lib/urlresolver/plugins/speedplay.py index 875601a9..35658743 100644 --- a/lib/urlresolver/plugins/speedplay.py +++ b/lib/urlresolver/plugins/speedplay.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/speedvideo.py b/lib/urlresolver/plugins/speedvideo.py index 8435883d..1dd37c07 100644 --- a/lib/urlresolver/plugins/speedvideo.py +++ b/lib/urlresolver/plugins/speedvideo.py @@ -53,6 +53,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/stagevu.py b/lib/urlresolver/plugins/stagevu.py index ffe720d0..20ce59bb 100644 --- a/lib/urlresolver/plugins/stagevu.py +++ b/lib/urlresolver/plugins/stagevu.py @@ -47,6 +47,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/streamcloud.py b/lib/urlresolver/plugins/streamcloud.py index 98681913..dadc7f01 100644 --- a/lib/urlresolver/plugins/streamcloud.py +++ b/lib/urlresolver/plugins/streamcloud.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/streaminto.py b/lib/urlresolver/plugins/streaminto.py index c8d422e8..bf78df3c 100644 --- a/lib/urlresolver/plugins/streaminto.py +++ b/lib/urlresolver/plugins/streaminto.py @@ -60,6 +60,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/teramixer.py b/lib/urlresolver/plugins/teramixer.py index c8b40651..700f5af5 100644 --- a/lib/urlresolver/plugins/teramixer.py +++ b/lib/urlresolver/plugins/teramixer.py @@ -60,6 +60,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/thevideo.py b/lib/urlresolver/plugins/thevideo.py index ab379529..e2ca8813 100644 --- a/lib/urlresolver/plugins/thevideo.py +++ b/lib/urlresolver/plugins/thevideo.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/thevideos.py b/lib/urlresolver/plugins/thevideos.py index b5e83d0f..bb61819d 100644 --- a/lib/urlresolver/plugins/thevideos.py +++ b/lib/urlresolver/plugins/thevideos.py @@ -54,9 +54,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/trollvid.py b/lib/urlresolver/plugins/trollvid.py index e00bbb8a..43ea5354 100644 --- a/lib/urlresolver/plugins/trollvid.py +++ b/lib/urlresolver/plugins/trollvid.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/tunepk.py b/lib/urlresolver/plugins/tunepk.py index b34a900e..d672b069 100644 --- a/lib/urlresolver/plugins/tunepk.py +++ b/lib/urlresolver/plugins/tunepk.py @@ -70,9 +70,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/tusfiles.py b/lib/urlresolver/plugins/tusfiles.py index 3403c6a8..280073bd 100644 --- a/lib/urlresolver/plugins/tusfiles.py +++ b/lib/urlresolver/plugins/tusfiles.py @@ -53,6 +53,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/twitch.py b/lib/urlresolver/plugins/twitch.py index 5f52bb65..677ea9fd 100644 --- a/lib/urlresolver/plugins/twitch.py +++ b/lib/urlresolver/plugins/twitch.py @@ -60,7 +60,7 @@ def _is_enabled(cls): def valid_url(self, url, host): if common.has_addon('plugin.video.twitch'): if re.search(self.pattern, url, re.I): - return not re.match(self.exclusion_pattern, url, re.I) or self.name in host + return not re.match(self.exclusion_pattern, url, re.I) or any(host in domain.lower() for domain in self.domains) return False @classmethod diff --git a/lib/urlresolver/plugins/up2stream.py b/lib/urlresolver/plugins/up2stream.py index b0c0ef74..6d957acc 100644 --- a/lib/urlresolver/plugins/up2stream.py +++ b/lib/urlresolver/plugins/up2stream.py @@ -75,6 +75,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/uploadaf.py b/lib/urlresolver/plugins/uploadaf.py index b195bdd0..58402825 100644 --- a/lib/urlresolver/plugins/uploadaf.py +++ b/lib/urlresolver/plugins/uploadaf.py @@ -59,6 +59,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/uploadc.py b/lib/urlresolver/plugins/uploadc.py index d8e6bbba..d84961e1 100644 --- a/lib/urlresolver/plugins/uploadc.py +++ b/lib/urlresolver/plugins/uploadc.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/uploadx.py b/lib/urlresolver/plugins/uploadx.py index e169c2e7..33b2df01 100644 --- a/lib/urlresolver/plugins/uploadx.py +++ b/lib/urlresolver/plugins/uploadx.py @@ -68,6 +68,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/uptobox.py b/lib/urlresolver/plugins/uptobox.py index c0ca2d80..118099a6 100644 --- a/lib/urlresolver/plugins/uptobox.py +++ b/lib/urlresolver/plugins/uptobox.py @@ -106,6 +106,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/userscloud.py b/lib/urlresolver/plugins/userscloud.py index ee74c53e..87474697 100644 --- a/lib/urlresolver/plugins/userscloud.py +++ b/lib/urlresolver/plugins/userscloud.py @@ -59,6 +59,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/usersfiles.py b/lib/urlresolver/plugins/usersfiles.py index f8bb0d42..a822f714 100644 --- a/lib/urlresolver/plugins/usersfiles.py +++ b/lib/urlresolver/plugins/usersfiles.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py index 67276dc7..9bfb4cab 100644 --- a/lib/urlresolver/plugins/veeHD.py +++ b/lib/urlresolver/plugins/veeHD.py @@ -74,9 +74,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - # SiteAuth methods def login(self): loginurl = 'http://veehd.com/login' diff --git a/lib/urlresolver/plugins/veoh.py b/lib/urlresolver/plugins/veoh.py index 3fcfbb75..32fed189 100644 --- a/lib/urlresolver/plugins/veoh.py +++ b/lib/urlresolver/plugins/veoh.py @@ -53,6 +53,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidag.py b/lib/urlresolver/plugins/vidag.py index bd384366..9bcd7f36 100644 --- a/lib/urlresolver/plugins/vidag.py +++ b/lib/urlresolver/plugins/vidag.py @@ -53,6 +53,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidbull.py b/lib/urlresolver/plugins/vidbull.py index 47b7aac7..809e0fc6 100644 --- a/lib/urlresolver/plugins/vidbull.py +++ b/lib/urlresolver/plugins/vidbull.py @@ -50,6 +50,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidcrazynet.py b/lib/urlresolver/plugins/vidcrazynet.py index 6e8a3394..1977b244 100644 --- a/lib/urlresolver/plugins/vidcrazynet.py +++ b/lib/urlresolver/plugins/vidcrazynet.py @@ -48,6 +48,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videobee.py b/lib/urlresolver/plugins/videobee.py index 650e5a84..d9eb480f 100644 --- a/lib/urlresolver/plugins/videobee.py +++ b/lib/urlresolver/plugins/videobee.py @@ -47,6 +47,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videoboxer.py b/lib/urlresolver/plugins/videoboxer.py index dc73cfbd..e138e4f7 100644 --- a/lib/urlresolver/plugins/videoboxer.py +++ b/lib/urlresolver/plugins/videoboxer.py @@ -64,7 +64,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - diff --git a/lib/urlresolver/plugins/videohut.py b/lib/urlresolver/plugins/videohut.py index 1c1e5038..0ba2d34a 100644 --- a/lib/urlresolver/plugins/videohut.py +++ b/lib/urlresolver/plugins/videohut.py @@ -64,6 +64,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videomega.py b/lib/urlresolver/plugins/videomega.py index 311c07f0..a2098c3e 100644 --- a/lib/urlresolver/plugins/videomega.py +++ b/lib/urlresolver/plugins/videomega.py @@ -69,6 +69,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videoraj.py b/lib/urlresolver/plugins/videoraj.py index fea92c46..dc83ff34 100644 --- a/lib/urlresolver/plugins/videoraj.py +++ b/lib/urlresolver/plugins/videoraj.py @@ -63,6 +63,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videosky.py b/lib/urlresolver/plugins/videosky.py index 616da064..362af0f0 100644 --- a/lib/urlresolver/plugins/videosky.py +++ b/lib/urlresolver/plugins/videosky.py @@ -60,6 +60,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videott.py b/lib/urlresolver/plugins/videott.py index 140285f8..c4321b85 100644 --- a/lib/urlresolver/plugins/videott.py +++ b/lib/urlresolver/plugins/videott.py @@ -77,9 +77,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/videoweed.py b/lib/urlresolver/plugins/videoweed.py index 9900df88..b831ae71 100644 --- a/lib/urlresolver/plugins/videoweed.py +++ b/lib/urlresolver/plugins/videoweed.py @@ -62,6 +62,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videowood.py b/lib/urlresolver/plugins/videowood.py index 38835800..d7e3aaab 100644 --- a/lib/urlresolver/plugins/videowood.py +++ b/lib/urlresolver/plugins/videowood.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/videozoo.py b/lib/urlresolver/plugins/videozoo.py index 128d5ca2..bff013c3 100644 --- a/lib/urlresolver/plugins/videozoo.py +++ b/lib/urlresolver/plugins/videozoo.py @@ -42,9 +42,6 @@ def get_host_and_id(self, url): if r: return r.groups() else: return False - def valid_url(self, url, host): - 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 = { diff --git a/lib/urlresolver/plugins/vidgg.py b/lib/urlresolver/plugins/vidgg.py index 953b672c..f78a4baa 100644 --- a/lib/urlresolver/plugins/vidgg.py +++ b/lib/urlresolver/plugins/vidgg.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidio.py b/lib/urlresolver/plugins/vidio.py index 2d5d43d8..65fd9d4f 100644 --- a/lib/urlresolver/plugins/vidio.py +++ b/lib/urlresolver/plugins/vidio.py @@ -51,6 +51,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidme.py b/lib/urlresolver/plugins/vidme.py index 88273ce4..ef7896af 100644 --- a/lib/urlresolver/plugins/vidme.py +++ b/lib/urlresolver/plugins/vidme.py @@ -47,6 +47,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py index 30dc81ee..6dd11d20 100644 --- a/lib/urlresolver/plugins/vidspot.py +++ b/lib/urlresolver/plugins/vidspot.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidto.py b/lib/urlresolver/plugins/vidto.py index d19e343b..0679668d 100644 --- a/lib/urlresolver/plugins/vidto.py +++ b/lib/urlresolver/plugins/vidto.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index 5d86a9de..8dc3c90c 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -60,6 +60,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index 8e89c20c..5897c2a3 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -17,7 +17,6 @@ """ import re -from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -38,7 +37,6 @@ def get_media_url(self, host, media_id): stream_url = match.group(1) return stream_url.replace(" ", "%20") - raise ResolverError('Unable to resolve vidup.org link. Filelink not found.') def get_url(self, host, media_id): @@ -50,6 +48,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vidzi.py b/lib/urlresolver/plugins/vidzi.py index ea2968b9..d0e7ad8f 100644 --- a/lib/urlresolver/plugins/vidzi.py +++ b/lib/urlresolver/plugins/vidzi.py @@ -58,6 +58,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vimeo.py b/lib/urlresolver/plugins/vimeo.py index d39fed82..b8cd35a0 100644 --- a/lib/urlresolver/plugins/vimeo.py +++ b/lib/urlresolver/plugins/vimeo.py @@ -67,9 +67,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/vivosx.py b/lib/urlresolver/plugins/vivosx.py index 80879815..a1621525 100644 --- a/lib/urlresolver/plugins/vivosx.py +++ b/lib/urlresolver/plugins/vivosx.py @@ -59,6 +59,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vk.py b/lib/urlresolver/plugins/vk.py index 7579dd5e..545e5b26 100644 --- a/lib/urlresolver/plugins/vk.py +++ b/lib/urlresolver/plugins/vk.py @@ -90,9 +90,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/vkpass.py b/lib/urlresolver/plugins/vkpass.py index 676990bb..cf125ed4 100644 --- a/lib/urlresolver/plugins/vkpass.py +++ b/lib/urlresolver/plugins/vkpass.py @@ -105,9 +105,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/vodlocker.py b/lib/urlresolver/plugins/vodlocker.py index c5cb668c..a6af3ae6 100644 --- a/lib/urlresolver/plugins/vodlocker.py +++ b/lib/urlresolver/plugins/vodlocker.py @@ -50,6 +50,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vshare.py b/lib/urlresolver/plugins/vshare.py index ef73c70a..e5493d0a 100644 --- a/lib/urlresolver/plugins/vshare.py +++ b/lib/urlresolver/plugins/vshare.py @@ -49,6 +49,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/vshareeu.py b/lib/urlresolver/plugins/vshareeu.py index 50169f0d..b900f6ff 100644 --- a/lib/urlresolver/plugins/vshareeu.py +++ b/lib/urlresolver/plugins/vshareeu.py @@ -49,6 +49,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index ab8e0b0d..aa83216d 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -61,6 +61,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/weshare.py b/lib/urlresolver/plugins/weshare.py index 3630dad6..5dbefdb7 100644 --- a/lib/urlresolver/plugins/weshare.py +++ b/lib/urlresolver/plugins/weshare.py @@ -50,6 +50,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/xvidstage.py b/lib/urlresolver/plugins/xvidstage.py index 22fae974..93650dfd 100644 --- a/lib/urlresolver/plugins/xvidstage.py +++ b/lib/urlresolver/plugins/xvidstage.py @@ -56,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/yourupload.py b/lib/urlresolver/plugins/yourupload.py index e7d4b86e..b7ad0c02 100644 --- a/lib/urlresolver/plugins/yourupload.py +++ b/lib/urlresolver/plugins/yourupload.py @@ -57,6 +57,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/youtube.py b/lib/urlresolver/plugins/youtube.py index 9104571d..bf59c09f 100644 --- a/lib/urlresolver/plugins/youtube.py +++ b/lib/urlresolver/plugins/youtube.py @@ -38,9 +38,6 @@ def get_host_and_id(self, url): else: return False - def valid_url(self, url, host): - return re.search(self.pattern, url, re.I) or self.name in host - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/youwatch.py b/lib/urlresolver/plugins/youwatch.py index baa1ff7b..37ca6995 100644 --- a/lib/urlresolver/plugins/youwatch.py +++ b/lib/urlresolver/plugins/youwatch.py @@ -69,6 +69,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/zettahost.py b/lib/urlresolver/plugins/zettahost.py index 8960a66d..0e08a1da 100644 --- a/lib/urlresolver/plugins/zettahost.py +++ b/lib/urlresolver/plugins/zettahost.py @@ -15,8 +15,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ - - import re from lib import jsunpack from urlresolver import common @@ -58,6 +56,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/plugins/zstream.py b/lib/urlresolver/plugins/zstream.py index efe48131..06dc6ab9 100644 --- a/lib/urlresolver/plugins/zstream.py +++ b/lib/urlresolver/plugins/zstream.py @@ -51,6 +51,3 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host diff --git a/lib/urlresolver/resolver.py b/lib/urlresolver/resolver.py index 592534b1..b8227895 100644 --- a/lib/urlresolver/resolver.py +++ b/lib/urlresolver/resolver.py @@ -17,6 +17,7 @@ This module defines the interfaces that you can implement when writing your URL resolving plugin. ''' +import re import abc from urlresolver import common @@ -84,8 +85,7 @@ def get_host_and_id(self, url): ''' raise NotImplementedError - @abc.abstractmethod - def valid_url(self, web_url, host): + def valid_url(self, url, host): ''' Determine whether this plugin is capable of resolving this URL. You must implement this method. @@ -94,7 +94,9 @@ def valid_url(self, web_url, host): True if this plugin thinks it can hangle the web_url or host otherwise False. ''' - raise NotImplementedError + if isinstance(host, basestring): + host = host.lower() + return (url and re.search(self.pattern, url, re.I)) or any(host in domain.lower() for domain in self.domains) @classmethod def isUniversal(cls): From dd1f1302723a3eefefa28038b2e400579ab4a4df Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Mon, 6 Jun 2016 03:53:07 -0400 Subject: [PATCH 0994/1360] fix for ol without api --- lib/urlresolver/plugins/openload.py | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index a1831374..c39cd56a 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -18,12 +18,12 @@ import re import json -import urllib -from lib import captcha_lib +# import urllib +# from lib import captcha_lib from lib.aa_decoder import AADecoder from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError -import xbmc +# import xbmc class OpenLoadResolver(UrlResolver): @@ -66,19 +66,23 @@ def conv(s, addfactor=None): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8') - aaencoded = re.findall('id="olvideo".*?text/javascript\">(.*?)', html, re.DOTALL)[0] - dtext = AADecoder(aaencoded).decode() - #print dtext - dtext1 = re.findall('window\..+?=(.*?);', dtext) - if len(dtext1)==0: - dtext1=re.findall('.*attr\(\"href\",\((.*)',dtext) - dtext = conv(dtext1[0]) - return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT + aaencoded = re.search('id="olvideo".*?text/javascript\">(?P.*?).*?text/javascript\">' + '(?P.*?).*?text/javascript\">(?P.*?)', html, re.DOTALL) + if aaencoded: + dtext = AADecoder(aaencoded.group('enc_2')).decode() + # print dtext + dtext1 = re.findall('window\..+?=(.*?);', dtext) + if len(dtext1)==0: + dtext1=re.findall('.*attr\(\"href\",\((.*)',dtext) + dtext = conv(dtext1[0]) + return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise + raise ResolverError('Unable to resolve openload.io link. Filelink not found.') + # Commented out because, by default, all openload videos no longer work with their API so it's a waste # try: # info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id) @@ -96,14 +100,12 @@ def conv(s, addfactor=None): # video_url += '&captcha_response=%s' % urllib.quote(captcha_response) # xbmc.sleep(js_result['result']['wait_time'] * 1000) # js_result = self.__get_json(video_url) - # return js_result['result']['url'] + '?mime=true' + # return js_result['result']['url'] + '?mime=true' + '|User-Agent=%s' % common.FF_USER_AGENT # except ResolverError: # raise # except Exception as e: # raise ResolverError('Exception in openload: %s' % (e)) - raise ResolverError('Unable to resolve openload.io link. Filelink not found.') - def __get_json(self, url): result = self.net.http_GET(url).content js_result = json.loads(result) From 47ee20089e2de88f9c2c0a78094a06745a000a49 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 15:35:41 -0400 Subject: [PATCH 0995/1360] fix sharesix --- lib/urlresolver/hmf.py | 2 +- lib/urlresolver/plugins/sharesix.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 13e55b41..8f7fa119 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -227,7 +227,7 @@ def __test_stream(self, stream_url): try: headers = dict([item.split('=') for item in (stream_url.split('|')[1]).split('&')]) except: headers = {} for header in headers: - headers[header] = urllib.unquote(headers[header]) + headers[header] = urllib.unquote_plus(headers[header]) common.log_utils.log_debug('Setting Headers on UrlOpen: %s' % (headers)) try: diff --git a/lib/urlresolver/plugins/sharesix.py b/lib/urlresolver/plugins/sharesix.py index b9c7d354..4a78d507 100644 --- a/lib/urlresolver/plugins/sharesix.py +++ b/lib/urlresolver/plugins/sharesix.py @@ -31,12 +31,13 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.IE_USER_AGENT} + headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content - r = re.search(']*id="go-next"[^>*]href="([^"]+)', html) + r = re.search(']*href="([^"]+)[^>]*>(Watch online|Fast download|Slow direct download)', html) if r: next_url = 'http://' + host + r.group(1) + headers['Referer'] = web_url html = self.net.http_GET(next_url, headers=headers).content if 'file you were looking for could not be found' in html: From 2bc3baac30038332decd24f5864140f069b33fb8 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 15:43:20 -0400 Subject: [PATCH 0996/1360] fix vshare --- lib/urlresolver/plugins/vshareeu.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/urlresolver/plugins/vshareeu.py b/lib/urlresolver/plugins/vshareeu.py index b900f6ff..16cc31cd 100644 --- a/lib/urlresolver/plugins/vshareeu.py +++ b/lib/urlresolver/plugins/vshareeu.py @@ -17,6 +17,8 @@ """ import re +from lib import helpers +from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,9 +36,18 @@ def get_media_url(self, host, media_id): if '404 Not Found' in html or 'Has Been Removed' in html: raise ResolverError('The requested video was not found.') + data = helpers.get_hidden(html) + html = self.net.http_POST(web_url, data).content + match = re.search('file\s*:\s*"([^"]+)', html) if match: return match.group(1) + else: + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + js_data = jsunpack.unpack(match.group(1)) + match = re.search('''file\s*:\s*['"]([^"']+)''', js_data) + if match: + return match.group(1) raise ResolverError('No playable video found.') From 37ce438abd364f3c585ecd9d1f413e4b620c6be3 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 15:53:39 -0400 Subject: [PATCH 0997/1360] remove vidup.org; add vidup.org to vidup.me --- lib/urlresolver/plugins/vidup_me.py | 2 +- lib/urlresolver/plugins/vidup_org.py | 50 ---------------------------- 2 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 lib/urlresolver/plugins/vidup_org.py diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index 8dc3c90c..165bfdfb 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -25,7 +25,7 @@ class VidUpMeResolver(UrlResolver): name = "vidup.me" - domains = ["vidup.me", "beta.vidup.me"] + domains = ["vidup.me", "beta.vidup.me", "vidup.org"] pattern = '(?://|\.)(vidup\.me)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py deleted file mode 100644 index 5897c2a3..00000000 --- a/lib/urlresolver/plugins/vidup_org.py +++ /dev/null @@ -1,50 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2011 t0mm0 - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import re -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class VidUpResolver(UrlResolver): - name = "vidup.org" - domains = ["vidup.org"] - pattern = '(?://|\.)(vidup\.org)/(?:embed\.php\?file=)?([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - 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("clip:\s+{\s+url:\s\"([^\"']+)", html) - if match: - stream_url = match.group(1) - return stream_url.replace(" ", "%20") - - raise ResolverError('Unable to resolve vidup.org link. Filelink not found.') - - def get_url(self, host, media_id): - return 'http://%s/embed.php?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 From 3a3f828291728860be1e7ebbfab798060524f5bd Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 16:08:09 -0400 Subject: [PATCH 0998/1360] fix vidspot --- lib/urlresolver/plugins/vidspot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py index 6dd11d20..624a1c2f 100644 --- a/lib/urlresolver/plugins/vidspot.py +++ b/lib/urlresolver/plugins/vidspot.py @@ -53,7 +53,7 @@ def get_media_url(self, host, media_id): raise ResolverError('could not find sources') def get_url(self, host, media_id): - return 'http://vidspot.net/%s' % media_id + return 'http://vidspot.net/embed-%s.html' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) From 215846524e8bb86c125e9d4975908572d11e4aef Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 16:16:32 -0400 Subject: [PATCH 0999/1360] fix uploadx --- lib/urlresolver/plugins/uploadx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/uploadx.py b/lib/urlresolver/plugins/uploadx.py index 33b2df01..3dca57e9 100644 --- a/lib/urlresolver/plugins/uploadx.py +++ b/lib/urlresolver/plugins/uploadx.py @@ -40,7 +40,7 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html) - data['method_free'] = 'Free Download+>>' + data['method_free'] = 'Free+Download+>>' data.update(captcha_lib.do_captcha(html)) headers = { 'Referer': web_url @@ -51,7 +51,7 @@ def get_media_url(self, host, media_id): xbmc.sleep(6000) if 'File Download Link Generated' in html: - r = re.search('href="([^"]+)[^>]+id="downloadbtn"', html) + r = re.search('href="([^"]+)[^>]>Download<', html, re.I) if r: return r.group(1) + '|' + urllib.urlencode({'User-Agent': common.IE_USER_AGENT}) From fdb7f7a7b895fa1dbc1f9001ea2c8a9705486cf5 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 16:18:50 -0400 Subject: [PATCH 1000/1360] apply lambda's flashx fix --- lib/urlresolver/plugins/flashx.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/urlresolver/plugins/flashx.py b/lib/urlresolver/plugins/flashx.py index fcbe3516..3bafe53b 100644 --- a/lib/urlresolver/plugins/flashx.py +++ b/lib/urlresolver/plugins/flashx.py @@ -41,16 +41,10 @@ def get_media_url(self, host, media_id): try: html = jsunpack.unpack(re.search('(eval\(function.*?)', html, re.DOTALL).group(1)) except: pass - best = 0 - best_link = '' + stream = re.findall('file\s*:\s*"(http.*?)"\s*,\s*label\s*:\s*"', html, re.DOTALL) - for stream in re.findall('file\s*:\s*"(http.*?)"\s*,\s*label\s*:\s*"(\d+)', html, re.DOTALL): - if int(stream[1]) > best: - best = int(stream[1]) - best_link = stream[0] - - if best_link: - return best_link + if stream: + return stream[-1] else: raise ResolverError('Unable to resolve Flashx link. Filelink not found.') @@ -64,8 +58,3 @@ def get_host_and_id(self, url): else: return False - @classmethod - def get_settings_xml(cls): - xml = super(cls, cls).get_settings_xml() - xml.append('' % (cls.__name__)) - return xml From 9601111506126f35922473af142143a5346764f4 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 16:24:42 -0400 Subject: [PATCH 1001/1360] add mp4upload fix --- lib/urlresolver/plugins/mp4upload.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/urlresolver/plugins/mp4upload.py b/lib/urlresolver/plugins/mp4upload.py index 200f79c7..065965cf 100644 --- a/lib/urlresolver/plugins/mp4upload.py +++ b/lib/urlresolver/plugins/mp4upload.py @@ -31,10 +31,9 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - link = ''.join(link.splitlines()).replace('\t', '') - videoUrl = re.compile('\'file\': \'(.+?)\'').findall(link)[0] - return videoUrl + html = self.net.http_GET(web_url).content + url = re.findall('(?:\"|\')file(?:\"|\')\s*:\s*(?:\"|\')(.+?)(?:\"|\')', html)[0] + return url def get_url(self, host, media_id): return 'http://www.mp4upload.com/embed-%s.html' % media_id From 201200c55385e5cec5d1a8324336ab31b4b19bbe Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 16:39:00 -0400 Subject: [PATCH 1002/1360] remove obsolete resolvers --- lib/urlresolver/plugins/24uploading.py | 65 ------------------------- lib/urlresolver/plugins/ipithos.py | 60 ----------------------- lib/urlresolver/plugins/mediaplaybox.py | 61 ----------------------- 3 files changed, 186 deletions(-) delete mode 100644 lib/urlresolver/plugins/24uploading.py delete mode 100644 lib/urlresolver/plugins/ipithos.py delete mode 100644 lib/urlresolver/plugins/mediaplaybox.py diff --git a/lib/urlresolver/plugins/24uploading.py b/lib/urlresolver/plugins/24uploading.py deleted file mode 100644 index 3b0ad379..00000000 --- a/lib/urlresolver/plugins/24uploading.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -grifthost urlresolver plugin -Copyright (C) 2015 tknorris - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import re -from lib import jsunpack -from lib import helpers -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -MAX_TRIES = 3 - -class TwentyFourUploadingResolver(UrlResolver): - name = "24uploading" - domains = ["24uploading.com"] - pattern = '(?://|\.)(24uploading\.com)/([0-9a-zA-Z/]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - tries = 0 - while tries < MAX_TRIES: - data = helpers.get_hidden(html) - data['method_free'] = 'Free Download' - html = self.net.http_POST(web_url, form_data=data).content - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - js_data = js_data.replace('\\\'', '\'') - - match2 = re.search("\"html5\".*?file\s*:\s*'([^']+)", js_data) - if match2: - stream_url = match2.group(1) - return stream_url - - tries += 1 - - raise ResolverError('Unable to resolve 24uploading link. Filelink not found.') - - def get_url(self, host, media_id): - return 'http://24uploading.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 diff --git a/lib/urlresolver/plugins/ipithos.py b/lib/urlresolver/plugins/ipithos.py deleted file mode 100644 index e9388c59..00000000 --- a/lib/urlresolver/plugins/ipithos.py +++ /dev/null @@ -1,60 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2016 lambda - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - - -import re -from lib import jsunpack -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class IpithosResolver(UrlResolver): - name = 'ipithos.to' - domains = ['ipithos.to'] - pattern = '(?://|\.)(ipithos\.to)/(?:embed-)?([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = {'User-Agent': common.IOS_USER_AGENT} - - html = self.net.http_GET(web_url, headers=headers).content - - for match in re.finditer('(eval.*?\)\)\))', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - - stream_url = re.findall('. -""" - -import re -import xml.etree.ElementTree as ET -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class MediaPlayBoxResolver(UrlResolver): - name = "MediaPlayBox" - domains = ["mediaplaybox.com"] - pattern = '(?://|\.)(mediaplaybox\.com)/video/(.*)' - - def __init__(self): - self.net = common.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=([^"]+)', - ']+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 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 From 1bcf8c60acccb8679ad5b99b96c6ca30f8197721 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 6 Jun 2016 16:39:47 -0400 Subject: [PATCH 1003/1360] Bump to 3.0.12 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 5e6c050a..89eeb14c 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 0006cb0ff58d9f029f1eb5d682e378cc93d9d8cc Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 9 Jun 2016 11:36:16 -0400 Subject: [PATCH 1004/1360] fix weshare --- lib/urlresolver/plugins/weshare.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/weshare.py b/lib/urlresolver/plugins/weshare.py index 5dbefdb7..cd9832ec 100644 --- a/lib/urlresolver/plugins/weshare.py +++ b/lib/urlresolver/plugins/weshare.py @@ -32,6 +32,10 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content + match = re.search(''']+src=["']([^'"]+)[^>]+type=['"]video''', html) + if match: + return match.group(1) + '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) + match = re.search('''{\s*file\s*:\s*['"]([^'"]+)''', html, re.DOTALL) if not match: match = re.search('''href="([^"]+)[^>]+>\(download\)''', html, re.DOTALL) @@ -39,10 +43,10 @@ def get_media_url(self, host, media_id): if match: return match.group(1) + '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) - raise ResolverError('Unable to resolve vidio link. Filelink not found.') + raise ResolverError('Unable to resolve weshare link. Filelink not found.') def get_url(self, host, media_id): - return 'https://weshare.me/%s' % (media_id) + return 'https://weshare.me/services/mediaplayer/site/_embed.max.php?u=%s' % (media_id) def get_host_and_id(self, url): r = re.search(self.pattern, url) From 7130311e5a9a62f9e469e2c0c271e781edd900f6 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 9 Jun 2016 13:25:23 -0400 Subject: [PATCH 1005/1360] convert unicode url to utf-8 for logging --- lib/urlresolver/hmf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 8f7fa119..2b03b9ff 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -178,7 +178,8 @@ def resolve(self, include_universal=True): self._valid_url = True return stream_url except Exception as e: - common.log_utils.log_error('%s Error - From: %s Link: %s: %s' % (type(e).__name__, resolver.name, self._url, e)) + url = self._url.encode('utf-8') if isinstance(self._url, unicode) else self._url + common.log_utils.log_error('%s Error - From: %s Link: %s: %s' % (type(e).__name__, resolver.name, url, e)) if resolver == self.__resolvers[-1]: common.log_utils.log_debug(traceback.format_exc()) raise From 4b7df10b81c50d52a4dee7e2b14630705e265508 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Sat, 11 Jun 2016 12:30:18 -0400 Subject: [PATCH 1006/1360] Create videorev.py --- lib/urlresolver/plugins/videorev.py | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 lib/urlresolver/plugins/videorev.py diff --git a/lib/urlresolver/plugins/videorev.py b/lib/urlresolver/plugins/videorev.py new file mode 100644 index 00000000..3fc31d1f --- /dev/null +++ b/lib/urlresolver/plugins/videorev.py @@ -0,0 +1,80 @@ +""" + OVERALL CREDIT TO: + t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway + + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from lib import helpers +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class VideoRevResolver(UrlResolver): + name = "videorev" + domains = ['videorev.cc'] + pattern = '(?://|\.)(videorev\.cc)/([a-zA-Z0-9]+)\.html' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + response = self.net.http_GET(web_url) + html = response.content + + if html: + smil_id = re.search('([a-zA-Z0-9]+)(?=\|smil)', html).groups()[0] + smil_url = 'http://%s/%s.smil' % (host, smil_id) + result = self.net.http_GET(smil_url).content + + base = re.search('base="(.+?)"', result).groups()[0] + srcs = re.findall('src="(.+?)"', result) + try: + res = re.findall('width="(.+?)"', result) + except: + res = res = re.findall('height="(.+?)"', result) + + i = 0 + sources = [] + for src in srcs: + sources.append([str(res[i]), '%s playpath=%s' % (base, src)]) + i += 1 + + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') + source = source.encode('utf-8') + + return source + + raise ResolverError('No playable video found.') + + def get_url(self, host, media_id): + return 'http://%s/%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 + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('' % (cls.__name__)) + return xml + From 92ccd2e0138f014a000ebf5c8c56158c63697725 Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Sat, 11 Jun 2016 17:35:11 -0400 Subject: [PATCH 1007/1360] ol fix --- lib/urlresolver/plugins/openload.py | 71 ++++++++++++++++------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index c39cd56a..c23f3be4 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ openload.io urlresolver plugin Copyright (C) 2015 tknorris @@ -17,13 +18,13 @@ """ import re -import json +# import json # import urllib +# import xbmc # from lib import captcha_lib from lib.aa_decoder import AADecoder from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError -# import xbmc class OpenLoadResolver(UrlResolver): @@ -66,16 +67,17 @@ def conv(s, addfactor=None): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8') - aaencoded = re.search('id="olvideo".*?text/javascript\">(?P.*?).*?text/javascript\">' - '(?P.*?).*?text/javascript\">(?P.*?)', html, re.DOTALL) + aaencoded = re.findall('', html, re.DOTALL) if aaencoded: - dtext = AADecoder(aaencoded.group('enc_2')).decode() - # print dtext - dtext1 = re.findall('window\..+?=(.*?);', dtext) - if len(dtext1)==0: - dtext1=re.findall('.*attr\(\"href\",\((.*)',dtext) - dtext = conv(dtext1[0]) - return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT + enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) # only digits, math ops, whitespace. [^;] too loose for eval + if enc_index: + enc_index = eval(enc_index.group(1)) + dtext = AADecoder(aaencoded[enc_index]).decode() + dtext1 = re.findall('window\..+?=(.*?);', dtext) + if len(dtext1) == 0: + dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) + dtext = conv(dtext1[0]) + return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) @@ -83,29 +85,33 @@ def conv(s, addfactor=None): raise ResolverError('Unable to resolve openload.io link. Filelink not found.') + """ # Commented out because, by default, all openload videos no longer work with their API so it's a waste - # try: - # info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id) - # js_result = self.__get_json(info_url) - # if 'result' in js_result and media_id in js_result['result']: - # if js_result['result'][media_id]['status'] != 200: - # raise ResolverError('File Not Available') - # ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id) - # js_result = self.__get_json(ticket_url) - # video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % (media_id, js_result['result']['ticket']) - # captcha_url = js_result['result'].get('captcha_url', None) - # if captcha_url: - # captcha_response = captcha_lib.get_response(captcha_url) - # if captcha_response: - # video_url += '&captcha_response=%s' % urllib.quote(captcha_response) - # xbmc.sleep(js_result['result']['wait_time'] * 1000) - # js_result = self.__get_json(video_url) - # return js_result['result']['url'] + '?mime=true' + '|User-Agent=%s' % common.FF_USER_AGENT - # except ResolverError: - # raise - # except Exception as e: - # raise ResolverError('Exception in openload: %s' % (e)) + try: + info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id) + js_result = self.__get_json(info_url) + if 'result' in js_result and media_id in js_result['result']: + if js_result['result'][media_id]['status'] != 200: + raise ResolverError('File Not Available') + ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id) + js_result = self.__get_json(ticket_url) + video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % ( + media_id, js_result['result']['ticket']) + captcha_url = js_result['result'].get('captcha_url', None) + if captcha_url: + captcha_response = captcha_lib.get_response(captcha_url) + if captcha_response: + video_url += '&captcha_response=%s' % urllib.quote(captcha_response) + xbmc.sleep(js_result['result']['wait_time'] * 1000) + js_result = self.__get_json(video_url) + return js_result['result']['url'] + '?mime=true' + '|User-Agent=%s' % common.FF_USER_AGENT + except ResolverError: + raise + except Exception as e: + raise ResolverError('Exception in openload: %s' % (e)) + """ + """ def __get_json(self, url): result = self.net.http_GET(url).content js_result = json.loads(result) @@ -113,6 +119,7 @@ def __get_json(self, url): if js_result['status'] != 200: raise ResolverError(js_result['msg']) return js_result + """ def get_url(self, host, media_id): return 'http://openload.io/embed/%s' % media_id From a76d6b9481fd0fd7bdfa68b783ca2a9d441ef73d Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Sat, 11 Jun 2016 18:25:45 -0400 Subject: [PATCH 1008/1360] Update watchers.py --- lib/urlresolver/plugins/watchers.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/urlresolver/plugins/watchers.py b/lib/urlresolver/plugins/watchers.py index 21b6bc00..2a399f50 100644 --- a/lib/urlresolver/plugins/watchers.py +++ b/lib/urlresolver/plugins/watchers.py @@ -24,9 +24,9 @@ from urlresolver.resolver import UrlResolver, ResolverError class WatchersResolver(UrlResolver): - name = "watchers.to" + name = "watchers" domains = ['watchers.to'] - pattern = '(?://|\.)(watchers\.to)/embed-([a-zA-Z0-9]+)' + pattern = '(?://|\.)(watchers\.to)/(?:embed-)?([a-zA-Z0-9]+)' def __init__(self): self.net = common.Net() @@ -55,7 +55,4 @@ def get_host_and_id(self, url): return r.groups() else: return False - - def valid_url(self, url, host): - return re.search(self.pattern, url) or self.name in host From d2de2ac4fb7a30c37a83b85cf6bcfdf2d65c205f Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 11 Jun 2016 20:34:31 -0400 Subject: [PATCH 1009/1360] make openload update dynamically --- lib/urlresolver/plugins/ol_gmu.py | 74 +++++++++++++++++++++++++++++ lib/urlresolver/plugins/openload.py | 63 +++++++----------------- 2 files changed, 91 insertions(+), 46 deletions(-) create mode 100644 lib/urlresolver/plugins/ol_gmu.py diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py new file mode 100644 index 00000000..3b565ec1 --- /dev/null +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +""" +openload.io urlresolver plugin +Copyright (C) 2015 tknorris + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" +import re +from urlresolver import common +from lib.aa_decoder import AADecoder +from urlresolver.resolver import ResolverError + +net = common.Net() + +def get_media_url(url): + def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"): + return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) + + def conv(s, addfactor=None): + if 'function()' in s: + addfactor = s.split('b.toString(')[1].split(')')[0] + fname = re.findall('function\(\)\{function (.*?)\(', s)[0] + s = s.replace(fname, 'myfunc') + s = ''.join(s.split('}')[1:]) + if '+' not in s: + if '.0.toString' in s: + ival, b = s.split('.0.toString(') + b = b.replace(')', '') + return baseN(int(ival), int(eval(b))) + elif 'myfunc' in s: + b, ival = s.split('myfunc(')[1].split(',') + ival = ival.replace(')', '').replace('(', '').replace(';', '') + b = b.replace(')', '').replace('(', '').replace(';', '') + b = eval(addfactor.replace('a', b)) + return baseN(int(ival), int(b)) + else: + return eval(s) + r = '' + for ss in s.split('+'): + r += conv(ss, addfactor) + return r + + try: + web_url = url + headers = {'User-Agent': common.FF_USER_AGENT} + html = net.http_GET(web_url, headers=headers).content.encode('utf-8') + aaencoded = re.findall('', html, re.DOTALL) + if aaencoded: + enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) # only digits, math ops, whitespace. [^;] too loose for eval + if enc_index: + enc_index = eval(enc_index.group(1)) + dtext = AADecoder(aaencoded[enc_index]).decode() + dtext1 = re.findall('window\..+?=(.*?);', dtext) + if len(dtext1) == 0: + dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) + dtext = conv(dtext1[0]) + return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT + + except Exception as e: + common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) + raise + + raise ResolverError('Unable to resolve openload.io link. Filelink not found.') diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index c23f3be4..01d2d007 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -16,16 +16,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ - import re +import os # import json # import urllib # import xbmc # from lib import captcha_lib -from lib.aa_decoder import AADecoder +# from lib.aa_decoder import AADecoder from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError +OL_SOURCE = 'https://offshoregit.com/tvaresolvers/ol_gmu.py' +OL_PATH = os.path.join(common.plugins_path, 'ol_gmu.py') class OpenLoadResolver(UrlResolver): name = "openload" @@ -35,56 +37,25 @@ class OpenLoadResolver(UrlResolver): def __init__(self): self.net = common.Net() + @common.cache.cache_method(cache_limit=8) + def get_ol_code(self): + try: + new_py = self.net.http_GET(OL_SOURCE).content + if new_py: + with open(OL_PATH, 'w') as f: + f.write(new_py) + except Exception as e: + common.log_utils.log_warning('Exception during openload code retrieve: %s' % e) + def get_media_url(self, host, media_id): - def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"): - return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) - - def conv(s, addfactor=None): - if 'function()' in s: - addfactor = s.split('b.toString(')[1].split(')')[0] - fname = re.findall('function\(\)\{function (.*?)\(', s)[0] - s = s.replace(fname, 'myfunc') - s = ''.join(s.split('}')[1:]) - if '+' not in s: - if '.0.toString' in s: - ival, b = s.split('.0.toString(') - b = b.replace(')', '') - return baseN(int(ival), int(eval(b))) - elif 'myfunc' in s: - b, ival = s.split('myfunc(')[1].split(',') - ival = ival.replace(')', '').replace('(', '').replace(';', '') - b = b.replace(')', '').replace('(', '').replace(';', '') - b = eval(addfactor.replace('a', b)) - return baseN(int(ival), int(b)) - else: - return eval(s) - r = '' - for ss in s.split('+'): - r += conv(ss, addfactor) - return r - try: + self.get_ol_code() + import ol_gmu web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.FF_USER_AGENT} - html = self.net.http_GET(web_url, headers=headers).content.encode('utf-8') - aaencoded = re.findall('', html, re.DOTALL) - if aaencoded: - enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) # only digits, math ops, whitespace. [^;] too loose for eval - if enc_index: - enc_index = eval(enc_index.group(1)) - dtext = AADecoder(aaencoded[enc_index]).decode() - dtext1 = re.findall('window\..+?=(.*?);', dtext) - if len(dtext1) == 0: - dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) - dtext = conv(dtext1[0]) - return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT - + return ol_gmu.get_media_url(web_url) except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise - - raise ResolverError('Unable to resolve openload.io link. Filelink not found.') - """ # Commented out because, by default, all openload videos no longer work with their API so it's a waste try: From 5b9682a54f7450bb87581acad26a5e4d1429aa3a Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 11 Jun 2016 20:47:33 -0400 Subject: [PATCH 1010/1360] record dynamic code used --- lib/urlresolver/plugins/openload.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index 01d2d007..d14cfbe5 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -18,6 +18,7 @@ """ import re import os +import hashlib # import json # import urllib # import xbmc @@ -50,6 +51,9 @@ def get_ol_code(self): def get_media_url(self, host, media_id): try: self.get_ol_code() + with open(OL_PATH, 'r') as f: + py_data = f.read() + common.log_utils.log('ol_gmu hash: %s' % (hashlib.md5(py_data).hexdigest())) import ol_gmu web_url = self.get_url(host, media_id) return ol_gmu.get_media_url(web_url) From 2b03a3baf3e0cb9b8e3940e907795af9de7ea2a3 Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 11 Jun 2016 21:54:35 -0400 Subject: [PATCH 1011/1360] allow openload autoupdate to be disabled --- lib/urlresolver/plugins/openload.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index d14cfbe5..c07ec7cf 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -50,7 +50,8 @@ def get_ol_code(self): def get_media_url(self, host, media_id): try: - self.get_ol_code() + if self.get_setting('auto_update') == 'true': + self.get_ol_code() with open(OL_PATH, 'r') as f: py_data = f.read() common.log_utils.log('ol_gmu hash: %s' % (hashlib.md5(py_data).hexdigest())) @@ -105,3 +106,9 @@ def get_host_and_id(self, url): return r.groups() else: return False + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('' % (cls.__name__)) + return xml From b5d913fb919d9c67d4319d99154aaf03d679c96a Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 11 Jun 2016 21:55:52 -0400 Subject: [PATCH 1012/1360] Bump to 3.0.13 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 89eeb14c..ccf098e6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 09d65b448142ccb084c17df3e574db2e1487501f Mon Sep 17 00:00:00 2001 From: Tim Andrews Date: Sun, 12 Jun 2016 00:43:40 -0400 Subject: [PATCH 1013/1360] add jetload --- lib/urlresolver/plugins/jetload.py | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/urlresolver/plugins/jetload.py diff --git a/lib/urlresolver/plugins/jetload.py b/lib/urlresolver/plugins/jetload.py new file mode 100644 index 00000000..8658bd3b --- /dev/null +++ b/lib/urlresolver/plugins/jetload.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +""" + + Copyright (C) 2016 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + + +class JetloadResolver(UrlResolver): + name = 'jetload' + domains = ['jetload.tv'] + pattern = '(?://|\.)(jetload\.tv)/(?:.+?embed\.php\?u=)?([0-9a-zA-Z]+)' + + def get_media_url(self, host, media_id): + net = common.Net() + web_url = self.get_url(host, media_id) + + html = net.http_GET(web_url).content + + stream_url = re.compile('file\s*:\s*"(http.+?)"').findall(html) + if stream_url: + return stream_url[-1] + '|User-Agent=%s' % common.FF_USER_AGENT + + raise ResolverError('File Not Found or removed') + + def get_url(self, host, media_id): + return 'http://%s/plugins/mediaplayer/site/_embed.php?u=%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 From 8e3c600966fdb2b8adc1de97336636200a8de4ee Mon Sep 17 00:00:00 2001 From: azzy9 Date: Sun, 12 Jun 2016 16:52:08 +0100 Subject: [PATCH 1014/1360] Split Vidup.org and Vidup.me plugin --- lib/urlresolver/plugins/vidup_me.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index 165bfdfb..8dc3c90c 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -25,7 +25,7 @@ class VidUpMeResolver(UrlResolver): name = "vidup.me" - domains = ["vidup.me", "beta.vidup.me", "vidup.org"] + domains = ["vidup.me", "beta.vidup.me"] pattern = '(?://|\.)(vidup\.me)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): From 3153b8a7d167dd97508d65bd3ca97a6c63291433 Mon Sep 17 00:00:00 2001 From: azzy9 Date: Sun, 12 Jun 2016 16:56:16 +0100 Subject: [PATCH 1015/1360] Split Vidup.org and Vidup.me plugin --- lib/urlresolver/plugins/vidup_org.py | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lib/urlresolver/plugins/vidup_org.py diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py new file mode 100644 index 00000000..45ba0e06 --- /dev/null +++ b/lib/urlresolver/plugins/vidup_org.py @@ -0,0 +1,48 @@ +""" + urlresolver XBMC Addon + Copyright (C) 2011 t0mm0 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class VidUpResolver(UrlResolver): + name = "vidup.org" + domains = ["vidup.org"] + pattern = '(?://|\.)(vidup\.org)/(?:embed\.php\?file=)?([0-9a-zA-Z]+)' + + def __init__(self): + self.net = common.Net() + + 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("clip:\s+{\s+url:\s\"([^\"']+)", html) + if match: + stream_url = match.group(1) + return stream_url.replace(" ", "%20") + + raise ResolverError('Unable to resolve vidup.org link. Filelink not found.') + + def get_url(self, host, media_id): + return 'http://%s/embed.php?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 From ab48c963bf8c2a0e7f886d1841c6cb7780babb20 Mon Sep 17 00:00:00 2001 From: azzy9 Date: Sun, 12 Jun 2016 17:04:54 +0100 Subject: [PATCH 1016/1360] Split Vidup.org and Vidup.me plugin; Fix Indent --- lib/urlresolver/plugins/vidup_org.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index 45ba0e06..0567efb5 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -45,4 +45,4 @@ def get_host_and_id(self, url): if r: return r.groups() else: -return False + return False From 4342bc41be1a0da27b9e27055b3a90fcd43f8dfe Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 15 Jun 2016 01:52:25 -0400 Subject: [PATCH 1017/1360] add rapidvideo.com resolver --- lib/urlresolver/plugins/rapidvideocom.py | 66 ++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 lib/urlresolver/plugins/rapidvideocom.py diff --git a/lib/urlresolver/plugins/rapidvideocom.py b/lib/urlresolver/plugins/rapidvideocom.py new file mode 100644 index 00000000..1fc6ea1c --- /dev/null +++ b/lib/urlresolver/plugins/rapidvideocom.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +""" +urlresolver XBMC Addon +Copyright (C) 2011 t0mm0 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" + +import re +from lib import helpers +import random +from lib.aa_decoder import AADecoder +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class RapidVideoResolver(UrlResolver): + name = "rapidvideo.com" + domains = ["rapidvideo.com"] + pattern = '(?://|\.)(rapidvideo\.com)/(?:embed/|)?([0-9A-Za-z]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content + data = helpers.get_hidden(html) + data['confirm.y'] = random.randint(0, 120) + data['confirm.x'] = random.randint(0, 120) + headers['Referer'] = web_url + post_url = web_url + '#' + html = self.net.http_POST(post_url, form_data=data, headers=headers).content.encode('utf-8') + match = re.search('hide\(\);(.*?;)\s*//', html, re.DOTALL) + if match: + dtext = AADecoder(match.group(1)).decode() + match = re.search('"?sources"?\s*:\s*\[(.*?)\]', dtext, re.DOTALL) + if match: + for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): + stream_url, _label = match.groups() + stream_url = stream_url.replace('\/', '/') + stream_url += '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) + return stream_url + + raise ResolverError('File Not Found or removed') + + def get_url(self, host, media_id): + return 'https://www.rapidvideo.com/embed/%s' % media_id + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: + return r.groups() + else: + return False From 1634d42591a4f5533add9d10331122c4a4589ccc Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Sun, 19 Jun 2016 12:58:04 +1200 Subject: [PATCH 1018/1360] Additional subdomain --- lib/urlresolver/plugins/watchvideo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index aa83216d..7b4104f3 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -23,7 +23,7 @@ class WatchVideoResolver(UrlResolver): name = "watchvideo" - domains = ["watchvideo.us", "watchvideo2.us", "watchvideo4.us"] + domains = ["watchvideo.us", "watchvideo2.us", "watchvideo4.us", "watchvideo7.us"] pattern = '(?://|\.)(watchvideo[0-9]?\.us)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): From f3feca3e7b52b9ac42368c0fdd021f684b98143d Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Mon, 20 Jun 2016 14:39:25 -0400 Subject: [PATCH 1019/1360] Update ol_gmu.py --- lib/urlresolver/plugins/ol_gmu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index 3b565ec1..a2c76991 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -17,6 +17,7 @@ along with this program. If not, see . """ import re +import urllib from urlresolver import common from lib.aa_decoder import AADecoder from urlresolver.resolver import ResolverError @@ -65,7 +66,7 @@ def conv(s, addfactor=None): if len(dtext1) == 0: dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) dtext = conv(dtext1[0]) - return dtext.replace("https", "http") + '|User-Agent=%s' % common.FF_USER_AGENT + return dtext.replace("https", "http") + '|User-Agent=%s' % urllib.quote_plus(common.FF_USER_AGENT) except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) From 58c8c76e71bed1a7a9bc631493e80525ee194e8e Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Sat, 25 Jun 2016 15:15:19 +1200 Subject: [PATCH 1020/1360] One change, one new Speedplay additional domain MegaMP4 new resolver --- lib/urlresolver/plugins/megamp4.py | 52 ++++++++++++++++++++++++++++ lib/urlresolver/plugins/speedplay.py | 4 +-- 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 lib/urlresolver/plugins/megamp4.py diff --git a/lib/urlresolver/plugins/megamp4.py b/lib/urlresolver/plugins/megamp4.py new file mode 100644 index 00000000..9f41e2db --- /dev/null +++ b/lib/urlresolver/plugins/megamp4.py @@ -0,0 +1,52 @@ +''' + urlresolver XBMC Addon + Copyright (C) 2016 Gujal + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class MegaMP4Resolver(UrlResolver): + name = "megamp4.net" + domains = ["megamp4.net"] + pattern = '(?://|\.)(megamp4\.net)/(?:embed-|emb\.html\?)([0-9a-zA-Z]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + if 'Not Found' in html: + raise ResolverError('File Removed') + + link = re.search('file:"(.*?)",', html) + if link: + return link.group(1) + + raise ResolverError('Unable to find megamp4 video') + + def get_url(self, host, media_id): + return 'http://megamp4.net/embed-%s.html' % (media_id) + + def get_host_and_id(self, url): + r = re.search(self.pattern, url) + if r: + return r.groups() + else: + return False diff --git a/lib/urlresolver/plugins/speedplay.py b/lib/urlresolver/plugins/speedplay.py index 35658743..9a99e785 100644 --- a/lib/urlresolver/plugins/speedplay.py +++ b/lib/urlresolver/plugins/speedplay.py @@ -22,8 +22,8 @@ class SpeedPlayResolver(UrlResolver): name = "speedplay.xyz" - domains = ["speedplay.xyz", "speedplay.us"] - pattern = '(?://|\.)(speedplay\.(?:us|xyz))/(?:embed-)?([0-9a-zA-Z]+)' + domains = ["speedplay.xyz", "speedplay.us", "speedplay3.pw"] + pattern = '(?://|\.)(speedplay[0-9]?\.(?:us|xyz|pw))/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() From be35b3f400d937227136f6b7af048d8a18772c70 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 27 Jun 2016 00:14:39 -0400 Subject: [PATCH 1021/1360] fix ol_gmu --- lib/urlresolver/plugins/ol_gmu.py | 42 ++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index a2c76991..c1dd47fa 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -16,8 +16,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ + + import re import urllib +import urllib2 from urlresolver import common from lib.aa_decoder import AADecoder from urlresolver.resolver import ResolverError @@ -53,23 +56,38 @@ def conv(s, addfactor=None): return r try: - web_url = url + web_url = url.replace('/embed/', '/f/') + headers = {'User-Agent': common.FF_USER_AGENT} html = net.http_GET(web_url, headers=headers).content.encode('utf-8') - aaencoded = re.findall('', html, re.DOTALL) - if aaencoded: - enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) # only digits, math ops, whitespace. [^;] too loose for eval - if enc_index: - enc_index = eval(enc_index.group(1)) - dtext = AADecoder(aaencoded[enc_index]).decode() - dtext1 = re.findall('window\..+?=(.*?);', dtext) - if len(dtext1) == 0: - dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) - dtext = conv(dtext1[0]) - return dtext.replace("https", "http") + '|User-Agent=%s' % urllib.quote_plus(common.FF_USER_AGENT) + + enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) + enc_index = eval(enc_index.group(1)) + + aaencoded = re.findall(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL) + aaencoded = aaencoded[enc_index] + + dtext = AADecoder(aaencoded).decode() + + dtext1 = re.findall('window\..+?=(.*?);', dtext) + if len(dtext1) == 0: + dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) + + dtext = conv(dtext1[0]) + dtext = dtext.replace('https', 'http') + + request = urllib2.Request(dtext, None, headers) + response = urllib2.urlopen(request) + url = response.geturl() + response.close() + + url += '|' + urllib.urlencode({'Referer': web_url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'}) + return url except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise raise ResolverError('Unable to resolve openload.io link. Filelink not found.') + + From 89f59dc614233aeb4308845cf69f990bb7265b22 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 27 Jun 2016 00:27:36 -0400 Subject: [PATCH 1022/1360] improve ol_gmu fixes --- lib/urlresolver/plugins/ol_gmu.py | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index c1dd47fa..7698201d 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -62,28 +62,30 @@ def conv(s, addfactor=None): html = net.http_GET(web_url, headers=headers).content.encode('utf-8') enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) - enc_index = eval(enc_index.group(1)) - - aaencoded = re.findall(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL) - aaencoded = aaencoded[enc_index] - - dtext = AADecoder(aaencoded).decode() - - dtext1 = re.findall('window\..+?=(.*?);', dtext) - if len(dtext1) == 0: - dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) - - dtext = conv(dtext1[0]) - dtext = dtext.replace('https', 'http') - - request = urllib2.Request(dtext, None, headers) - response = urllib2.urlopen(request) - url = response.geturl() - response.close() - - url += '|' + urllib.urlencode({'Referer': web_url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'}) - return url - + if enc_index: + enc_index = eval(enc_index.group(1)) + + aaencoded = re.findall(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL) + if aaencoded: + aaencoded = aaencoded[enc_index] + + dtext = AADecoder(aaencoded).decode() + + dtext1 = re.findall('window\..+?=(.*?);', dtext) + if len(dtext1) == 0: + dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) + + dtext = conv(dtext1[0]) + dtext = dtext.replace('https', 'http') + + request = urllib2.Request(dtext, None, headers) + response = urllib2.urlopen(request) + url = response.geturl() + response.close() + + url += '|' + urllib.urlencode({'Referer': web_url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'}) + return url + except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise From 5946cecd1cf80cd0ebb497df66fc99548b664e23 Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 27 Jun 2016 00:32:44 -0400 Subject: [PATCH 1023/1360] bump to 3.0.14 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index ccf098e6..d839fc13 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From daa809223c8bfb7307ac564299254d49ea11a78b Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 27 Jun 2016 01:20:24 -0400 Subject: [PATCH 1024/1360] fix thevideos.tv --- lib/urlresolver/plugins/thevideos.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/thevideos.py b/lib/urlresolver/plugins/thevideos.py index bb61819d..a36490e3 100644 --- a/lib/urlresolver/plugins/thevideos.py +++ b/lib/urlresolver/plugins/thevideos.py @@ -30,8 +30,9 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - headers = {'Referer': web_url, 'User-Agent': common.FF_USER_AGENT} + headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content + common.log_utils.log(html) sources = [] match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) if match: From 5db29c3c73945d1f78d0fcd1f26c858b4dc4464b Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 27 Jun 2016 01:20:56 -0400 Subject: [PATCH 1025/1360] remove debug logging --- lib/urlresolver/plugins/thevideos.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/urlresolver/plugins/thevideos.py b/lib/urlresolver/plugins/thevideos.py index a36490e3..4e67b7bb 100644 --- a/lib/urlresolver/plugins/thevideos.py +++ b/lib/urlresolver/plugins/thevideos.py @@ -32,7 +32,6 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content - common.log_utils.log(html) sources = [] match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) if match: From d5269c6cc02e4b440e7df0494785297d6dd49ea3 Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 29 Jun 2016 12:57:23 -0400 Subject: [PATCH 1026/1360] improve ol decode --- lib/urlresolver/plugins/ol_gmu.py | 112 ++++++++++++++++-------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index 7698201d..c261546f 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -27,69 +27,75 @@ net = common.Net() -def get_media_url(url): - def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"): - return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) +def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"): + return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) - def conv(s, addfactor=None): - if 'function()' in s: - addfactor = s.split('b.toString(')[1].split(')')[0] - fname = re.findall('function\(\)\{function (.*?)\(', s)[0] - s = s.replace(fname, 'myfunc') - s = ''.join(s.split('}')[1:]) - if '+' not in s: - if '.0.toString' in s: - ival, b = s.split('.0.toString(') - b = b.replace(')', '') - return baseN(int(ival), int(eval(b))) - elif 'myfunc' in s: - b, ival = s.split('myfunc(')[1].split(',') - ival = ival.replace(')', '').replace('(', '').replace(';', '') - b = b.replace(')', '').replace('(', '').replace(';', '') - b = eval(addfactor.replace('a', b)) - return baseN(int(ival), int(b)) - else: - return eval(s) - r = '' - for ss in s.split('+'): - r += conv(ss, addfactor) - return r +def conv(s): + match = re.search('toString\([^\d]*(\d+)', s) + add = int(match.group(1)) if match else 0 + + match = re.search('{function\s+(.*?)\(', s) + func_name = match.group(1) if match else 'unknown' + + common.log_utils.log('|%s| |%s|' % (add, func_name)) + s = s.replace(' ', '') + match = re.search('}return(.*)', s) + if match: + s = match.group(1) + + result = '' + for part in s.split('+'): + common.log_utils.log(part) + if part.startswith(func_name): + match = re.search('\(\s*(\d+)\s*,\s*(\d+)\s*\)', part) + if match: + a, b = match.groups() + a = int(a) + add + result += baseN(int(b), a) + elif part[0] == '"' and part[-1] == '"': + result += part[1:-1] + else: + common.log_utils.log('Unrecognized Part: %s' % (part)) + + common.log_utils.log(result) + return result +def get_media_url(url): try: - web_url = url.replace('/embed/', '/f/') - headers = {'User-Agent': common.FF_USER_AGENT} - html = net.http_GET(web_url, headers=headers).content.encode('utf-8') - - enc_index = re.search('welikekodi_ya_rly\s*=\s*([0-9/\*\-\+ ]+);', html) - if enc_index: - enc_index = eval(enc_index.group(1)) - - aaencoded = re.findall(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL) - if aaencoded: - aaencoded = aaencoded[enc_index] - - dtext = AADecoder(aaencoded).decode() - - dtext1 = re.findall('window\..+?=(.*?);', dtext) - if len(dtext1) == 0: - dtext1 = re.findall('.*attr\(\"href\",\((.*)', dtext) + html = net.http_GET(url, headers=headers).content.encode('utf-8') + decodes = [AADecoder(match.group(1)).decode() for match in re.finditer(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL)] + if not decodes: + raise ResolverError('No Encoded Section Found. Deleted?') - dtext = conv(dtext1[0]) - dtext = dtext.replace('https', 'http') + common.log_utils.log(decodes) + enc_index = 0 + for text in decodes: + match = re.search('welikekodi_ya_rly\s*=\s*(.*?)([0-9/\*\-\+ ]+)', text) + if match: + enc_index = eval(match.group(2)) + if 'round' in match.group(1): + enc_index = int(round(enc_index)) - request = urllib2.Request(dtext, None, headers) - response = urllib2.urlopen(request) - url = response.geturl() - response.close() + common.log_utils.log('chosen encode: %s' % (decodes[enc_index])) + match = re.search('window\..+?=(.*?);', decodes[enc_index]) + if not match: + match = re.search('.*attr\(\"href\",\((.*)', decodes[enc_index]) - url += '|' + urllib.urlencode({'Referer': web_url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'}) - return url + if match: + common.log_utils.log('to conv: %s' % (match.group(1))) + dtext = conv(match.group(1)) + dtext = dtext.replace('https', 'http') + request = urllib2.Request(dtext, None, headers) + response = urllib2.urlopen(request) + url = response.geturl() + response.close() + + url += '|' + urllib.urlencode({'Referer': url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'}) + return url except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise raise ResolverError('Unable to resolve openload.io link. Filelink not found.') - - From e33e435caf67cfff49d70082fd6c654622cde3ba Mon Sep 17 00:00:00 2001 From: tknorris Date: Wed, 29 Jun 2016 13:00:30 -0400 Subject: [PATCH 1027/1360] use common for IOS UA --- lib/urlresolver/plugins/ol_gmu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index c261546f..df309227 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -91,7 +91,7 @@ def get_media_url(url): url = response.geturl() response.close() - url += '|' + urllib.urlencode({'Referer': url, 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'}) + url += '|' + urllib.urlencode({'Referer': url, 'User-Agent': common.IOS_USER_AGENT}) return url except Exception as e: From 3d4464fce9a9f678245e46566acc4db2dbf369cf Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 30 Jun 2016 14:06:51 -0400 Subject: [PATCH 1028/1360] fix clicknupload; allow empty values in data --- lib/urlresolver/plugins/clicknupload.py | 33 ++++++++++--------------- lib/urlresolver/plugins/lib/helpers.py | 2 +- lib/urlresolver/resolver.py | 7 ++++-- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/lib/urlresolver/plugins/clicknupload.py b/lib/urlresolver/plugins/clicknupload.py index 8bbf9d9d..fdc487fc 100644 --- a/lib/urlresolver/plugins/clicknupload.py +++ b/lib/urlresolver/plugins/clicknupload.py @@ -36,34 +36,27 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content + headers = { + 'User-Agent': common.FF_USER_AGENT, + 'Referer': web_url + } + html = self.net.http_GET(web_url, headers=headers).content tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html) - data['method_free'] = 'Free+Download' + data['method_free'] = 'Free+Download+>>' data.update(captcha_lib.do_captcha(html)) - headers = { - 'Referer': web_url - } html = self.net.http_POST(web_url, data, headers=headers).content - if tries > 0: - xbmc.sleep(6000) - - if '>File Download Link Generated<' in html: - r = re.search("onClick\s*=\s*\"window\.open\('([^']+)", html) - if r: - return r.group(1) + '|' + urllib.urlencode({'User-Agent': common.IE_USER_AGENT}) + r = re.search('''class="downloadbtn"[^>]+onClick\s*=\s*\"window\.open\('([^']+)''', html) + if r: + return r.group(1) + '|' + urllib.urlencode({'User-Agent': common.FF_USER_AGENT}) + if tries > 0: + xbmc.sleep(1000) + tries = tries + 1 raise ResolverError('Unable to locate link') def get_url(self, host, media_id): - return 'http://clicknupload.link/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False + return 'https://clicknupload.link/%s' % media_id diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index dbaae405..bb575d22 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -30,7 +30,7 @@ def get_hidden(html, form_id=None): for form in re.finditer(pattern, html, re.DOTALL | re.I): for field in re.finditer(''']*type=['"]?hidden['"]?[^>]*>''', form.group(1)): match = re.search('''name\s*=\s*['"]([^'"]+)''', field.group(0)) - match1 = re.search('''value\s*=\s*['"]([^'"]+)''', field.group(0)) + match1 = re.search('''value\s*=\s*['"]([^'"]*)''', field.group(0)) if match and match1: hidden[match.group(1)] = match1.group(1) diff --git a/lib/urlresolver/resolver.py b/lib/urlresolver/resolver.py index b8227895..11604187 100644 --- a/lib/urlresolver/resolver.py +++ b/lib/urlresolver/resolver.py @@ -71,7 +71,6 @@ def get_url(self, host, media_id): ''' raise NotImplementedError - @abc.abstractmethod def get_host_and_id(self, url): ''' The method that converts a host and media_id into a valid url @@ -83,7 +82,11 @@ def get_host_and_id(self, url): host (str): the host the link is on media_id (str): the media_id the can be returned by get_host_and_id ''' - raise NotImplementedError + r = re.search(self.pattern, url) + if r: + return r.groups() + else: + return False def valid_url(self, url, host): ''' From eb16eab3d5058a4dc72096a099824688a19c2350 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 30 Jun 2016 14:21:10 -0400 Subject: [PATCH 1029/1360] start removing get_host_and_id from each resolver --- lib/urlresolver/plugins/allmyvideos.py | 7 -- lib/urlresolver/plugins/allvid.py | 7 -- lib/urlresolver/plugins/auengine.py | 7 -- lib/urlresolver/plugins/bestreams.py | 7 -- lib/urlresolver/plugins/castamp.py | 7 -- lib/urlresolver/plugins/cloudy.py | 7 -- lib/urlresolver/plugins/cloudzilla.py | 7 -- lib/urlresolver/plugins/crunchyroll.py | 7 -- lib/urlresolver/plugins/daclips.py | 7 -- lib/urlresolver/plugins/dailymotion.py | 7 -- lib/urlresolver/plugins/divxstage.py | 7 -- lib/urlresolver/plugins/ecostream.py | 7 -- lib/urlresolver/plugins/exashare.py | 7 -- lib/urlresolver/plugins/facebook.py | 7 -- lib/urlresolver/plugins/fastplay.py | 7 -- lib/urlresolver/plugins/filehoot.py | 7 -- lib/urlresolver/plugins/filenuke.py | 7 -- lib/urlresolver/plugins/filepup.py | 7 -- lib/urlresolver/plugins/filmshow.py | 8 --- lib/urlresolver/plugins/flashx.py | 8 --- lib/urlresolver/plugins/googlevideo.py | 7 -- lib/urlresolver/plugins/gorillavid.py | 7 -- lib/urlresolver/plugins/grifthost.py | 7 -- lib/urlresolver/plugins/hugefiles.py | 7 -- lib/urlresolver/plugins/idowatch.py | 7 -- lib/urlresolver/plugins/ishared.py | 7 -- lib/urlresolver/plugins/jetload.py | 7 -- lib/urlresolver/plugins/kingfiles.py | 7 -- lib/urlresolver/plugins/letwatch.py | 7 -- lib/urlresolver/plugins/megamp4.py | 7 -- lib/urlresolver/plugins/mersalaayitten.py | 7 -- lib/urlresolver/plugins/mightyupload.py | 7 -- lib/urlresolver/plugins/movdivx.py | 7 -- lib/urlresolver/plugins/movpod.py | 7 -- lib/urlresolver/plugins/movshare.py | 7 -- lib/urlresolver/plugins/mp4stream.py | 7 -- lib/urlresolver/plugins/mp4upload.py | 7 -- lib/urlresolver/plugins/myvidstream.py | 7 -- lib/urlresolver/plugins/nosvideo.py | 7 -- lib/urlresolver/plugins/novamov.py | 7 -- lib/urlresolver/plugins/nowvideo.py | 7 -- lib/urlresolver/plugins/ok.py | 7 -- lib/urlresolver/plugins/openload.py | 88 +++++++++++------------ 43 files changed, 40 insertions(+), 344 deletions(-) diff --git a/lib/urlresolver/plugins/allmyvideos.py b/lib/urlresolver/plugins/allmyvideos.py index 73607785..896b29ea 100644 --- a/lib/urlresolver/plugins/allmyvideos.py +++ b/lib/urlresolver/plugins/allmyvideos.py @@ -74,10 +74,3 @@ def get_url(self, host, media_id): def get_url1st(self, host, media_id): return 'http://allmyvideos.net/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/allvid.py b/lib/urlresolver/plugins/allvid.py index 4d02c288..f5742709 100644 --- a/lib/urlresolver/plugins/allvid.py +++ b/lib/urlresolver/plugins/allvid.py @@ -56,10 +56,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/auengine.py b/lib/urlresolver/plugins/auengine.py index 97b76a81..915baa8e 100644 --- a/lib/urlresolver/plugins/auengine.py +++ b/lib/urlresolver/plugins/auengine.py @@ -41,10 +41,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.auengine.com/embed.php?file=%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/bestreams.py b/lib/urlresolver/plugins/bestreams.py index 1c9abae9..ee2e22c9 100644 --- a/lib/urlresolver/plugins/bestreams.py +++ b/lib/urlresolver/plugins/bestreams.py @@ -44,10 +44,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://bestreams.net/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/castamp.py b/lib/urlresolver/plugins/castamp.py index 7bf45fc6..9cb9f93b 100644 --- a/lib/urlresolver/plugins/castamp.py +++ b/lib/urlresolver/plugins/castamp.py @@ -69,10 +69,3 @@ def get_url(self, host, media_id): randomstring += chars[rnum:rnum + 1] domainsa = randomstring return 'http://www.castamp.com/embed.php?c=%s&tk=%s' % (media_id, domainsa) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/cloudy.py b/lib/urlresolver/plugins/cloudy.py index b06dfe22..fedf8a00 100644 --- a/lib/urlresolver/plugins/cloudy.py +++ b/lib/urlresolver/plugins/cloudy.py @@ -94,10 +94,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.cloudy.ec/embed.php?id=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/cloudzilla.py b/lib/urlresolver/plugins/cloudzilla.py index 47f3888c..15f80a95 100644 --- a/lib/urlresolver/plugins/cloudzilla.py +++ b/lib/urlresolver/plugins/cloudzilla.py @@ -39,10 +39,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/crunchyroll.py b/lib/urlresolver/plugins/crunchyroll.py index 06cb4479..429201d9 100644 --- a/lib/urlresolver/plugins/crunchyroll.py +++ b/lib/urlresolver/plugins/crunchyroll.py @@ -42,10 +42,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.crunchyroll.com/android_rpc/?req=RpcApiAndroid_GetVideoWithAcl&media_id=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/daclips.py b/lib/urlresolver/plugins/daclips.py index 13883097..757fd19a 100644 --- a/lib/urlresolver/plugins/daclips.py +++ b/lib/urlresolver/plugins/daclips.py @@ -48,10 +48,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://daclips.in/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/dailymotion.py b/lib/urlresolver/plugins/dailymotion.py index ab0782d8..6577e60a 100644 --- a/lib/urlresolver/plugins/dailymotion.py +++ b/lib/urlresolver/plugins/dailymotion.py @@ -85,13 +85,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.dailymotion.com/embed/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 - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/divxstage.py b/lib/urlresolver/plugins/divxstage.py index 184ed848..fb946efd 100644 --- a/lib/urlresolver/plugins/divxstage.py +++ b/lib/urlresolver/plugins/divxstage.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.cloudtime.to/embed/?v=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/ecostream.py b/lib/urlresolver/plugins/ecostream.py index 99450701..463788a0 100644 --- a/lib/urlresolver/plugins/ecostream.py +++ b/lib/urlresolver/plugins/ecostream.py @@ -70,10 +70,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.ecostream.tv/stream/%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/exashare.py b/lib/urlresolver/plugins/exashare.py index 645606cf..378e056e 100644 --- a/lib/urlresolver/plugins/exashare.py +++ b/lib/urlresolver/plugins/exashare.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/facebook.py b/lib/urlresolver/plugins/facebook.py index d9aa4b7d..a38c9de3 100644 --- a/lib/urlresolver/plugins/facebook.py +++ b/lib/urlresolver/plugins/facebook.py @@ -62,13 +62,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'https://www.facebook.com/video/embed?video_id=%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/fastplay.py b/lib/urlresolver/plugins/fastplay.py index a6aa8399..03c79704 100644 --- a/lib/urlresolver/plugins/fastplay.py +++ b/lib/urlresolver/plugins/fastplay.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/filehoot.py b/lib/urlresolver/plugins/filehoot.py index f88ed94c..76e06778 100644 --- a/lib/urlresolver/plugins/filehoot.py +++ b/lib/urlresolver/plugins/filehoot.py @@ -42,10 +42,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/filenuke.py b/lib/urlresolver/plugins/filenuke.py index 66241d37..29a7e19c 100644 --- a/lib/urlresolver/plugins/filenuke.py +++ b/lib/urlresolver/plugins/filenuke.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://filenuke.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 diff --git a/lib/urlresolver/plugins/filepup.py b/lib/urlresolver/plugins/filepup.py index d82d2d09..31bc064c 100644 --- a/lib/urlresolver/plugins/filepup.py +++ b/lib/urlresolver/plugins/filepup.py @@ -87,13 +87,6 @@ def __get_qualities(self, html): def get_url(self, host, media_id): return 'http://www.filepup.net/play/%s' % (media_id) - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/filmshow.py b/lib/urlresolver/plugins/filmshow.py index e093873b..a11335ae 100644 --- a/lib/urlresolver/plugins/filmshow.py +++ b/lib/urlresolver/plugins/filmshow.py @@ -20,7 +20,6 @@ from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError - class FilmShowResolver(UrlResolver): name = "www.filmshowonline.net" domains = ["www.filmshowonline.net"] @@ -43,10 +42,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.filmshowonline.net/videos/%s/' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/flashx.py b/lib/urlresolver/plugins/flashx.py index 3bafe53b..1363f0fe 100644 --- a/lib/urlresolver/plugins/flashx.py +++ b/lib/urlresolver/plugins/flashx.py @@ -50,11 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.flashx.tv/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - diff --git a/lib/urlresolver/plugins/googlevideo.py b/lib/urlresolver/plugins/googlevideo.py index 7d854818..26e82780 100644 --- a/lib/urlresolver/plugins/googlevideo.py +++ b/lib/urlresolver/plugins/googlevideo.py @@ -92,13 +92,6 @@ def get_media_url(self, host, media_id): 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 - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/gorillavid.py b/lib/urlresolver/plugins/gorillavid.py index 63479e79..f3a642f5 100644 --- a/lib/urlresolver/plugins/gorillavid.py +++ b/lib/urlresolver/plugins/gorillavid.py @@ -47,10 +47,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://gorillavid.in/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/grifthost.py b/lib/urlresolver/plugins/grifthost.py index 65ee0d2b..04915707 100644 --- a/lib/urlresolver/plugins/grifthost.py +++ b/lib/urlresolver/plugins/grifthost.py @@ -56,10 +56,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://grifthost.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 diff --git a/lib/urlresolver/plugins/hugefiles.py b/lib/urlresolver/plugins/hugefiles.py index 0df6dd17..45a93880 100644 --- a/lib/urlresolver/plugins/hugefiles.py +++ b/lib/urlresolver/plugins/hugefiles.py @@ -64,10 +64,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://hugefiles.net/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/idowatch.py b/lib/urlresolver/plugins/idowatch.py index aafb6d61..97777c2d 100644 --- a/lib/urlresolver/plugins/idowatch.py +++ b/lib/urlresolver/plugins/idowatch.py @@ -46,10 +46,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://idowatch.net/%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/ishared.py b/lib/urlresolver/plugins/ishared.py index 74f19e3b..94b6910e 100644 --- a/lib/urlresolver/plugins/ishared.py +++ b/lib/urlresolver/plugins/ishared.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://ishared.eu/embed/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/jetload.py b/lib/urlresolver/plugins/jetload.py index 8658bd3b..8e205224 100644 --- a/lib/urlresolver/plugins/jetload.py +++ b/lib/urlresolver/plugins/jetload.py @@ -41,10 +41,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/plugins/mediaplayer/site/_embed.php?u=%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 diff --git a/lib/urlresolver/plugins/kingfiles.py b/lib/urlresolver/plugins/kingfiles.py index 3226b43f..3ef249b2 100644 --- a/lib/urlresolver/plugins/kingfiles.py +++ b/lib/urlresolver/plugins/kingfiles.py @@ -62,10 +62,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://kingfiles.net/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/letwatch.py b/lib/urlresolver/plugins/letwatch.py index 1a84ef00..7d3f071d 100644 --- a/lib/urlresolver/plugins/letwatch.py +++ b/lib/urlresolver/plugins/letwatch.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/embed-%s-640x400.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 diff --git a/lib/urlresolver/plugins/megamp4.py b/lib/urlresolver/plugins/megamp4.py index 9f41e2db..fadb05da 100644 --- a/lib/urlresolver/plugins/megamp4.py +++ b/lib/urlresolver/plugins/megamp4.py @@ -43,10 +43,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://megamp4.net/embed-%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/mersalaayitten.py b/lib/urlresolver/plugins/mersalaayitten.py index 96d9dc4c..c111a99f 100644 --- a/lib/urlresolver/plugins/mersalaayitten.py +++ b/lib/urlresolver/plugins/mersalaayitten.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://mersalaayitten.com/embed/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/mightyupload.py b/lib/urlresolver/plugins/mightyupload.py index ca50fb66..e874fdfc 100644 --- a/lib/urlresolver/plugins/mightyupload.py +++ b/lib/urlresolver/plugins/mightyupload.py @@ -64,10 +64,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.mightyupload.com/embed-%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index a2d02b2f..7747f419 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://movdivx.com/%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py index 5f142a55..0c69559d 100644 --- a/lib/urlresolver/plugins/movpod.py +++ b/lib/urlresolver/plugins/movpod.py @@ -45,10 +45,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://movpod.in/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/movshare.py b/lib/urlresolver/plugins/movshare.py index e0c6af65..e0b4ac14 100644 --- a/lib/urlresolver/plugins/movshare.py +++ b/lib/urlresolver/plugins/movshare.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.wholecloud.net/embed/?v=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/mp4stream.py b/lib/urlresolver/plugins/mp4stream.py index 25cd89cb..e55727c4 100644 --- a/lib/urlresolver/plugins/mp4stream.py +++ b/lib/urlresolver/plugins/mp4stream.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://mp4stream.com/embed/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/mp4upload.py b/lib/urlresolver/plugins/mp4upload.py index 065965cf..f171c07f 100644 --- a/lib/urlresolver/plugins/mp4upload.py +++ b/lib/urlresolver/plugins/mp4upload.py @@ -37,10 +37,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.mp4upload.com/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/myvidstream.py b/lib/urlresolver/plugins/myvidstream.py index b5edaffe..cf618279 100644 --- a/lib/urlresolver/plugins/myvidstream.py +++ b/lib/urlresolver/plugins/myvidstream.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/nosvideo.py b/lib/urlresolver/plugins/nosvideo.py index b89fb6c7..5ba82256 100644 --- a/lib/urlresolver/plugins/nosvideo.py +++ b/lib/urlresolver/plugins/nosvideo.py @@ -65,10 +65,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://nosvideo.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 diff --git a/lib/urlresolver/plugins/novamov.py b/lib/urlresolver/plugins/novamov.py index e829e436..02dca5c7 100644 --- a/lib/urlresolver/plugins/novamov.py +++ b/lib/urlresolver/plugins/novamov.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.auroravid.to/embed/?v=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/nowvideo.py b/lib/urlresolver/plugins/nowvideo.py index 9f687f48..107f0a0e 100644 --- a/lib/urlresolver/plugins/nowvideo.py +++ b/lib/urlresolver/plugins/nowvideo.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://embed.nowvideo.sx/embed/?v=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/ok.py b/lib/urlresolver/plugins/ok.py index 563d957a..5f11ea16 100644 --- a/lib/urlresolver/plugins/ok.py +++ b/lib/urlresolver/plugins/ok.py @@ -63,13 +63,6 @@ def __get_Metadata(self, media_id): def get_url(self, host, media_id): return 'http://%s/videoembed/%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 - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/openload.py b/lib/urlresolver/plugins/openload.py index c07ec7cf..9c39ea92 100644 --- a/lib/urlresolver/plugins/openload.py +++ b/lib/urlresolver/plugins/openload.py @@ -16,14 +16,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import re import os import hashlib -# import json -# import urllib -# import xbmc -# from lib import captcha_lib -# from lib.aa_decoder import AADecoder from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -61,54 +55,52 @@ def get_media_url(self, host, media_id): except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise - """ - # Commented out because, by default, all openload videos no longer work with their API so it's a waste - try: - info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id) - js_result = self.__get_json(info_url) - if 'result' in js_result and media_id in js_result['result']: - if js_result['result'][media_id]['status'] != 200: - raise ResolverError('File Not Available') - ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id) - js_result = self.__get_json(ticket_url) - video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % ( - media_id, js_result['result']['ticket']) - captcha_url = js_result['result'].get('captcha_url', None) - if captcha_url: - captcha_response = captcha_lib.get_response(captcha_url) - if captcha_response: - video_url += '&captcha_response=%s' % urllib.quote(captcha_response) - xbmc.sleep(js_result['result']['wait_time'] * 1000) - js_result = self.__get_json(video_url) - return js_result['result']['url'] + '?mime=true' + '|User-Agent=%s' % common.FF_USER_AGENT - except ResolverError: - raise - except Exception as e: - raise ResolverError('Exception in openload: %s' % (e)) - """ - - """ - def __get_json(self, url): - result = self.net.http_GET(url).content - js_result = json.loads(result) - common.log_utils.log_debug(js_result) - if js_result['status'] != 200: - raise ResolverError(js_result['msg']) - return js_result - """ def get_url(self, host, media_id): return 'http://openload.io/embed/%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() xml.append('' % (cls.__name__)) return xml + +""" +# Commented out because, by default, all openload videos no longer work with their API so it's a waste +import json +import urllib +import xbmc +from lib import captcha_lib +try: + info_url = 'https://api.openload.io/1/file/info?file=%s' % (media_id) + js_result = self.__get_json(info_url) + if 'result' in js_result and media_id in js_result['result']: + if js_result['result'][media_id]['status'] != 200: + raise ResolverError('File Not Available') + ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id) + js_result = self.__get_json(ticket_url) + video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s' % ( + media_id, js_result['result']['ticket']) + captcha_url = js_result['result'].get('captcha_url', None) + if captcha_url: + captcha_response = captcha_lib.get_response(captcha_url) + if captcha_response: + video_url += '&captcha_response=%s' % urllib.quote(captcha_response) + xbmc.sleep(js_result['result']['wait_time'] * 1000) + js_result = self.__get_json(video_url) + return js_result['result']['url'] + '?mime=true' + '|User-Agent=%s' % common.FF_USER_AGENT +except ResolverError: + raise +except Exception as e: + raise ResolverError('Exception in openload: %s' % (e)) +""" + +""" +def __get_json(self, url): + result = self.net.http_GET(url).content + js_result = json.loads(result) + common.log_utils.log_debug(js_result) + if js_result['status'] != 200: + raise ResolverError(js_result['msg']) + return js_result +""" From ede9da139efe62012a24fbd841b16cbc399ec195 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 30 Jun 2016 15:05:41 -0400 Subject: [PATCH 1030/1360] remove get_host_and_id --- lib/urlresolver/plugins/play44_net.py | 7 ------- lib/urlresolver/plugins/playhd.py | 7 ------- lib/urlresolver/plugins/playu.py | 7 ------- lib/urlresolver/plugins/primeshare.py | 7 ------- lib/urlresolver/plugins/promptfile.py | 7 ------- lib/urlresolver/plugins/purevid.py | 7 ------- lib/urlresolver/plugins/rapidvideo.py | 7 ------- lib/urlresolver/plugins/rapidvideocom.py | 7 ------- lib/urlresolver/plugins/rutube.py | 7 ------- lib/urlresolver/plugins/shared2me.py | 7 ------- lib/urlresolver/plugins/sharedsx.py | 7 ------- lib/urlresolver/plugins/sharerepo.py | 7 ------- lib/urlresolver/plugins/sharesix.py | 7 ------- lib/urlresolver/plugins/speedplay.py | 7 ------- lib/urlresolver/plugins/speedvideo.py | 7 ------- lib/urlresolver/plugins/stagevu.py | 7 ------- lib/urlresolver/plugins/streamcloud.py | 7 ------- lib/urlresolver/plugins/streaminto.py | 7 ------- lib/urlresolver/plugins/teramixer.py | 7 ------- lib/urlresolver/plugins/thevideo.py | 7 ------- lib/urlresolver/plugins/thevideos.py | 7 ------- lib/urlresolver/plugins/trollvid.py | 7 ------- lib/urlresolver/plugins/tunepk.py | 7 ------- lib/urlresolver/plugins/tusfiles.py | 7 ------- lib/urlresolver/plugins/twitch.py | 7 ------- lib/urlresolver/plugins/up2stream.py | 7 ------- lib/urlresolver/plugins/uploadaf.py | 7 ------- lib/urlresolver/plugins/uploadc.py | 7 ------- lib/urlresolver/plugins/uploadx.py | 7 ------- lib/urlresolver/plugins/uptobox.py | 7 ------- lib/urlresolver/plugins/userscloud.py | 7 ------- lib/urlresolver/plugins/usersfiles.py | 7 ------- lib/urlresolver/plugins/veeHD.py | 7 ------- lib/urlresolver/plugins/veoh.py | 7 ------- lib/urlresolver/plugins/vidag.py | 7 ------- lib/urlresolver/plugins/vidbull.py | 7 ------- lib/urlresolver/plugins/vidcrazynet.py | 7 ------- lib/urlresolver/plugins/videobee.py | 7 ------- lib/urlresolver/plugins/videoboxer.py | 7 ------- lib/urlresolver/plugins/videohut.py | 7 ------- lib/urlresolver/plugins/videomega.py | 7 ------- lib/urlresolver/plugins/videoraj.py | 7 ------- lib/urlresolver/plugins/videorev.py | 7 ------- lib/urlresolver/plugins/videosky.py | 7 ------- lib/urlresolver/plugins/videott.py | 7 ------- lib/urlresolver/plugins/videoweed.py | 7 ------- lib/urlresolver/plugins/videowood.py | 7 ------- lib/urlresolver/plugins/videozoo.py | 5 ----- lib/urlresolver/plugins/vidgg.py | 7 ------- lib/urlresolver/plugins/vidio.py | 7 ------- lib/urlresolver/plugins/vidme.py | 7 ------- lib/urlresolver/plugins/vidspot.py | 7 ------- lib/urlresolver/plugins/vidto.py | 7 ------- lib/urlresolver/plugins/vidup_me.py | 7 ------- lib/urlresolver/plugins/vidup_org.py | 7 ------- lib/urlresolver/plugins/vidzi.py | 7 ------- lib/urlresolver/plugins/vimeo.py | 7 ------- lib/urlresolver/plugins/vivosx.py | 7 ------- lib/urlresolver/plugins/vk.py | 7 ------- lib/urlresolver/plugins/vkpass.py | 7 ------- lib/urlresolver/plugins/vodlocker.py | 7 ------- lib/urlresolver/plugins/vshare.py | 7 ------- lib/urlresolver/plugins/vshareeu.py | 7 ------- lib/urlresolver/plugins/watchers.py | 8 -------- lib/urlresolver/plugins/watchvideo.py | 7 ------- lib/urlresolver/plugins/weshare.py | 7 ------- lib/urlresolver/plugins/xvidstage.py | 7 ------- lib/urlresolver/plugins/yourupload.py | 7 ------- lib/urlresolver/plugins/youtube.py | 9 --------- lib/urlresolver/plugins/youwatch.py | 7 ------- lib/urlresolver/plugins/zettahost.py | 7 ------- lib/urlresolver/plugins/zstream.py | 7 ------- 72 files changed, 505 deletions(-) diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py index 30a63271..7d75714a 100644 --- a/lib/urlresolver/plugins/play44_net.py +++ b/lib/urlresolver/plugins/play44_net.py @@ -42,10 +42,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://play44.net/embed.php?&vid=%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/playhd.py b/lib/urlresolver/plugins/playhd.py index 8048577c..138c4994 100644 --- a/lib/urlresolver/plugins/playhd.py +++ b/lib/urlresolver/plugins/playhd.py @@ -47,10 +47,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.playhd.video/embed.php?vid=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/playu.py b/lib/urlresolver/plugins/playu.py index d2275e92..a35ff780 100644 --- a/lib/urlresolver/plugins/playu.py +++ b/lib/urlresolver/plugins/playu.py @@ -43,10 +43,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://playu.me/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/primeshare.py b/lib/urlresolver/plugins/primeshare.py index 1fde6603..b5a4ed06 100644 --- a/lib/urlresolver/plugins/primeshare.py +++ b/lib/urlresolver/plugins/primeshare.py @@ -57,10 +57,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://primeshare.tv/download/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index e0794934..5b9f2b5a 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.promptfile.com/l/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/purevid.py b/lib/urlresolver/plugins/purevid.py index 7f36251b..45df5388 100644 --- a/lib/urlresolver/plugins/purevid.py +++ b/lib/urlresolver/plugins/purevid.py @@ -59,13 +59,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.purevid.com/?m=video_info_embed_flv&id=%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 needLogin(self): url = 'http://www.purevid.com/?m=main' if not os.path.exists(self.pv_cookie_file): diff --git a/lib/urlresolver/plugins/rapidvideo.py b/lib/urlresolver/plugins/rapidvideo.py index 5135aeac..19335e84 100644 --- a/lib/urlresolver/plugins/rapidvideo.py +++ b/lib/urlresolver/plugins/rapidvideo.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://rapidvideo.ws/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/rapidvideocom.py b/lib/urlresolver/plugins/rapidvideocom.py index 1fc6ea1c..68dfc4f0 100644 --- a/lib/urlresolver/plugins/rapidvideocom.py +++ b/lib/urlresolver/plugins/rapidvideocom.py @@ -57,10 +57,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'https://www.rapidvideo.com/embed/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py index c129fc81..c178e642 100644 --- a/lib/urlresolver/plugins/rutube.py +++ b/lib/urlresolver/plugins/rutube.py @@ -62,13 +62,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://rutube.ru/play/embed/%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/shared2me.py b/lib/urlresolver/plugins/shared2me.py index 13afe779..52de9000 100644 --- a/lib/urlresolver/plugins/shared2me.py +++ b/lib/urlresolver/plugins/shared2me.py @@ -40,10 +40,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://shared2.me/frame/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/sharedsx.py b/lib/urlresolver/plugins/sharedsx.py index ac9dec13..0f9904ad 100644 --- a/lib/urlresolver/plugins/sharedsx.py +++ b/lib/urlresolver/plugins/sharedsx.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://shared.sx/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/sharerepo.py b/lib/urlresolver/plugins/sharerepo.py index 1117249a..0f00f24c 100644 --- a/lib/urlresolver/plugins/sharerepo.py +++ b/lib/urlresolver/plugins/sharerepo.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://sharerepo.com/f/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/sharesix.py b/lib/urlresolver/plugins/sharesix.py index 4a78d507..9b914128 100644 --- a/lib/urlresolver/plugins/sharesix.py +++ b/lib/urlresolver/plugins/sharesix.py @@ -52,10 +52,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://sharesix.com/f/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/speedplay.py b/lib/urlresolver/plugins/speedplay.py index 9a99e785..f958d9b4 100644 --- a/lib/urlresolver/plugins/speedplay.py +++ b/lib/urlresolver/plugins/speedplay.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/%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 diff --git a/lib/urlresolver/plugins/speedvideo.py b/lib/urlresolver/plugins/speedvideo.py index 1dd37c07..58bb69d5 100644 --- a/lib/urlresolver/plugins/speedvideo.py +++ b/lib/urlresolver/plugins/speedvideo.py @@ -46,10 +46,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://speedvideo.net/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/stagevu.py b/lib/urlresolver/plugins/stagevu.py index 20ce59bb..630a368f 100644 --- a/lib/urlresolver/plugins/stagevu.py +++ b/lib/urlresolver/plugins/stagevu.py @@ -40,10 +40,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.stagevu.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 diff --git a/lib/urlresolver/plugins/streamcloud.py b/lib/urlresolver/plugins/streamcloud.py index dadc7f01..8ece9ce4 100644 --- a/lib/urlresolver/plugins/streamcloud.py +++ b/lib/urlresolver/plugins/streamcloud.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://streamcloud.eu/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/streaminto.py b/lib/urlresolver/plugins/streaminto.py index bf78df3c..eb2a40af 100644 --- a/lib/urlresolver/plugins/streaminto.py +++ b/lib/urlresolver/plugins/streaminto.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://streamin.to/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/teramixer.py b/lib/urlresolver/plugins/teramixer.py index 700f5af5..3fe16c6d 100644 --- a/lib/urlresolver/plugins/teramixer.py +++ b/lib/urlresolver/plugins/teramixer.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.teramixer.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 diff --git a/lib/urlresolver/plugins/thevideo.py b/lib/urlresolver/plugins/thevideo.py index e2ca8813..6e83f530 100644 --- a/lib/urlresolver/plugins/thevideo.py +++ b/lib/urlresolver/plugins/thevideo.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/thevideos.py b/lib/urlresolver/plugins/thevideos.py index 4e67b7bb..15080c9e 100644 --- a/lib/urlresolver/plugins/thevideos.py +++ b/lib/urlresolver/plugins/thevideos.py @@ -47,13 +47,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://thevideos.tv/embed-%s.html' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/trollvid.py b/lib/urlresolver/plugins/trollvid.py index 43ea5354..f3b45bdd 100644 --- a/lib/urlresolver/plugins/trollvid.py +++ b/lib/urlresolver/plugins/trollvid.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://trollvid.net/embed/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/tunepk.py b/lib/urlresolver/plugins/tunepk.py index d672b069..3231bfbb 100644 --- a/lib/urlresolver/plugins/tunepk.py +++ b/lib/urlresolver/plugins/tunepk.py @@ -63,13 +63,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://embed.tune.pk/play/%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/tusfiles.py b/lib/urlresolver/plugins/tusfiles.py index 280073bd..59ce1268 100644 --- a/lib/urlresolver/plugins/tusfiles.py +++ b/lib/urlresolver/plugins/tusfiles.py @@ -46,10 +46,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/twitch.py b/lib/urlresolver/plugins/twitch.py index 677ea9fd..ae00b46b 100644 --- a/lib/urlresolver/plugins/twitch.py +++ b/lib/urlresolver/plugins/twitch.py @@ -44,13 +44,6 @@ def get_media_url(self, host, media_id): 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, re.I) - if r: - return r.groups() - else: - return False - @classmethod def _is_enabled(cls): if not common.has_addon('plugin.video.twitch'): diff --git a/lib/urlresolver/plugins/up2stream.py b/lib/urlresolver/plugins/up2stream.py index 6d957acc..61f971bb 100644 --- a/lib/urlresolver/plugins/up2stream.py +++ b/lib/urlresolver/plugins/up2stream.py @@ -68,10 +68,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://up2stream.com/view.php?ref=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/uploadaf.py b/lib/urlresolver/plugins/uploadaf.py index 58402825..9cb39ec8 100644 --- a/lib/urlresolver/plugins/uploadaf.py +++ b/lib/urlresolver/plugins/uploadaf.py @@ -52,10 +52,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://upload.af/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/uploadc.py b/lib/urlresolver/plugins/uploadc.py index d84961e1..ff6f4f99 100644 --- a/lib/urlresolver/plugins/uploadc.py +++ b/lib/urlresolver/plugins/uploadc.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://uploadc.com/embed-%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/uploadx.py b/lib/urlresolver/plugins/uploadx.py index 3dca57e9..8b96aef3 100644 --- a/lib/urlresolver/plugins/uploadx.py +++ b/lib/urlresolver/plugins/uploadx.py @@ -61,10 +61,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://uploadx.org/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/uptobox.py b/lib/urlresolver/plugins/uptobox.py index 118099a6..97787c30 100644 --- a/lib/urlresolver/plugins/uptobox.py +++ b/lib/urlresolver/plugins/uptobox.py @@ -99,10 +99,3 @@ def get_url(self, host, 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 diff --git a/lib/urlresolver/plugins/userscloud.py b/lib/urlresolver/plugins/userscloud.py index 87474697..b74ee6ab 100644 --- a/lib/urlresolver/plugins/userscloud.py +++ b/lib/urlresolver/plugins/userscloud.py @@ -52,10 +52,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/usersfiles.py b/lib/urlresolver/plugins/usersfiles.py index a822f714..229b4120 100644 --- a/lib/urlresolver/plugins/usersfiles.py +++ b/lib/urlresolver/plugins/usersfiles.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/veeHD.py b/lib/urlresolver/plugins/veeHD.py index 9bfb4cab..f1c2def3 100644 --- a/lib/urlresolver/plugins/veeHD.py +++ b/lib/urlresolver/plugins/veeHD.py @@ -67,13 +67,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://veehd.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 - # SiteAuth methods def login(self): loginurl = 'http://veehd.com/login' diff --git a/lib/urlresolver/plugins/veoh.py b/lib/urlresolver/plugins/veoh.py index 32fed189..6636fe3b 100644 --- a/lib/urlresolver/plugins/veoh.py +++ b/lib/urlresolver/plugins/veoh.py @@ -46,10 +46,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://veoh.com/watch/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidag.py b/lib/urlresolver/plugins/vidag.py index 9bcd7f36..8f8c8adf 100644 --- a/lib/urlresolver/plugins/vidag.py +++ b/lib/urlresolver/plugins/vidag.py @@ -46,10 +46,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vid.ag/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidbull.py b/lib/urlresolver/plugins/vidbull.py index 809e0fc6..584cc4fc 100644 --- a/lib/urlresolver/plugins/vidbull.py +++ b/lib/urlresolver/plugins/vidbull.py @@ -43,10 +43,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.vidbull.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 diff --git a/lib/urlresolver/plugins/vidcrazynet.py b/lib/urlresolver/plugins/vidcrazynet.py index 1977b244..842d52d7 100644 --- a/lib/urlresolver/plugins/vidcrazynet.py +++ b/lib/urlresolver/plugins/vidcrazynet.py @@ -41,10 +41,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vidcrazy.net/embed.php?file=%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videobee.py b/lib/urlresolver/plugins/videobee.py index d9eb480f..44d22506 100644 --- a/lib/urlresolver/plugins/videobee.py +++ b/lib/urlresolver/plugins/videobee.py @@ -40,10 +40,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://thevideobee.to/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videoboxer.py b/lib/urlresolver/plugins/videoboxer.py index e138e4f7..466cf973 100644 --- a/lib/urlresolver/plugins/videoboxer.py +++ b/lib/urlresolver/plugins/videoboxer.py @@ -57,10 +57,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/videohut.py b/lib/urlresolver/plugins/videohut.py index 0ba2d34a..b6162501 100644 --- a/lib/urlresolver/plugins/videohut.py +++ b/lib/urlresolver/plugins/videohut.py @@ -57,10 +57,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.videohut.to/embed.php?id=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videomega.py b/lib/urlresolver/plugins/videomega.py index a2098c3e..124919a6 100644 --- a/lib/urlresolver/plugins/videomega.py +++ b/lib/urlresolver/plugins/videomega.py @@ -62,10 +62,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://videomega.tv/cdn.php?ref=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videoraj.py b/lib/urlresolver/plugins/videoraj.py index dc83ff34..d53c102d 100644 --- a/lib/urlresolver/plugins/videoraj.py +++ b/lib/urlresolver/plugins/videoraj.py @@ -56,10 +56,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.videoraj.to/embed.php?id=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videorev.py b/lib/urlresolver/plugins/videorev.py index 3fc31d1f..7081d7e1 100644 --- a/lib/urlresolver/plugins/videorev.py +++ b/lib/urlresolver/plugins/videorev.py @@ -65,13 +65,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/%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 - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/videosky.py b/lib/urlresolver/plugins/videosky.py index 362af0f0..45a9c6f8 100644 --- a/lib/urlresolver/plugins/videosky.py +++ b/lib/urlresolver/plugins/videosky.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.videosky.to/embed.php?id=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videott.py b/lib/urlresolver/plugins/videott.py index c4321b85..c90fe291 100644 --- a/lib/urlresolver/plugins/videott.py +++ b/lib/urlresolver/plugins/videott.py @@ -70,13 +70,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.video.tt/watch_video.php?v=%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/videoweed.py b/lib/urlresolver/plugins/videoweed.py index b831ae71..095b88d0 100644 --- a/lib/urlresolver/plugins/videoweed.py +++ b/lib/urlresolver/plugins/videoweed.py @@ -55,10 +55,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.bitvid.sx/embed/?v=%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videowood.py b/lib/urlresolver/plugins/videowood.py index d7e3aaab..1cb5c1b7 100644 --- a/lib/urlresolver/plugins/videowood.py +++ b/lib/urlresolver/plugins/videowood.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://videowood.tv/embed/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/videozoo.py b/lib/urlresolver/plugins/videozoo.py index bff013c3..d30f0b79 100644 --- a/lib/urlresolver/plugins/videozoo.py +++ b/lib/urlresolver/plugins/videozoo.py @@ -37,11 +37,6 @@ 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 get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = { diff --git a/lib/urlresolver/plugins/vidgg.py b/lib/urlresolver/plugins/vidgg.py index f78a4baa..6c6bf828 100644 --- a/lib/urlresolver/plugins/vidgg.py +++ b/lib/urlresolver/plugins/vidgg.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.vidgg.to/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 diff --git a/lib/urlresolver/plugins/vidio.py b/lib/urlresolver/plugins/vidio.py index 65fd9d4f..edee49fb 100644 --- a/lib/urlresolver/plugins/vidio.py +++ b/lib/urlresolver/plugins/vidio.py @@ -44,10 +44,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vidio.sx/%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidme.py b/lib/urlresolver/plugins/vidme.py index ef7896af..ce925e28 100644 --- a/lib/urlresolver/plugins/vidme.py +++ b/lib/urlresolver/plugins/vidme.py @@ -40,10 +40,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vid.me/e/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidspot.py b/lib/urlresolver/plugins/vidspot.py index 624a1c2f..1d75f459 100644 --- a/lib/urlresolver/plugins/vidspot.py +++ b/lib/urlresolver/plugins/vidspot.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vidspot.net/embed-%s.html' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidto.py b/lib/urlresolver/plugins/vidto.py index 0679668d..5e2621be 100644 --- a/lib/urlresolver/plugins/vidto.py +++ b/lib/urlresolver/plugins/vidto.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vidto.me/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index 8dc3c90c..d10ae6cf 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://beta.vidup.me/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index 0567efb5..01091a55 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -39,10 +39,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/embed.php?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 diff --git a/lib/urlresolver/plugins/vidzi.py b/lib/urlresolver/plugins/vidzi.py index d0e7ad8f..ef847018 100644 --- a/lib/urlresolver/plugins/vidzi.py +++ b/lib/urlresolver/plugins/vidzi.py @@ -51,10 +51,3 @@ def get_media_url(self, host, media_id): 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 diff --git a/lib/urlresolver/plugins/vimeo.py b/lib/urlresolver/plugins/vimeo.py index b8cd35a0..f745bddd 100644 --- a/lib/urlresolver/plugins/vimeo.py +++ b/lib/urlresolver/plugins/vimeo.py @@ -60,13 +60,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'https://player.vimeo.com/video/%s/config' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/vivosx.py b/lib/urlresolver/plugins/vivosx.py index a1621525..e04c6f44 100644 --- a/lib/urlresolver/plugins/vivosx.py +++ b/lib/urlresolver/plugins/vivosx.py @@ -52,10 +52,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vivo.sx/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vk.py b/lib/urlresolver/plugins/vk.py index 545e5b26..2d83d7f1 100644 --- a/lib/urlresolver/plugins/vk.py +++ b/lib/urlresolver/plugins/vk.py @@ -83,13 +83,6 @@ def __get_hash(self, oid, video_id): def get_url(self, host, media_id): return 'http://vk.com/video_ext.php?%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/vkpass.py b/lib/urlresolver/plugins/vkpass.py index cf125ed4..a0a59f5b 100644 --- a/lib/urlresolver/plugins/vkpass.py +++ b/lib/urlresolver/plugins/vkpass.py @@ -98,13 +98,6 @@ def __getFlashVids(self, vBlocks, data): def get_url(self, host, media_id): return 'http://vkpass.com/token/%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/vodlocker.py b/lib/urlresolver/plugins/vodlocker.py index a6af3ae6..274f54fd 100644 --- a/lib/urlresolver/plugins/vodlocker.py +++ b/lib/urlresolver/plugins/vodlocker.py @@ -43,10 +43,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vodlocker.com/embed-%s-640x400.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vshare.py b/lib/urlresolver/plugins/vshare.py index e5493d0a..863bf428 100644 --- a/lib/urlresolver/plugins/vshare.py +++ b/lib/urlresolver/plugins/vshare.py @@ -42,10 +42,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vshare.io/v/%s/width-620/height-280/' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/vshareeu.py b/lib/urlresolver/plugins/vshareeu.py index 16cc31cd..65a71a10 100644 --- a/lib/urlresolver/plugins/vshareeu.py +++ b/lib/urlresolver/plugins/vshareeu.py @@ -53,10 +53,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://vshare.eu/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/watchers.py b/lib/urlresolver/plugins/watchers.py index 2a399f50..e2b3f0c2 100644 --- a/lib/urlresolver/plugins/watchers.py +++ b/lib/urlresolver/plugins/watchers.py @@ -48,11 +48,3 @@ def get_media_url(self, host, media_id): 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 - diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index 7b4104f3..41e2d7b8 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -54,10 +54,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/%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 diff --git a/lib/urlresolver/plugins/weshare.py b/lib/urlresolver/plugins/weshare.py index cd9832ec..d2fedffa 100644 --- a/lib/urlresolver/plugins/weshare.py +++ b/lib/urlresolver/plugins/weshare.py @@ -47,10 +47,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'https://weshare.me/services/mediaplayer/site/_embed.max.php?u=%s' % (media_id) - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/xvidstage.py b/lib/urlresolver/plugins/xvidstage.py index 93650dfd..4632f9f0 100644 --- a/lib/urlresolver/plugins/xvidstage.py +++ b/lib/urlresolver/plugins/xvidstage.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.xvidstage.com/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/yourupload.py b/lib/urlresolver/plugins/yourupload.py index b7ad0c02..aea40062 100644 --- a/lib/urlresolver/plugins/yourupload.py +++ b/lib/urlresolver/plugins/yourupload.py @@ -50,10 +50,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.yourupload.com/embed/%s' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/youtube.py b/lib/urlresolver/plugins/youtube.py index bf59c09f..7c922f35 100644 --- a/lib/urlresolver/plugins/youtube.py +++ b/lib/urlresolver/plugins/youtube.py @@ -15,8 +15,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ - -import re from urlresolver.resolver import UrlResolver, ResolverError class YoutubeResolver(UrlResolver): @@ -31,13 +29,6 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://youtube.com/watch?v=%s' % media_id - def get_host_and_id(self, url): - r = re.search(self.pattern, url, re.I) - if r: - return r.groups() - else: - return False - @classmethod def get_settings_xml(cls): xml = super(cls, cls).get_settings_xml() diff --git a/lib/urlresolver/plugins/youwatch.py b/lib/urlresolver/plugins/youwatch.py index 37ca6995..7fef0f76 100644 --- a/lib/urlresolver/plugins/youwatch.py +++ b/lib/urlresolver/plugins/youwatch.py @@ -62,10 +62,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://youwatch.org/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/zettahost.py b/lib/urlresolver/plugins/zettahost.py index 0e08a1da..92d39cfb 100644 --- a/lib/urlresolver/plugins/zettahost.py +++ b/lib/urlresolver/plugins/zettahost.py @@ -49,10 +49,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://zettahost.tv/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False diff --git a/lib/urlresolver/plugins/zstream.py b/lib/urlresolver/plugins/zstream.py index 06dc6ab9..fccf5bd3 100644 --- a/lib/urlresolver/plugins/zstream.py +++ b/lib/urlresolver/plugins/zstream.py @@ -44,10 +44,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://zstream.to/embed-%s.html' % media_id - - def get_host_and_id(self, url): - r = re.search(self.pattern, url) - if r: - return r.groups() - else: - return False From 53621716294466ccb125ca7544b5a85840f95e27 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 30 Jun 2016 18:34:53 -0400 Subject: [PATCH 1031/1360] force domain lower to avoid mixed case domain issues --- lib/urlresolver/__init__.py | 5 ++++- lib/urlresolver/hmf.py | 2 +- lib/urlresolver/resolver.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/urlresolver/__init__.py b/lib/urlresolver/__init__.py index 0deeaf72..87fde4fe 100644 --- a/lib/urlresolver/__init__.py +++ b/lib/urlresolver/__init__.py @@ -62,6 +62,9 @@ def load_external_plugins(): def relevant_resolvers(domain=None, include_universal=None, include_external=False, include_disabled=False, order_matters=False): if include_external: load_external_plugins() + + if isinstance(domain, basestring): + domain = domain.lower() if include_universal is None: include_universal = common.get_setting('allow_universal') == "true" @@ -71,7 +74,7 @@ def relevant_resolvers(domain=None, include_universal=None, include_external=Fal for resolver in classes: if include_disabled or resolver._is_enabled(): if include_universal or not resolver.isUniversal(): - if domain is None or (any(domain in res_domain for res_domain in resolver.domains) or '*' in resolver.domains): + if domain is None or (any(domain in res_domain.lower() for res_domain in resolver.domains) or '*' in resolver.domains): relevant.append(resolver) if order_matters: diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 2b03b9ff..4dbc6e17 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -111,10 +111,10 @@ def __get_resolvers(self, include_disabled, include_universal): return resolvers def __top_domain(self, url): - regex = "(\w{2,}\.\w{2,3}\.\w{2}|\w{2,}\.\w{2,3})$" elements = urlparse.urlparse(url) domain = elements.netloc or elements.path domain = domain.split('@')[-1].split(':')[0] + regex = "(\w{2,}\.\w{2,3}\.\w{2}|\w{2,}\.\w{2,3})$" res = re.search(regex, domain) if res: return res.group(1) diff --git a/lib/urlresolver/resolver.py b/lib/urlresolver/resolver.py index 11604187..3b77d62c 100644 --- a/lib/urlresolver/resolver.py +++ b/lib/urlresolver/resolver.py @@ -82,7 +82,7 @@ def get_host_and_id(self, url): host (str): the host the link is on media_id (str): the media_id the can be returned by get_host_and_id ''' - r = re.search(self.pattern, url) + r = re.search(self.pattern, url, re.I) if r: return r.groups() else: From ff329b8179e0b0a4d46dba98076309725e4b689a Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 30 Jun 2016 18:39:50 -0400 Subject: [PATCH 1032/1360] force domain to be lower --- lib/urlresolver/hmf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/hmf.py b/lib/urlresolver/hmf.py index 4dbc6e17..44dcb075 100644 --- a/lib/urlresolver/hmf.py +++ b/lib/urlresolver/hmf.py @@ -117,7 +117,8 @@ def __top_domain(self, url): regex = "(\w{2,}\.\w{2,3}\.\w{2}|\w{2,}\.\w{2,3})$" res = re.search(regex, domain) if res: - return res.group(1) + domain = res.group(1) + domain = domain.lower() return domain def get_url(self): From be4246888b37c3506cd6e03455c32a6802ce048b Mon Sep 17 00:00:00 2001 From: Lynx187 Date: Sat, 2 Jul 2016 16:14:34 +0200 Subject: [PATCH 1033/1360] fix vivo if web_url is not a https url then post url is not the same as web_url, took care of this case --- lib/urlresolver/plugins/vivosx.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/vivosx.py b/lib/urlresolver/plugins/vivosx.py index e04c6f44..7a717760 100644 --- a/lib/urlresolver/plugins/vivosx.py +++ b/lib/urlresolver/plugins/vivosx.py @@ -33,11 +33,13 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) # get landing page - html = self.net.http_GET(web_url, headers={'Referer': web_url}).content + resp = self.net.http_GET(web_url, headers={'Referer': web_url}) + html = resp.content + post_url = resp.get_url() # read POST variables into data data = helpers.get_hidden(html) - html = self.net.http_POST(web_url, data, headers=({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'})).content + html = self.net.http_POST(post_url, data, headers=({'Referer': web_url})).content # search for content tag r = re.search(r'class="stream-content" data-url', html) From ade7ef6b298923fc22ea40d8610694f6e050bc84 Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Wed, 20 Jul 2016 18:11:03 +1200 Subject: [PATCH 1034/1360] Watchvideo fix Additional domains added to resolver --- lib/urlresolver/plugins/watchvideo.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index 41e2d7b8..b79375dd 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -23,7 +23,9 @@ class WatchVideoResolver(UrlResolver): name = "watchvideo" - domains = ["watchvideo.us", "watchvideo2.us", "watchvideo4.us", "watchvideo7.us"] + domains = ["watchvideo.us", "watchvideo2.us", "watchvideo3.us", + "watchvideo4.us", "watchvideo5.us", "watchvideo6.us", + "watchvideo7.us", "watchvideo8.us", "watchvideo9.us"] pattern = '(?://|\.)(watchvideo[0-9]?\.us)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): @@ -54,3 +56,10 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/%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 From bdbb3d79c7cf11ec4f2415ec847919d23361ff4b Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Wed, 20 Jul 2016 18:30:05 +1200 Subject: [PATCH 1035/1360] Watchvideo fix Additional domains. Remove get_host_and_id as per advice --- lib/urlresolver/plugins/watchvideo.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index b79375dd..b131b947 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -56,10 +56,3 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/%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 From daf4496ed600f797cd7dffbdfd90af0843077d5f Mon Sep 17 00:00:00 2001 From: tknorris Date: Sun, 24 Jul 2016 15:44:51 -0400 Subject: [PATCH 1036/1360] Bump to 3.0.15 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index d839fc13..0fc32380 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From 23e2497c2c38b95a78e8e1f1a0cfa1e78de492fb Mon Sep 17 00:00:00 2001 From: tknorris Date: Mon, 25 Jul 2016 23:54:32 -0400 Subject: [PATCH 1037/1360] add briskfile resolver --- lib/urlresolver/plugins/briskfile.py | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lib/urlresolver/plugins/briskfile.py diff --git a/lib/urlresolver/plugins/briskfile.py b/lib/urlresolver/plugins/briskfile.py new file mode 100644 index 00000000..79e7dea7 --- /dev/null +++ b/lib/urlresolver/plugins/briskfile.py @@ -0,0 +1,57 @@ +''' +urlresolver XBMC Addon +Copyright (C) 2013 Bstrdsmkr + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +''' +import re +import urllib2 +from lib import helpers +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class BriskfileResolver(UrlResolver): + name = "briskfile" + domains = ["briskfile.com"] + pattern = '(?://|\.)(briskfile\.com)/(?:l|e)/([0-9A-Za-z\-]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content + match = re.search('''val\(\)\s*\+\s*['"]([^"']+)''', html) + suffix = match.group(1) if match else '' + common.log_utils.log(html) + data = helpers.get_hidden(html) + for name in data: + data[name] = data[name] + suffix + + common.log_utils.log(data) + headers['Referer'] = web_url + html = self.net.http_POST(web_url, form_data=data, headers=headers).content + html = re.compile(r'clip\s*:\s*\{.*?(?:url|src)\s*:\s*[\"\'](.+?)[\"\']', re.DOTALL).search(html) + if not html: + raise ResolverError('File Not Found or removed') + stream_url = html.group(1) + req = urllib2.Request(stream_url) + for key in headers: + req.add_header(key, headers[key]) + stream_url = urllib2.urlopen(req).geturl() + return stream_url + '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) + + def get_url(self, host, media_id): + return 'http://www.briskfile.com/l/%s' % (media_id) From 8ea0ee6fe4d7f68a9559d653ab07ebfbc5c621f8 Mon Sep 17 00:00:00 2001 From: tknorris Date: Tue, 26 Jul 2016 01:18:13 -0400 Subject: [PATCH 1038/1360] fix openload --- lib/urlresolver/plugins/ol_gmu.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index df309227..ed30491a 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -63,7 +63,9 @@ def conv(s): def get_media_url(url): try: headers = {'User-Agent': common.FF_USER_AGENT} - html = net.http_GET(url, headers=headers).content.encode('utf-8') + html = net.http_GET(url, headers=headers).content + if isinstance(html, unicode): + html = html.encode('utf-8') decodes = [AADecoder(match.group(1)).decode() for match in re.finditer(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL)] if not decodes: raise ResolverError('No Encoded Section Found. Deleted?') @@ -85,6 +87,8 @@ def get_media_url(url): if match: common.log_utils.log('to conv: %s' % (match.group(1))) dtext = conv(match.group(1)) + if dtext.lower().startswith('//'): + dtext = 'http:' + dtext dtext = dtext.replace('https', 'http') request = urllib2.Request(dtext, None, headers) response = urllib2.urlopen(request) From 535a7df0b8917a7f290ce9339d6bae1f478afe0b Mon Sep 17 00:00:00 2001 From: tknorris Date: Sun, 31 Jul 2016 14:32:13 -0400 Subject: [PATCH 1039/1360] add openload resolver from iptvplayer --- lib/urlresolver/plugins/lib/png.py | 3175 ++++++++++++++++++++++++++++ lib/urlresolver/plugins/ol_gmu.py | 161 +- 2 files changed, 3269 insertions(+), 67 deletions(-) create mode 100644 lib/urlresolver/plugins/lib/png.py diff --git a/lib/urlresolver/plugins/lib/png.py b/lib/urlresolver/plugins/lib/png.py new file mode 100644 index 00000000..5845890c --- /dev/null +++ b/lib/urlresolver/plugins/lib/png.py @@ -0,0 +1,3175 @@ +#!/usr/bin/env python +# encoding=utf-8 +# +# png.py - PNG encoder/decoder in pure Python +# +# Copyright (C) 2015 Pavel Zlatovratskii +# Copyright (C) 2006 Johann C. Rocholl +# Portions Copyright (C) 2009 David Jones +# And probably portions Copyright (C) 2006 Nicko van Someren +# +# Original concept by Johann C. Rocholl. +# +# LICENCE (MIT) +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""" +Pure Python PNG Reader/Writer + +This Python module implements support for PNG images (see PNG +specification at http://www.w3.org/TR/2003/REC-PNG-20031110/ ). It reads +and writes PNG files with all allowable bit depths +(1/2/4/8/16/24/32/48/64 bits per pixel) and colour combinations: +greyscale (1/2/4/8/16 bit); RGB, RGBA, LA (greyscale with alpha) with +8/16 bits per channel; colour mapped images (1/2/4/8 bit). +Adam7 interlacing is supported for reading and +writing. A number of optional chunks can be specified (when writing) +and understood (when reading): ``tRNS``, ``bKGD``, ``gAMA``. + +For help, type ``import png; help(png)`` in your python interpreter. + +A good place to start is the :class:`Reader` and :class:`Writer` +classes. + +Requires Python 2.3. Best with Python 2.6 and higher. Installation is +trivial, but see the ``README.txt`` file (with the source distribution) +for details. + +This file can also be used as a command-line utility to convert +`Netpbm `_ PNM files to PNG, and the +reverse conversion from PNG to PNM. The interface is similar to that +of the ``pnmtopng`` program from Netpbm. Type ``python png.py --help`` +at the shell prompt for usage and a list of options. + +A note on spelling and terminology +---------------------------------- + +Generally British English spelling is used in the documentation. So +that's "greyscale" and "colour". This not only matches the author's +native language, it's also used by the PNG specification. + +The major colour models supported by PNG (and hence by this module) are: +greyscale, RGB, greyscale--alpha, RGB--alpha. These are sometimes +referred to using the abbreviations: L, RGB, LA, RGBA. In this case +each letter abbreviates a single channel: *L* is for Luminance or Luma +or Lightness which is the channel used in greyscale images; *R*, *G*, +*B* stand for Red, Green, Blue, the components of a colour image; *A* +stands for Alpha, the opacity channel (used for transparency effects, +but higher values are more opaque, so it makes sense to call it +opacity). + +A note on formats +----------------- + +When getting pixel data out of this module (reading) and presenting +data to this module (writing) there are a number of ways the data could +be represented as a Python value. Generally this module uses one of +three formats called "flat row flat pixel", "boxed row flat pixel", and +"boxed row boxed pixel". Basically the concern is whether each pixel +and each row comes in its own little tuple (box), or not. + +Consider an image that is 3 pixels wide by 2 pixels high, and each pixel +has RGB components: + +Boxed row flat pixel:: + + iter([R,G,B, R,G,B, R,G,B], + [R,G,B, R,G,B, R,G,B]) + +Each row appears as its own sequence, but the pixels are flattened so +that three values for one pixel simply follow the three values for +the previous pixel. This is the most common format used, because it +provides a good compromise between space and convenience. +Row sequence supposed to be compatible with 'buffer' protocol in +addition to standard sequence methods so 'buffer()' can be used to +get fast per-byte access. +All rows are contained in iterable or iterable-compatible container. +(use 'iter()' to ensure) + +Flat row flat pixel:: + + [R,G,B, R,G,B, R,G,B, + R,G,B, R,G,B, R,G,B] + +The entire image is one single giant sequence of colour values. +Generally an array will be used (to save space), not a list. + +Boxed row boxed pixel:: + + list([ (R,G,B), (R,G,B), (R,G,B) ], + [ (R,G,B), (R,G,B), (R,G,B) ]) + +Each row appears in its own list, but each pixel also appears in its own +tuple. A serious memory burn in Python. + +In all cases the top row comes first, and for each row the pixels are +ordered from left-to-right. Within a pixel the values appear in the +order, R-G-B-A (or L-A for greyscale--alpha). + +There is a fourth format, mentioned because it is used internally, +is close to what lies inside a PNG file itself, and has some support +from the public API. This format is called packed. When packed, +each row is a sequence of bytes (integers from 0 to 255), just as +it is before PNG scanline filtering is applied. When the bit depth +is 8 this is essentially the same as boxed row flat pixel; when the +bit depth is less than 8, several pixels are packed into each byte; +when the bit depth is 16 (the only value more than 8 that is supported +by the PNG image format) each pixel value is decomposed into 2 bytes +(and `packed` is a misnomer). This format is used by the +:meth:`Writer.write_packed` method. It isn't usually a convenient +format, but may be just right if the source data for the PNG image +comes from something that uses a similar format (for example, 1-bit +BMPs, or another PNG file). + +And now, my famous members +-------------------------- +""" + +from array import array +import itertools +import logging +import math +# http://www.python.org/doc/2.4.4/lib/module-operator.html +import operator +import datetime +import time +import struct +import sys +import zlib +# http://www.python.org/doc/2.4.4/lib/module-warnings.html +import warnings + +try: + from functools import reduce +except ImportError: + # suppose to get there on python<2.7 where reduce is only built-in function + pass + +try: + from itertools import imap as map +except ImportError: + # On Python 3 there is no imap, but map works like imap instead + pass + +__version__ = "0.1.3" +__all__ = ['png_signature', 'Image', 'Reader', 'Writer', + 'Error', 'FormatError', 'ChunkError', + 'Filter', 'register_extra_filter', + 'write_chunks', 'from_array', 'parse_mode', + 'read_pam_header', 'read_pnm_header', 'write_pnm', + 'PERCEPTUAL', 'RELATIVE_COLORIMETRIC', 'SATURATION', + 'ABSOLUTE_COLORIMETRIC'] + + +# The PNG signature. +# http://www.w3.org/TR/PNG/#5PNG-file-signature +png_signature = struct.pack('8B', 137, 80, 78, 71, 13, 10, 26, 10) + +_adam7 = ((0, 0, 8, 8), + (4, 0, 8, 8), + (0, 4, 4, 8), + (2, 0, 4, 4), + (0, 2, 2, 4), + (1, 0, 2, 2), + (0, 1, 1, 2)) +# registered keywords +# http://www.w3.org/TR/2003/REC-PNG-20031110/#11keywords +_registered_kw = ('Title', 'Author', 'Description', 'Copyright', 'Software', + 'Disclaimer', 'Warning', 'Source', 'Comment', + 'Creation Time') + + +# rendering intent +PERCEPTUAL = 0 +RELATIVE_COLORIMETRIC = 1 +SATURATION = 2 +ABSOLUTE_COLORIMETRIC = 3 + + +def group(s, n): + """Repack iterator items into groups""" + # See http://www.python.org/doc/2.6/library/functions.html#zip + return list(zip(*[iter(s)] * n)) + + +def _rel_import(module, tgt): + """Using relative import in both Python 2 and Python 3""" + try: + exec("from ." + module + " import " + tgt, globals(), locals()) + except SyntaxError: + # On Python < 2.5 relative import cause syntax error + exec("from " + module + " import " + tgt, globals(), locals()) + except (ValueError, SystemError): + # relative import in non-package, try absolute + exec("from " + module + " import " + tgt, globals(), locals()) + return eval(tgt) + + +try: + next +except NameError: + def next(it): + """trivial `next` emulation""" + return it.next() +try: + bytes +except NameError: + bytes = str + + +# Define a bytearray_to_bytes() function. +# The definition of this function changes according to what +# version of Python we are on. +def bytearray_to_bytes(src): + """Default version""" + return bytes(src) + + +def newHarray(length=0): + """fast init by length""" + return array('H', [0]) * length + + +# bytearray is faster than array('B'), so we prefer to use it +# where available. +try: + # bytearray exists (>= Python 2.6). + newBarray = bytearray + copyBarray = bytearray +except NameError: + # bytearray does not exist. We're probably < Python 2.6 (the + # version in which bytearray appears). + def bytearray(src=tuple()): + """Bytearray-like array""" + return array('B', src) + + def newBarray(length=0): + """fast init by length""" + return array('B', [0]) * length + + if hasattr(array, '__copy__'): + # a bit faster if possible + copyBarray = array.__copy__ + else: + copyBarray = bytearray + + def bytearray_to_bytes(row): + """ + Convert bytearray to bytes. + + Recal that `row` will actually be an ``array``. + """ + return row.tostring() + + +# Python 3 workaround +try: + basestring +except NameError: + basestring = str + +# Conditionally convert to bytes. Works on Python 2 and Python 3. +try: + bytes('', 'ascii') + def strtobytes(x): return bytes(x, 'iso8859-1') + def bytestostr(x): return str(x, 'iso8859-1') +except (NameError, TypeError): + # We get NameError when bytes() does not exist (most Python + # 2.x versions), and TypeError when bytes() exists but is on + # Python 2.x (when it is an alias for str() and takes at most + # one argument). + strtobytes = str + bytestostr = str + +zerobyte = strtobytes(chr(0)) + +try: + set +except NameError: + from sets import Set as set + + +def interleave_planes(ipixels, apixels, ipsize, apsize): + """ + Interleave (colour) planes, e.g. RGB + A = RGBA. + + Return an array of pixels consisting of the `ipsize` elements of + data from each pixel in `ipixels` followed by the `apsize` elements + of data from each pixel in `apixels`. Conventionally `ipixels` + and `apixels` are byte arrays so the sizes are bytes, but it + actually works with any arrays of the same type. The returned + array is the same type as the input arrays which should be the + same type as each other. + """ + itotal = len(ipixels) + atotal = len(apixels) + newtotal = itotal + atotal + newpsize = ipsize + apsize + # Set up the output buffer + # See http://www.python.org/doc/2.4.4/lib/module-array.html#l2h-1356 + out = array(ipixels.typecode) + # It's annoying that there is no cheap way to set the array size :-( + out.extend(ipixels) + out.extend(apixels) + # Interleave in the pixel data + for i in range(ipsize): + out[i:newtotal:newpsize] = ipixels[i:itotal:ipsize] + for i in range(apsize): + out[i+ipsize:newtotal:newpsize] = apixels[i:atotal:apsize] + return out + + +def peekiter(iterable): + """Return first row and also iterable with same items as original""" + it = iter(iterable) + one = next(it) + + def gen(): + """Generator that returns first and proxy other items from source""" + yield one + while True: + yield next(it) + return (one, gen()) + + +def check_palette(palette): + """ + Check a palette argument (to the :class:`Writer` class) for validity. + + Returns the palette as a list if okay; raises an exception otherwise. + """ + # None is the default and is allowed. + if palette is None: + return None + + p = list(palette) + if not (0 < len(p) <= 256): + raise ValueError("a palette must have between 1 and 256 entries") + seen_triple = False + for i,t in enumerate(p): + if len(t) not in (3,4): + raise ValueError( + "palette entry %d: entries must be 3- or 4-tuples." % i) + if len(t) == 3: + seen_triple = True + if seen_triple and len(t) == 4: + raise ValueError( + "palette entry %d: all 4-tuples must precede all 3-tuples" % i) + for x in t: + if int(x) != x or not(0 <= x <= 255): + raise ValueError( + "palette entry %d: values must be integer: 0 <= x <= 255" % i) + return p + + +def check_sizes(size, width, height): + """ + Check that these arguments, in supplied, are consistent. + + Return a (width, height) pair. + """ + if not size: + return width, height + + if len(size) != 2: + raise ValueError( + "size argument should be a pair (width, height)") + if width is not None and width != size[0]: + raise ValueError( + "size[0] (%r) and width (%r) should match when both are used." + % (size[0], width)) + if height is not None and height != size[1]: + raise ValueError( + "size[1] (%r) and height (%r) should match when both are used." + % (size[1], height)) + return size + + +def check_color(c, greyscale, which): + """ + Checks that a colour argument is the right form. + + Returns the colour + (which, if it's a bar integer, is "corrected" to a 1-tuple). + For transparent or background options. + """ + if c is None: + return c + if greyscale: + try: + len(c) + except TypeError: + c = (c,) + if len(c) != 1: + raise ValueError("%s for greyscale must be 1-tuple" % + which) + if not isinteger(c[0]): + raise ValueError( + "%s colour for greyscale must be integer" % which) + else: + if not (len(c) == 3 and + isinteger(c[0]) and + isinteger(c[1]) and + isinteger(c[2])): + raise ValueError( + "%s colour must be a triple of integers" % which) + return c + + +def check_time(value): + """Convert time from most popular representations to datetime""" + if value is None: + return None + if isinstance(value, (time.struct_time, tuple)): + return value + if isinstance(value, datetime.datetime): + return value.timetuple() + if isinstance(value, datetime.date): + res = datetime.datetime.utcnow() + res.replace(year=value.year, month=value.month, day=value.day) + return res.timetuple() + if isinstance(value, datetime.time): + return datetime.datetime.combine(datetime.date.today(), + value).timetuple() + if isinteger(value): + # Handle integer as timestamp + return time.gmtime(value) + if isinstance(value, basestring): + if value.lower() == 'now': + return time.gmtime() + # TODO: parsinng some popular strings + raise ValueError("Unsupported time representation:" + repr(value)) + + +def popdict(src, keys): + """ + Extract all keys (with values) from `src` dictionary as new dictionary + + values are removed from source dictionary. + """ + new = {} + for key in keys: + if key in src: + new[key] = src.pop(key) + return new + + +class Error(Exception): + + """Generic PurePNG error""" + + def __str__(self): + return self.__class__.__name__ + ': ' + ' '.join(self.args) + + +class FormatError(Error): + + """ + Problem with input file format. + + In other words, PNG file does + not conform to the specification in some way and is invalid. + """ + + +class ChunkError(FormatError): + + """Error in chunk handling""" + + +class BaseFilter(object): + + """ + Basic methods of filtering and other byte manipulations + + This part can be compile with Cython (see README.cython) + Private methods are declared as 'cdef' (unavailable from python) + for this compilation, so don't just rename it. + """ + + def __init__(self, bitdepth=8): + if bitdepth > 8: + self.fu = bitdepth // 8 + else: + self.fu = 1 + + def __undo_filter_sub(self, scanline): + """Undo sub filter.""" + ai = 0 + # Loops starts at index fu. + for i in range(self.fu, len(scanline)): + x = scanline[i] + a = scanline[ai] # result + scanline[i] = (x + a) & 0xff # result + ai += 1 + + def __do_filter_sub(self, scanline, result): + """Sub filter.""" + ai = 0 + for i in range(self.fu, len(result)): + x = scanline[i] + a = scanline[ai] + result[i] = (x - a) & 0xff + ai += 1 + + def __undo_filter_up(self, scanline): + """Undo up filter.""" + previous = self.prev + for i in range(len(scanline)): + x = scanline[i] + b = previous[i] + scanline[i] = (x + b) & 0xff # result + + def __do_filter_up(self, scanline, result): + """Up filter.""" + previous = self.prev + for i in range(len(result)): + x = scanline[i] + b = previous[i] + result[i] = (x - b) & 0xff + + def __undo_filter_average(self, scanline): + """Undo average filter.""" + ai = -self.fu + previous = self.prev + for i in range(len(scanline)): + x = scanline[i] + if ai < 0: + a = 0 + else: + a = scanline[ai] # result + b = previous[i] + scanline[i] = (x + ((a + b) >> 1)) & 0xff # result + ai += 1 + + def __do_filter_average(self, scanline, result): + """Average filter.""" + ai = -self.fu + previous = self.prev + for i in range(len(result)): + x = scanline[i] + if ai < 0: + a = 0 + else: + a = scanline[ai] + b = previous[i] + result[i] = (x - ((a + b) >> 1)) & 0xff + ai += 1 + + def __undo_filter_paeth(self, scanline): + """Undo Paeth filter.""" + ai = -self.fu + previous = self.prev + for i in range(len(scanline)): + x = scanline[i] + if ai < 0: + pr = previous[i] # a = c = 0 + else: + a = scanline[ai] # result + c = previous[ai] + b = previous[i] + pa = abs(b - c) # b + pb = abs(a - c) # 0 + pc = abs(a + b - c - c) # b + if pa <= pb and pa <= pc: # False + pr = a + elif pb <= pc: # True + pr = b + else: + pr = c + scanline[i] = (x + pr) & 0xff # result + ai += 1 + + def __do_filter_paeth(self, scanline, result): + """Paeth filter.""" + # http://www.w3.org/TR/PNG/#9Filter-type-4-Paeth + ai = -self.fu + previous = self.prev + for i in range(len(result)): + x = scanline[i] + if ai < 0: + pr = previous[i] # a = c = 0 + else: + a = scanline[ai] + c = previous[ai] + b = previous[i] + pa = abs(b - c) + pb = abs(a - c) + pc = abs(a + b - c - c) + if pa <= pb and pa <= pc: + pr = a + elif pb <= pc: + pr = b + else: + pr = c + result[i] = (x - pr) & 0xff + ai += 1 + + def undo_filter(self, filter_type, line): + """ + Undo the filter for a scanline. + + `scanline` is a sequence of bytes that does not include + the initial filter type byte. + + The scanline will have the effects of filtering removed. + Scanline modified inplace and also returned as result. + """ + assert 0 <= filter_type <= 4 + # For the first line of a pass, synthesize a dummy previous line. + if self.prev is None: + self.prev = newBarray(len(line)) + # Also it's possible to switch some filters to easier + if filter_type == 2: # "up" + filter_type = 0 + elif filter_type == 4: # "paeth" + filter_type = 1 + + # Call appropriate filter algorithm. + # 0 - do nothing + if filter_type == 1: + self.__undo_filter_sub(line) + elif filter_type == 2: + self.__undo_filter_up(line) + elif filter_type == 3: + self.__undo_filter_average(line) + elif filter_type == 4: + self.__undo_filter_paeth(line) + + # This will not work writing cython attributes from python + # Only 'cython from cython' or 'python from python' + self.prev[:] = line[:] + return line + + def _filter_scanline(self, filter_type, line, result): + """ + Apply a scanline filter to a scanline. + + `filter_type` specifies the filter type (0 to 4) + 'line` specifies the current (unfiltered) scanline as a sequence + of bytes; + """ + assert 0 <= filter_type < 5 + if self.prev is None: + # We're on the first line. Some of the filters can be reduced + # to simpler cases which makes handling the line "off the top" + # of the image simpler. "up" becomes "none"; "paeth" becomes + # "left" (non-trivial, but true). "average" needs to be handled + # specially. + if filter_type == 2: # "up" + filter_type = 0 + elif filter_type == 3: + self.prev = newBarray(len(line)) + elif filter_type == 4: # "paeth" + filter_type = 1 + + if filter_type == 1: + self.__do_filter_sub(line, result) + elif filter_type == 2: + self.__do_filter_up(line, result) + elif filter_type == 3: + self.__do_filter_average(line, result) + elif filter_type == 4: + self.__do_filter_paeth(line, result) + + # Todo: color conversion functions should be moved + # to a separate part in future + def convert_la_to_rgba(self, row, result): + """Convert a grayscale image with alpha to RGBA.""" + for i in range(len(row) // 3): + for j in range(3): + result[(4 * i) + j] = row[2 * i] + result[(4 * i) + 3] = row[(2 * i) + 1] + + def convert_l_to_rgba(self, row, result): + """ + Convert a grayscale image to RGBA. + + This method assumes the alpha channel in result is already + correctly initialized. + """ + for i in range(len(row) // 3): + for j in range(3): + result[(4 * i) + j] = row[i] + + def convert_rgb_to_rgba(self, row, result): + """ + Convert an RGB image to RGBA. + + This method assumes the alpha channel in result is already + correctly initialized. + """ + for i in range(len(row) // 3): + for j in range(3): + result[(4 * i) + j] = row[(3 * i) + j] + + +iBaseFilter = BaseFilter # 'i' means 'internal' +try: + BaseFilter = _rel_import('pngfilters', 'BaseFilter') +except: + # Whatever happens we could use internal part + if not(sys.exc_info()[0] is ImportError): + logging.error("Error during import of compiled filters!") + logging.error(sys.exc_info()[1]) + logging.error("Fallback to pure python mode!") + BaseFilter = iBaseFilter + + +class Writer(object): + + """PNG encoder in pure Python.""" + + def __init__(self, width=None, height=None, + greyscale=False, + alpha=False, + bitdepth=8, + palette=None, + transparent=None, + background=None, + gamma=None, + compression=None, + interlace=False, + chunk_limit=2 ** 20, + filter_type=None, + icc_profile=None, + icc_profile_name="ICC Profile", + **kwargs + ): + """ + Create a PNG encoder object. + + Arguments: + + width, height + Image size in pixels, as two separate arguments. + greyscale + Input data is greyscale, not RGB. + alpha + Input data has alpha channel (RGBA or LA). + bitdepth + Bit depth: from 1 to 16. + palette + Create a palette for a colour mapped image (colour type 3). + transparent + Specify a transparent colour (create a ``tRNS`` chunk). + background + Specify a default background colour (create a ``bKGD`` chunk). + gamma + Specify a gamma value (create a ``gAMA`` chunk). + compression + zlib compression level: 0 (none) to 9 (more compressed); + default: -1 or None. + interlace + Create an interlaced image. + chunk_limit + Write multiple ``IDAT`` chunks to save memory. + filter_type + Enable and specify PNG filter + icc_profile + Write ICC Profile + icc_profile_name + Name for ICC Profile + + Extra keywords: + text + see :meth:`set_text` + modification_time + see :meth:`set_modification_time` + resolution + see :meth:`set_resolution` + + The image size (in pixels) can be specified either by using the + `width` and `height` arguments, or with the single `size` + argument. If `size` is used it should be a pair (*width*, + *height*). + + `greyscale` and `alpha` are booleans that specify whether + an image is greyscale (or colour), and whether it has an + alpha channel (or not). + + `bitdepth` specifies the bit depth of the source pixel values. + Each source pixel value must be an integer between 0 and + ``2**bitdepth-1``. For example, 8-bit images have values + between 0 and 255. PNG only stores images with bit depths of + 1,2,4,8, or 16. When `bitdepth` is not one of these values, + the next highest valid bit depth is selected, and an ``sBIT`` + (significant bits) chunk is generated that specifies the + original precision of the source image. In this case the + supplied pixel values will be rescaled to fit the range of + the selected bit depth. + + The details of which bit depth / colour model combinations the + PNG file format supports directly, are somewhat arcane + (refer to the PNG specification for full details). Briefly: + "small" bit depths (1,2,4) are only allowed with greyscale and + colour mapped images; colour mapped images cannot have bit depth + 16. + + For colour mapped images (in other words, when the `palette` + argument is specified) the `bitdepth` argument must match one of + the valid PNG bit depths: 1, 2, 4, or 8. (It is valid to have a + PNG image with a palette and an ``sBIT`` chunk, but the meaning + is slightly different; it would be awkward to press the + `bitdepth` argument into service for this.) + + The `palette` option, when specified, causes a colour mapped image + to be created: the PNG colour type is set to 3; `greyscale` must not + be set; `alpha` must not be set; `transparent` must not be set; + the bit depth must be 1, 2, 4, or 8. + When a colour mapped image is created, the pixel values + are palette indexes and the `bitdepth` argument specifies the size + of these indexes (not the size of the colour values in the palette). + + The palette argument value should be a sequence of 3- or + 4-tuples. 3-tuples specify RGB palette entries; 4-tuples + specify RGBA palette entries. If both 4-tuples and 3-tuples + appear in the sequence then all the 4-tuples must come + before all the 3-tuples. A ``PLTE`` chunk is created; if there + are 4-tuples then a ``tRNS`` chunk is created as well. The + ``PLTE`` chunk will contain all the RGB triples in the same + sequence; the ``tRNS`` chunk will contain the alpha channel for + all the 4-tuples, in the same sequence. Palette entries + are always 8-bit. + + If specified, the `transparent` and `background` parameters must + be a tuple with three integer values for red, green, blue, or + a simple integer (or singleton tuple) for a greyscale image. + + If specified, the `gamma` parameter must be a positive number + (generally, a `float`). A ``gAMA`` chunk will be created. + Note that this will not change the values of the pixels as + they appear in the PNG file, they are assumed to have already + been converted appropriately for the gamma specified. + + The `compression` argument specifies the compression level to + be used by the ``zlib`` module. Values from 1 to 9 specify + compression, with 9 being "more compressed" (usually smaller + and slower, but it doesn't always work out that way). 0 means + no compression. -1 and ``None`` both mean that the default + level of compession will be picked by the ``zlib`` module + (which is generally acceptable). + + If `interlace` is true then an interlaced image is created + (using PNG's so far only interace method, *Adam7*). This does + not affect how the pixels should be presented to the encoder, + rather it changes how they are arranged into the PNG file. + On slow connexions interlaced images can be partially decoded + by the browser to give a rough view of the image that is + successively refined as more image data appears. + + .. note :: + + Enabling the `interlace` option requires the entire image + to be processed in working memory. + + `chunk_limit` is used to limit the amount of memory used whilst + compressing the image. In order to avoid using large amounts of + memory, multiple ``IDAT`` chunks may be created. + + `filter_type` is number or name of filter type for better compression + see http://www.w3.org/TR/PNG/#9Filter-types for details + It's also possible to use adaptive strategy for choosing filter type + per row. Predefined strategies are `sum` and `entropy`. + Custom strategies can be added with :meth:`register_extra_filter` or + be callable passed with this argument. + (see more at :meth:`register_extra_filter`) + """ + width, height = check_sizes(kwargs.pop('size', None), + width, height) + + if width <= 0 or height <= 0: + raise ValueError("width and height must be greater than zero") + if not isinteger(width) or not isinteger(height): + raise ValueError("width and height must be integers") + # http://www.w3.org/TR/PNG/#7Integers-and-byte-order + if width > 2**32-1 or height > 2**32-1: + raise ValueError("width and height cannot exceed 2**32-1") + + if alpha and transparent is not None: + raise ValueError( + "transparent colour not allowed with alpha channel") + + if 'bytes_per_sample' in kwargs and not bitdepth: + warnings.warn('please use bitdepth instead of bytes_per_sample', + DeprecationWarning) + if kwargs['bytes_per_sample'] not in (0.125, 0.25, 0.5, 1, 2): + raise ValueError( + "bytes per sample must be .125, .25, .5, 1, or 2") + bitdepth = int(8 * kwargs.pop('bytes_per_sample')) + + if 'resolution' not in kwargs and 'physical' in kwargs: + kwargs['resolution'] = kwargs.pop('physical') + warnings.warn('please use resolution instead of physilcal', + DeprecationWarning) + + if not isinteger(bitdepth) or bitdepth < 1 or 16 < bitdepth: + raise ValueError("bitdepth (%r) must be a postive integer <= 16" % + bitdepth) + + if filter_type is None: + filter_type = 0 + elif isinstance(filter_type, basestring): + str_ftype = str(filter_type).lower() + filter_names = {'none': 0, + 'sub': 1, + 'up': 2, + 'average': 3, + 'paeth': 4} + if str_ftype in filter_names: + filter_type = filter_names[str_ftype] + self.filter_type = filter_type + + self.rescale = None + self.palette = check_palette(palette) + if self.palette: + if bitdepth not in (1, 2, 4, 8): + raise ValueError("with palette bitdepth must be 1, 2, 4, or 8") + if transparent is not None: + raise ValueError("transparent and palette not compatible") + if alpha: + raise ValueError("alpha and palette not compatible") + if greyscale: + raise ValueError("greyscale and palette not compatible") + else: + # No palette, check for sBIT chunk generation. + if alpha or not greyscale: + if bitdepth not in (8, 16): + targetbitdepth = (8, 16)[bitdepth > 8] + self.rescale = (bitdepth, targetbitdepth) + bitdepth = targetbitdepth + del targetbitdepth + else: + assert greyscale + assert not alpha + if bitdepth not in (1, 2, 4, 8, 16): + if bitdepth > 8: + targetbitdepth = 16 + elif bitdepth == 3: + targetbitdepth = 4 + else: + assert bitdepth in (5, 6, 7) + targetbitdepth = 8 + self.rescale = (bitdepth, targetbitdepth) + bitdepth = targetbitdepth + del targetbitdepth + + if bitdepth < 8 and (alpha or not greyscale and not self.palette): + raise ValueError( + "bitdepth < 8 only permitted with greyscale or palette") + if bitdepth > 8 and self.palette: + raise ValueError( + "bit depth must be 8 or less for images with palette") + + self.transparent = check_color(transparent, greyscale, 'transparent') + self.background = check_color(background, greyscale, 'background') + # At the moment the `planes` argument is ignored; + # its purpose is to act as a dummy so that + # ``Writer(x, y, **info)`` works, where `info` is a dictionary + # returned by Reader.read and friends. + # Ditto for `colormap` and `maxval`. + popdict(kwargs, ('planes', 'colormap', 'maxval')) + + for ex_kw in ('text', 'resolution', 'modification_time', + 'rendering_intent', 'white_point', 'rgb_points'): + getattr(self, 'set_' + ex_kw)(kwargs.pop(ex_kw, None)) + # Keyword text support + kw_text = popdict(kwargs, _registered_kw) + if kw_text: + kw_text.update(self.text) + self.set_text(kw_text) + + if kwargs: + warnings.warn("Unknown writer args: " + str(kwargs)) + + # It's important that the true boolean values (greyscale, alpha, + # colormap, interlace) are converted to bool because Iverson's + # convention is relied upon later on. + self.width = width + self.height = height + self.gamma = gamma + self.icc_profile = icc_profile + if icc_profile: + if not icc_profile_name: + raise Error("ICC profile shoud have a name") + else: + self.icc_profile_name = strtobytes(icc_profile_name) + self.greyscale = bool(greyscale) + self.alpha = bool(alpha) + self.bitdepth = int(bitdepth) + self.compression = compression + self.chunk_limit = chunk_limit + self.interlace = bool(interlace) + + colormap = bool(self.palette) + self.color_type = 4 * self.alpha + 2 * (not greyscale) + 1 * colormap + assert self.color_type in (0, 2, 3, 4, 6) + + self.color_planes = (3, 1)[self.greyscale or colormap] + self.planes = self.color_planes + self.alpha + + def set_text(self, text=None, **kwargs): + """Add textual information. + + All pairs in dictionary will be written, but keys should be latin-1; + registered keywords could be used as arguments. + + When called more than once overwrite exist data. + """ + if text is None: + text = {} + text.update(popdict(kwargs, _registered_kw)) + if 'Creation Time' in text and\ + not isinstance(text['Creation Time'], (basestring, bytes)): + text['Creation Time'] = datetime.datetime( + *(check_time(text['Creation Time'])[:6])).isoformat() + self.text = text + + def set_modification_time(self, modification_time=True): + """ + Add time to be written as last modification time + + When called after initialisation configure to use + time of writing file + """ + if (isinstance(modification_time, basestring) and + modification_time.lower() == 'write') or\ + modification_time is True: + self.modification_time = True + else: + self.modification_time = check_time(modification_time) + + def set_resolution(self, resolution=None): + """ + Add physical pixel dimensions + + `resolution` supposed two be tuple of two parameterts: pixels per unit + and unit type; unit type may be omitted + pixels per unit could be simple integer or tuple of (ppu_x, ppu_y) + Also possible to use all three parameters im row + + * resolution = ((1, 4), ) # wide pixels (4:1) without unit specifier + * resolution = (300, 'inch') # 300dpi in both dimensions + * resolution = (4, 1, 0) # tall pixels (1:4) without unit specifier + """ + if resolution is None: + self.resolution = None + return + # All in row + if len(resolution) == 3: + self.resolution = ((resolution[0], resolution[1]), resolution[2]) + return + # Ensure length and convert all false to 0 (no unit) + if len(resolution) == 1 or not resolution[1]: + resolution = (resolution[0], 0) + # Single dimension + if isinstance(resolution[0], float) or isinteger(resolution[0]): + resolution = ((resolution[0], resolution[0]), resolution[1]) + # Unit conversion + if resolution[1] in (1, 'm', 'meter'): + resolution = (resolution[0], 1) + elif resolution[1] in ('i', 'in', 'inch'): + resolution = ((int(resolution[0][0] / 0.0254 + 0.5), + int(resolution[0][1] / 0.0254 + 0.5)), 1) + elif resolution[1] in ('cm', 'centimeter'): + resolution = ((resolution[0][0] * 100, + resolution[0][1] * 100), 1) + self.resolution = resolution + + def set_rendering_intent(self, rendering_intent): + """Set rendering intent variant for sRGB chunk""" + if rendering_intent not in (None, + PERCEPTUAL, + RELATIVE_COLORIMETRIC, + SATURATION, + ABSOLUTE_COLORIMETRIC): + raise FormatError('Unknown redering intent') + self.rendering_intent = rendering_intent + + def set_white_point(self, white_point, point2=None): + """Set white point part of cHRM chunk""" + if isinstance(white_point, float) and isinstance(point2, float): + white_point = (white_point, point2) + self.white_point = white_point + + def set_rgb_points(self, rgb_points, *args): + """Set rgb points part of cHRM chunk""" + if not args: + self.rgb_points = rgb_points + # separate tuples + elif len(args) == 2: + self.rgb_points = (rgb_points, args[0], args[1]) + # separate numbers + elif len(args) == 5: + self.rgb_points = ((rgb_points, args[0]), + (args[1], args[2]), + (args[3], args[4])) + + def __write_palette(self, outfile): + """ + Write``PLTE`` and if necessary a ``tRNS`` chunk to. + + This method should be called only from ``write_idat`` method + or chunk order will be ruined. + """ + p = bytearray() + t = bytearray() + + for x in self.palette: + p.extend(x[0:3]) + if len(x) > 3: + t.append(x[3]) + + write_chunk(outfile, 'PLTE', bytearray_to_bytes(p)) + if t: + # tRNS chunk is optional. Only needed if palette entries + # have alpha. + write_chunk(outfile, 'tRNS', bytearray_to_bytes(t)) + + def __write_srgb(self, outfile): + """ + Write colour reference information: gamma, iccp etc. + + This method should be called only from ``write_idat`` method + or chunk order will be ruined. + """ + if self.rendering_intent is not None and self.icc_profile is not None: + raise FormatError("sRGB(via rendering_intent) and iCCP could not" + "be present simultaneously") + # http://www.w3.org/TR/PNG/#11sRGB + if self.rendering_intent is not None: + write_chunk(outfile, 'sRGB', + struct.pack("B", int(self.rendering_intent))) + # http://www.w3.org/TR/PNG/#11cHRM + if (self.white_point is not None and self.rgb_points is None) or\ + (self.white_point is None and self.rgb_points is not None): + logging.warn("White and RGB points should be both specified to" + " write cHRM chunk") + self.white_point = None + self.rgb_points = None + if (self.white_point is not None and self.rgb_points is not None): + data = (self.white_point[0], self.white_point[1], + self.rgb_points[0][0], self.rgb_points[0][1], + self.rgb_points[1][0], self.rgb_points[1][1], + self.rgb_points[2][0], self.rgb_points[2][1], + ) + write_chunk(outfile, 'cHRM', + struct.pack("!8L", + *[int(round(it * 1e5)) for it in data])) + # http://www.w3.org/TR/PNG/#11gAMA + if self.gamma is not None: + write_chunk(outfile, 'gAMA', + struct.pack("!L", int(round(self.gamma * 1e5)))) + # http://www.w3.org/TR/PNG/#11iCCP + if self.icc_profile is not None: + write_chunk(outfile, 'iCCP', + self.icc_profile_name + zerobyte + + zerobyte + + zlib.compress(self.icc_profile, self.compression)) + + def __write_text(self, outfile): + """ + Write text information into file + + This method should be called only from ``write_idat`` method + or chunk order will be ruined. + """ + for k, v in self.text.items(): + if not isinstance(v, bytes): + try: + international = False + v = v.encode('latin-1') + except UnicodeEncodeError: + international = True + v = v.encode('utf-8') + else: + international = False + if not isinstance(k, bytes): + k = strtobytes(k) + if international: + # No compress, language tag or translated keyword for now + write_chunk(outfile, 'iTXt', k + zerobyte + + zerobyte + zerobyte + + zerobyte + zerobyte + v) + else: + write_chunk(outfile, 'tEXt', k + zerobyte + v) + + def write(self, outfile, rows): + """ + Write a PNG image to the output file. + + `rows` should be an iterable that yields each row in boxed row + flat pixel format. The rows should be the rows of the original + image, so there should be ``self.height`` rows of ``self.width * + self.planes`` values. If `interlace` is specified (when + creating the instance), then an interlaced PNG file will + be written. Supply the rows in the normal image order; + the interlacing is carried out internally. + + .. note :: + + Interlacing will require the entire image to be in working + memory. + """ + if self.interlace: + fmt = 'BH'[self.bitdepth > 8] + a = array(fmt, itertools.chain(*rows)) + return self.write_array(outfile, a) + else: + nrows = self.write_passes(outfile, rows) + if nrows != self.height: + raise ValueError( + "rows supplied (%d) does not match height (%d)" % + (nrows, self.height)) + + def write_passes(self, outfile, rows, packed=False): + """ + Write a PNG image to the output file. + + Most users are expected to find the :meth:`write` or + :meth:`write_array` method more convenient. + + The rows should be given to this method in the order that + they appear in the output file. For straightlaced images, + this is the usual top to bottom ordering, but for interlaced + images the rows should have already been interlaced before + passing them to this function. + + `rows` should be an iterable that yields each row. When + `packed` is ``False`` the rows should be in boxed row flat pixel + format; when `packed` is ``True`` each row should be a packed + sequence of bytes. + """ + self.write_idat(outfile, self.idat(rows, packed)) + return self.irows + + def write_idat(self, outfile, idat_sequence): + """ + Write png with IDAT to file + + `idat_sequence` should be iterable that produce IDAT chunks + compatible with `Writer` configuration. + """ + # http://www.w3.org/TR/PNG/#5PNG-file-signature + outfile.write(png_signature) + + # http://www.w3.org/TR/PNG/#11IHDR + write_chunk(outfile, 'IHDR', + struct.pack("!2I5B", self.width, self.height, + self.bitdepth, self.color_type, + 0, 0, self.interlace)) + # See :chunk:order + self.__write_srgb(outfile) + # See :chunk:order + # http://www.w3.org/TR/PNG/#11sBIT + if self.rescale: + write_chunk(outfile, 'sBIT', + struct.pack('%dB' % self.planes, + *[self.rescale[0]]*self.planes)) + # :chunk:order: Without a palette (PLTE chunk), ordering is + # relatively relaxed. With one, gamma info must precede PLTE + # chunk which must precede tRNS and bKGD. + # See http://www.w3.org/TR/PNG/#5ChunkOrdering + if self.palette: + self.__write_palette(outfile) + + # http://www.w3.org/TR/PNG/#11tRNS + if self.transparent is not None: + if self.greyscale: + write_chunk(outfile, 'tRNS', + struct.pack("!1H", *self.transparent)) + else: + write_chunk(outfile, 'tRNS', + struct.pack("!3H", *self.transparent)) + + # http://www.w3.org/TR/PNG/#11bKGD + if self.background is not None: + if self.greyscale: + write_chunk(outfile, 'bKGD', + struct.pack("!1H", *self.background)) + else: + write_chunk(outfile, 'bKGD', + struct.pack("!3H", *self.background)) + # http://www.w3.org/TR/PNG/#11pHYs + if self.resolution is not None: + write_chunk(outfile, 'pHYs', + struct.pack("!IIB", + self.resolution[0][0], + self.resolution[0][1], + self.resolution[1])) + # http://www.w3.org/TR/PNG/#11tIME + if self.modification_time is not None: + if self.modification_time is True: + self.modification_time = check_time('now') + write_chunk(outfile, 'tIME', + struct.pack("!H5B", *(self.modification_time[:6]))) + # http://www.w3.org/TR/PNG/#11textinfo + if self.text: + self.__write_text(outfile) + for idat in idat_sequence: + write_chunk(outfile, 'IDAT', idat) + # http://www.w3.org/TR/PNG/#11IEND + write_chunk(outfile, 'IEND') + + def idat(self, rows, packed=False): + """Generator that produce IDAT chunks from rows""" + # http://www.w3.org/TR/PNG/#11IDAT + if self.compression is not None: + compressor = zlib.compressobj(self.compression) + else: + compressor = zlib.compressobj() + + filt = Filter(self.bitdepth * self.planes, + self.interlace, self.height) + data = bytearray() + + def byteextend(rowbytes): + """Default extending data with bytes. Applying filter""" + data.extend(filt.do_filter(self.filter_type, rowbytes)) + + # Choose an extend function based on the bitdepth. The extend + # function packs/decomposes the pixel values into bytes and + # stuffs them onto the data array. + if self.bitdepth == 8 or packed: + extend = byteextend + elif self.bitdepth == 16: + def extend(sl): + """Decompose into bytes before byteextend""" + fmt = '!%dH' % len(sl) + byteextend(bytearray(struct.pack(fmt, *sl))) + else: + # Pack into bytes + assert self.bitdepth < 8 + # samples per byte + spb = 8 // self.bitdepth + + def extend(sl): + """Pack into bytes before byteextend""" + a = bytearray(sl) + # Adding padding bytes so we can group into a whole + # number of spb-tuples. + l = float(len(a)) + extra = math.ceil(l / float(spb))*spb - l + a.extend([0]*int(extra)) + # Pack into bytes + l = group(a, spb) + l = [reduce(lambda x, y: (x << self.bitdepth) + y, e) + for e in l] + byteextend(l) + if self.rescale: + oldextend = extend + factor = \ + float(2**self.rescale[1]-1) / float(2**self.rescale[0]-1) + + def extend(sl): + """Rescale before extend""" + oldextend([int(round(factor * x)) for x in sl]) + + # Build the first row, testing mostly to see if we need to + # changed the extend function to cope with NumPy integer types + # (they cause our ordinary definition of extend to fail, so we + # wrap it). See + # http://code.google.com/p/pypng/issues/detail?id=44 + enumrows = enumerate(rows) + del rows + + # :todo: Certain exceptions in the call to ``.next()`` or the + # following try would indicate no row data supplied. + # Should catch. + i,row = next(enumrows) + try: + # If this fails... + extend(row) + except: + # ... try a version that converts the values to int first. + # Not only does this work for the (slightly broken) NumPy + # types, there are probably lots of other, unknown, "nearly" + # int types it works for. + def wrapmapint(f): + return lambda sl: f([int(x) for x in sl]) + extend = wrapmapint(extend) + del wrapmapint + extend(row) + + for i,row in enumrows: + extend(row) + if len(data) > self.chunk_limit: + compressed = compressor.compress( + bytearray_to_bytes(data)) + if len(compressed): + yield compressed + # Because of our very witty definition of ``extend``, + # above, we must re-use the same ``data`` object. Hence + # we use ``del`` to empty this one, rather than create a + # fresh one (which would be my natural FP instinct). + del data[:] + if len(data): + compressed = compressor.compress(bytearray_to_bytes(data)) + else: + compressed = bytes() + flushed = compressor.flush() + if len(compressed) or len(flushed): + yield compressed + flushed + self.irows = i + 1 + + def write_array(self, outfile, pixels): + """ + Write an array in flat row flat pixel format as a PNG file on + the output file. See also :meth:`write` method. + """ + + if self.interlace: + self.write_passes(outfile, self.array_scanlines_interlace(pixels)) + else: + self.write_passes(outfile, self.array_scanlines(pixels)) + + def write_packed(self, outfile, rows): + """ + Write PNG file to `outfile`. + + The pixel data comes from `rows` which should be in boxed row + packed format. Each row should be a sequence of packed bytes. + + Technically, this method does work for interlaced images but it + is best avoided. For interlaced images, the rows should be + presented in the order that they appear in the file. + + This method should not be used when the source image bit depth + is not one naturally supported by PNG; the bit depth should be + 1, 2, 4, 8, or 16. + """ + if self.rescale: + raise Error("write_packed method not suitable for bit depth %d" % + self.rescale[0]) + return self.write_passes(outfile, rows, packed=True) + + def convert_pnm(self, infile, outfile): + """ + Convert a PNM file containing raw pixel data into a PNG file + with the parameters set in the writer object. Works for + (binary) PGM, PPM, and PAM formats. + """ + if self.interlace: + pixels = array('B') + pixels.fromfile(infile, + (self.bitdepth/8) * self.color_planes * + self.width * self.height) + self.write_passes(outfile, self.array_scanlines_interlace(pixels)) + else: + self.write_passes(outfile, self.file_scanlines(infile)) + + def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile): + """ + Convert a PPM and PGM file containing raw pixel data into a + PNG outfile with the parameters set in the writer object. + """ + pixels = array('B') + pixels.fromfile(ppmfile, + (self.bitdepth/8) * self.color_planes * + self.width * self.height) + apixels = array('B') + apixels.fromfile(pgmfile, + (self.bitdepth/8) * + self.width * self.height) + pixels = interleave_planes(pixels, apixels, + (self.bitdepth/8) * self.color_planes, + (self.bitdepth/8)) + if self.interlace: + self.write_passes(outfile, self.array_scanlines_interlace(pixels)) + else: + self.write_passes(outfile, self.array_scanlines(pixels)) + + def file_scanlines(self, infile): + """ + Generates boxed rows in flat pixel format, from the input file. + + It assumes that the input file is in a "Netpbm-like" + binary format, and is positioned at the beginning of the first + pixel. The number of pixels to read is taken from the image + dimensions (`width`, `height`, `planes`) and the number of bytes + per value is implied by the image `bitdepth`. + """ + + # Values per row + vpr = self.width * self.planes + row_bytes = vpr + if self.bitdepth > 8: + assert self.bitdepth == 16 + row_bytes *= 2 + fmt = '>%dH' % vpr + def line(): + return array('H', struct.unpack(fmt, infile.read(row_bytes))) + else: + def line(): + scanline = array('B', infile.read(row_bytes)) + return scanline + for y in range(self.height): + yield line() + + def array_scanlines(self, pixels): + """ + Generates boxed rows (flat pixels) from flat rows (flat pixels) + in an array. + """ + # Values per row + vpr = self.width * self.planes + stop = 0 + for y in range(self.height): + start = stop + stop = start + vpr + yield pixels[start:stop] + + def array_scanlines_interlace(self, pixels): + """ + Generator for interlaced scanlines from an array. + + `pixels` is the full source image in flat row flat pixel format. + The generator yields each scanline of the reduced passes in turn, in + boxed row flat pixel format. + """ + # http://www.w3.org/TR/PNG/#8InterlaceMethods + # Array type. + fmt = 'BH'[self.bitdepth > 8] + # Value per row + vpr = self.width * self.planes + for xstart, ystart, xstep, ystep in _adam7: + if xstart >= self.width: + continue + # Pixels per row (of reduced image) + ppr = int(math.ceil((self.width-xstart)/float(xstep))) + # number of values in reduced image row. + row_len = ppr*self.planes + for y in range(ystart, self.height, ystep): + if xstep == 1: + offset = y * vpr + yield pixels[offset:offset+vpr] + else: + row = array(fmt) + # There's no easier way to set the length of an array + row.extend(pixels[0:row_len]) + offset = y * vpr + xstart * self.planes + end_offset = (y+1) * vpr + skip = self.planes * xstep + for i in range(self.planes): + row[i::self.planes] = \ + pixels[offset+i:end_offset:skip] + yield row + + +def write_chunk(outfile, tag, data=bytes()): + """Write a PNG chunk to the output file, including length and checksum.""" + # http://www.w3.org/TR/PNG/#5Chunk-layout + outfile.write(struct.pack("!I", len(data))) + tag = strtobytes(tag) + outfile.write(tag) + outfile.write(data) + checksum = zlib.crc32(tag) + checksum = zlib.crc32(data, checksum) + checksum &= 0xFFFFFFFF + outfile.write(struct.pack("!I", checksum)) + + +def write_chunks(out, chunks): + """Create a PNG file by writing out the chunks.""" + out.write(png_signature) + for chunk in chunks: + write_chunk(out, *chunk) + + +class Filter(BaseFilter): + def __init__(self, bitdepth=8, interlace=None, rows=None, prev=None): + BaseFilter.__init__(self, bitdepth) + if prev is None: + self.prev = None + else: + self.prev = bytearray(prev) + self.interlace = interlace + self.restarts = [] + if self.interlace: + for _, off, _, step in _adam7: + self.restarts.append((rows - off - 1 + step) // step) + + def filter_all(self, line): + """Doing all filters for specified line + + return filtered lines as list + For using with adaptive filters + """ + lines = [None] * 5 + for filter_type in range(5): # range save more than 'optimised' order + res = copyBarray(line) + self._filter_scanline(filter_type, line, res) + res.insert(0, filter_type) + lines[filter_type] = res + return lines + + adapt_methods = {} + + def adaptive_filter(self, strategy, line): + """ + Applying non-standart filters (e.g. adaptive selection) + + `strategy` may be one of following types: + + - string - find and use strategy with this name + - dict - find and use strategy by field 'name' of this dict + and use it with this dict as configuration + - callable - use this callable as strategy with empty dict as cfg + check :meth:`register_extra_filter` for documentation) + + `line` specifies the current (unfiltered) scanline as a sequence + of bytes; + """ + if isinstance(strategy, (basestring, bytes)): + strategy = {'name': str(strategy)} + if isinstance(strategy, dict): + cfg = strategy + strategy = Filter.adapt_methods.get(cfg['name']) + else: + cfg = {} + if strategy is None: + raise Error("Adaptive strategy not found") + else: + return strategy(line, cfg, self) + + def do_filter(self, filter_type, line): + """ + Applying filter, caring about prev line, interlacing etc. + + `filter_type` may be integer to apply basic filter or + adaptive strategy with dict + (`name` is reqired field, others may tune strategy) + """ + # Recall that filtering algorithms are applied to bytes, + # not to pixels, regardless of the bit depth or colour type + # of the image. + + line = bytearray(line) + if isinstance(filter_type, int): + res = bytearray(line) + self._filter_scanline(filter_type, line, res) + res.insert(0, filter_type) # Add filter type as the first byte + else: + res = self.adaptive_filter(filter_type, line) + self.prev = line + if self.restarts: + self.restarts[0] -= 1 + if self.restarts[0] == 0: + del self.restarts[0] + self.prev = None + return res + + +def register_extra_filter(selector, name): + """ + Register adaptive filter selection strategy for futher usage. + + `selector` - callable like ``def(line, cfg, filter_obj)`` + + - line - line for filtering + - cfg - dict with optional tuning + - filter_obj - instance of this class to get context or apply base filters + + callable should return chosen line + + `name` - name which may be used later to recall this strategy + """ + Filter.adapt_methods[str(name)] = selector + + +# Two basic adaptive strategies +def adapt_sum(line, cfg, filter_obj): + """Determine best filter by sum of all row values""" + lines = filter_obj.filter_all(line) + res_s = [sum(it) for it in lines] + r = res_s.index(min(res_s)) + return lines[r] +register_extra_filter(adapt_sum, 'sum') + + +def adapt_entropy(line, cfg, filter_obj): + """Determine best filter by dispersion of row values""" + lines = filter_obj.filter_all(line) + res_c = [len(set(it)) for it in lines] + r = res_c.index(min(res_c)) + return lines[r] +register_extra_filter(adapt_entropy, 'entropy') + + +def parse_mode(mode, default_bitdepth=None): + """Parse PIL-style mode and return tuple (grayscale, alpha, bitdeph)""" + # few special cases + if mode == 'P': + # Don't know what is pallette + raise Error('Unknown colour mode:' + mode) + elif mode == '1': + # Logical + return (True, False, 1) + elif mode == 'I': + # Integer + return (True, False, 16) + # here we go + if mode.startswith('L'): + grayscale = True + mode = mode[1:] + elif mode.startswith('RGB'): + grayscale = False + mode = mode[3:] + else: + raise Error('Unknown colour mode:' + mode) + + if mode.startswith('A'): + alpha = True + mode = mode[1:] + else: + alpha = False + + bitdepth = default_bitdepth + if mode.startswith(';'): + mode = mode[1:] + if mode: + try: + bitdepth = int(mode) + except (TypeError, ValueError): + raise Error('Unsupported bitdepth mode:' + mode) + return (grayscale, alpha, bitdepth) + + +def from_array(a, mode=None, info=None): + """ + Create a PNG :class:`Image` object from a 2- or 3-dimensional array. + + One application of this function is easy PIL-style saving: + ``png.from_array(pixels, 'L').save('foo.png')``. + + .. note : + + The use of the term *3-dimensional* is for marketing purposes + only. It doesn't actually work. Please bear with us. Meanwhile + enjoy the complimentary snacks (on request) and please use a + 2-dimensional array. + + Unless they are specified using the *info* parameter, the PNG's + height and width are taken from the array size. For a 3 dimensional + array the first axis is the height; the second axis is the width; + and the third axis is the channel number. Thus an RGB image that is + 16 pixels high and 8 wide will use an array that is 16x8x3. For 2 + dimensional arrays the first axis is the height, but the second axis + is ``width*channels``, so an RGB image that is 16 pixels high and 8 + wide will use a 2-dimensional array that is 16x24 (each row will be + 8*3 = 24 sample values). + + *mode* is a string that specifies the image colour format in a + PIL-style mode. It can be: + + ``'L'`` + greyscale (1 channel) + ``'LA'`` + greyscale with alpha (2 channel) + ``'RGB'`` + colour image (3 channel) + ``'RGBA'`` + colour image with alpha (4 channel) + + The mode string can also specify the bit depth (overriding how this + function normally derives the bit depth, see below). Appending + ``';16'`` to the mode will cause the PNG to be 16 bits per channel; + any decimal from 1 to 16 can be used to specify the bit depth. + + When a 2-dimensional array is used *mode* determines how many + channels the image has, and so allows the width to be derived from + the second array dimension. + + The array is expected to be a ``numpy`` array, but it can be any + suitable Python sequence. For example, a list of lists can be used: + ``png.from_array([[0, 255, 0], [255, 0, 255]], 'L')``. The exact + rules are: ``len(a)`` gives the first dimension, height; + ``len(a[0])`` gives the second dimension; ``len(a[0][0])`` gives the + third dimension, unless an exception is raised in which case a + 2-dimensional array is assumed. It's slightly more complicated than + that because an iterator of rows can be used, and it all still + works. Using an iterator allows data to be streamed efficiently. + + The bit depth of the PNG is normally taken from the array element's + datatype (but if *mode* specifies a bitdepth then that is used + instead). The array element's datatype is determined in a way which + is supposed to work both for ``numpy`` arrays and for Python + ``array.array`` objects. A 1 byte datatype will give a bit depth of + 8, a 2 byte datatype will give a bit depth of 16. If the datatype + does not have an implicit size, for example it is a plain Python + list of lists, as above, then a default of 8 is used. + + The *info* parameter is a dictionary that can be used to specify + metadata (in the same style as the arguments to the + :class:`png.Writer` class). For this function the keys that are + useful are: + + height + overrides the height derived from the array dimensions and allows + *a* to be an iterable. + width + overrides the width derived from the array dimensions. + bitdepth + overrides the bit depth derived from the element datatype (but + must match *mode* if that also specifies a bit depth). + + Generally anything specified in the + *info* dictionary will override any implicit choices that this + function would otherwise make, but must match any explicit ones. + For example, if the *info* dictionary has a ``greyscale`` key then + this must be true when mode is ``'L'`` or ``'LA'`` and false when + mode is ``'RGB'`` or ``'RGBA'``. + """ + # typechecks *info* to some extent. + if info is None: + info = {} + else: + info = dict(info) + + # Syntax check mode string. + parsed_mode = parse_mode(mode) + grayscale, alpha, bitdepth = parsed_mode + + # Colour format. + if 'greyscale' in info: + if bool(info['greyscale']) != grayscale: + raise Error("info['greyscale'] should match mode.") + info['greyscale'] = grayscale + if 'alpha' in info: + if bool(info['alpha']) != alpha: + raise Error("info['alpha'] should match mode.") + info['alpha'] = alpha + + # Get bitdepth from *mode* if possible. + if bitdepth: + if info.get('bitdepth') and bitdepth != info['bitdepth']: + raise Error("mode bitdepth (%d) should match info bitdepth (%d)." % + (bitdepth, info['bitdepth'])) + info['bitdepth'] = bitdepth + + planes = (3, 1)[grayscale] + alpha + if 'planes' in info: + if info['planes'] != planes: + raise Error("info['planes'] should match mode.") + + # Dimensions. + if 'size' in info: + info['width'], info['height'] = check_sizes(info.get('size'), + info.get('width'), + info.get('height')) + if 'height' not in info: + try: + l = len(a) + except TypeError: + raise Error( + "len(a) does not work, supply info['height'] instead.") + info['height'] = l + + # In order to work out whether we the array is 2D or 3D we need its + # first row, which requires that we take a copy of its iterator. + # We may also need the first row to derive width and bitdepth. + row, a = peekiter(a) + try: + row[0][0] + threed = True + testelement = row[0] + except (IndexError, TypeError): + threed = False + testelement = row + if 'width' not in info: + if threed: + width = len(row) + else: + width = len(row) // planes + info['width'] = width + + # Not implemented yet + assert not threed + + if 'bitdepth' not in info: + try: + dtype = testelement.dtype + # goto the "else:" clause. Sorry. + except AttributeError: + try: + # Try a Python array.array. + bitdepth = 8 * testelement.itemsize + except AttributeError: + # We can't determine it from the array element's + # datatype, use a default of 8. + bitdepth = 8 + else: + # If we got here without exception, we now assume that + # the array is a numpy array. + if dtype.kind == 'b': + bitdepth = 1 + else: + bitdepth = 8 * dtype.itemsize + info['bitdepth'] = bitdepth + + for thing in ('width', 'height', 'bitdepth', 'greyscale', 'alpha'): + assert thing in info + return Image(a, info) + +# So that refugee's from PIL feel more at home. Not documented. +fromarray = from_array + + +class Image(object): + + """ + A PNG image. + + You can create an :class:`Image` object from + an array of pixels by calling :meth:`png.from_array`. It can be + saved to disk with the :meth:`save` method. + """ + + def __init__(self, rows, info): + """The constructor is not public. Please do not call it.""" + self.rows = rows + self.info = info + + def save(self, file): + """ + Save the image to *file*. + + If *file* looks like an open file + descriptor then it is used, otherwise it is treated as a + filename and a fresh file is opened. + + In general, you can only call this method once; after it has + been called the first time and the PNG image has been saved, the + source data will have been streamed, and cannot be streamed + again. + """ + w = Writer(**self.info) + + try: + file.write + def close(): pass + except AttributeError: + file = open(file, 'wb') + def close(): file.close() + + try: + w.write(file, self.rows) + finally: + close() + + +class _readable(object): + + """A simple file-like interface for strings and arrays.""" + + def __init__(self, buf): + self.buf = buf + self.offset = 0 + + def read(self, n): + """Read `n` chars from buffer""" + r = self.buf[self.offset:self.offset + n] + if isinstance(r, array): + r = r.tostring() + self.offset += n + return r + + +class Reader(object): + + """PNG decoder in pure Python.""" + + def __init__(self, _guess=None, **kw): + """ + Create a PNG decoder object. + + The constructor expects exactly one keyword argument. If you + supply a positional argument instead, it will guess the input + type. You can choose among the following keyword arguments: + + filename + Name of input file (a PNG file). + file + A file-like object (object with a read() method). + bytes + ``array`` or ``string`` with PNG data. + """ + if ((_guess is not None and len(kw) != 0) or + (_guess is None and len(kw) != 1)): + raise TypeError("Reader() takes exactly 1 argument") + + # Will be the first 8 bytes, later on. See validate_signature. + self.signature = None + self.transparent = None + self.text = {} + # A pair of (len, chunk_type) if a chunk has been read but its data and + # checksum have not (in other words the file position is just + # past the 4 bytes that specify the chunk type). See preamble + # method for how this is used. + self.atchunk = None + + if _guess is not None: + if isinstance(_guess, array): + kw["bytes"] = _guess + elif isinstance(_guess, str): + kw["filename"] = _guess + elif hasattr(_guess, 'read'): + kw["file"] = _guess + + if "filename" in kw: + self.file = open(kw["filename"], "rb") + elif "file" in kw: + self.file = kw["file"] + elif "bytes" in kw: + self.file = _readable(kw["bytes"]) + else: + raise TypeError("expecting filename, file or bytes array") + + def chunk(self, seek=None, lenient=False): + """ + Read the next PNG chunk from the input file + + returns a (*chunk_type*, *data*) tuple. *chunk_type* is the chunk's + type as a byte string (all PNG chunk types are 4 bytes long). + *data* is the chunk's data content, as a byte string. + + If the optional `seek` argument is + specified then it will keep reading chunks until it either runs + out of file or finds the chunk_type specified by the argument. Note + that in general the order of chunks in PNGs is unspecified, so + using `seek` can cause you to miss chunks. + + If the optional `lenient` argument evaluates to `True`, + checksum failures will raise warnings rather than exceptions. + """ + self.validate_signature() + while True: + # http://www.w3.org/TR/PNG/#5Chunk-layout + if not self.atchunk: + self.atchunk = self.chunklentype() + length, chunk_type = self.atchunk + self.atchunk = None + data = self.file.read(length) + if len(data) != length: + raise ChunkError('Chunk %s too short for required %i octets.' + % (chunk_type, length)) + checksum = self.file.read(4) + if len(checksum) != 4: + raise ChunkError('Chunk %s too short for checksum.', + chunk_type) + if seek and chunk_type != seek: + continue + verify = zlib.crc32(strtobytes(chunk_type)) + verify = zlib.crc32(data, verify) + # Whether the output from zlib.crc32 is signed or not varies + # according to hideous implementation details, see + # http://bugs.python.org/issue1202 . + # We coerce it to be positive here (in a way which works on + # Python 2.3 and older). + verify &= 2**32 - 1 + verify = struct.pack('!I', verify) + if checksum != verify: + (a, ) = struct.unpack('!I', checksum) + (b, ) = struct.unpack('!I', verify) + message = "Checksum error in %s chunk: 0x%08X != 0x%08X." %\ + (chunk_type, a, b) + if lenient: + warnings.warn(message, RuntimeWarning) + else: + raise ChunkError(message) + return chunk_type, data + + def chunks(self): + """Return an iterator that will yield each chunk as a + (*chunktype*, *content*) pair. + """ + while True: + t,v = self.chunk() + yield t,v + if t == 'IEND': + break + + def deinterlace(self, raw): + """ + Read raw pixel data, undo filters, deinterlace, and flatten. + + Return in flat row flat pixel format. + """ + # Values per row (of the target image) + vpr = self.width * self.planes + + # Make a result array, and make it big enough. Interleaving + # writes to the output array randomly (well, not quite), so the + # entire output array must be in memory. + if self.bitdepth > 8: + a = newHarray(vpr * self.height) + else: + a = newBarray(vpr * self.height) + source_offset = 0 + filt = Filter(self.bitdepth * self.planes) + for xstart, ystart, xstep, ystep in _adam7: + if xstart >= self.width: + continue + # The previous (reconstructed) scanline. None at the + # beginning of a pass to indicate that there is no previous + # line. + filt.prev = None + # Pixels per row (reduced pass image) + ppr = int(math.ceil((self.width-xstart)/float(xstep))) + # Row size in bytes for this pass. + row_size = int(math.ceil(self.psize * ppr)) + for y in range(ystart, self.height, ystep): + filter_type = raw[source_offset] + scanline = raw[source_offset + 1:source_offset + row_size + 1] + source_offset += (row_size + 1) + if filter_type not in (0, 1, 2, 3, 4): + raise FormatError('Invalid PNG Filter Type.' + ' See http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .') + filt.undo_filter(filter_type, scanline) + # Convert so that there is one element per pixel value + flat = self.serialtoflat(scanline, ppr) + if xstep == 1: + assert xstart == 0 + offset = y * vpr + a[offset:offset+vpr] = flat + else: + offset = y * vpr + xstart * self.planes + end_offset = (y+1) * vpr + skip = self.planes * xstep + for i in range(self.planes): + a[offset+i:end_offset:skip] = \ + flat[i::self.planes] + return a + + def iterboxed(self, rows): + """ + Iterator that yields each scanline in boxed row flat pixel format. + + `rows` should be an iterator that yields the bytes of + each row in turn. + """ + def asvalues(raw): + """ + Convert a row of raw bytes into a flat row. + + Result may or may not share with argument + """ + if self.bitdepth == 8: + return raw + if self.bitdepth == 16: + raw = bytearray_to_bytes(raw) + return array('H', struct.unpack('!%dH' % (len(raw) // 2), raw)) + assert self.bitdepth < 8 + width = self.width + # Samples per byte + spb = 8 // self.bitdepth + out = newBarray() + mask = 2 ** self.bitdepth - 1 + # reversed range(spb) + shifts = [self.bitdepth * it for it in range(spb - 1, -1, -1)] + for o in raw: + out.extend([mask & (o >> i) for i in shifts]) + return out[:width] + + return map(asvalues, rows) + + def serialtoflat(self, raw, width=None): + """Convert serial format (byte stream) pixel data to flat row + flat pixel. + """ + if self.bitdepth == 8: + return raw + if self.bitdepth == 16: + raw = bytearray_to_bytes(raw) + return array('H', + struct.unpack('!%dH' % (len(raw) // 2), raw)) + assert self.bitdepth < 8 + if width is None: + width = self.width + # Samples per byte + spb = 8 // self.bitdepth + out = newBarray() + mask = 2**self.bitdepth - 1 + # reversed range(spb) + shifts = [self.bitdepth * it for it in range(spb - 1, -1, -1)] + l = width + for o in raw: + out.extend([(mask&(o>>s)) for s in shifts][:l]) + l -= spb + if l <= 0: + l = width + return out + + def iterstraight(self, raw): + """ + Iterator that undoes the effect of filtering + + Yields each row in serialised format (as a sequence of bytes). + Assumes input is straightlaced. `raw` should be an iterable + that yields the raw bytes in chunks of arbitrary size. + """ + + # length of row, in bytes (with filter) + rb_1 = self.row_bytes + 1 + a = bytearray() + filt = Filter(self.bitdepth * self.planes) + for some in raw: + a.extend(some) + offset = 0 + while len(a) >= rb_1 + offset: + filter_type = a[offset] + if filter_type not in (0, 1, 2, 3, 4): + raise FormatError('Invalid PNG Filter Type.' + ' See http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .') + scanline = a[offset + 1:offset + rb_1] + filt.undo_filter(filter_type, scanline) + yield scanline + offset += rb_1 + del a[:offset] + + if len(a) != 0: + # :file:format We get here with a file format error: + # when the available bytes (after decompressing) do not + # pack into exact rows. + raise FormatError( + 'Wrong size for decompressed IDAT chunk.') + assert len(a) == 0 + + def validate_signature(self): + """If signature (header) has not been read then read and validate it""" + if self.signature: + return + self.signature = self.file.read(8) + if self.signature != png_signature: + raise FormatError("PNG file has invalid signature.") + + def preamble(self, lenient=False): + """ + Extract the image metadata + + Extract the image metadata by reading the initial part of + the PNG file up to the start of the ``IDAT`` chunk. All the + chunks that precede the ``IDAT`` chunk are read and either + processed for metadata or discarded. + + If the optional `lenient` argument evaluates to `True`, checksum + failures will raise warnings rather than exceptions. + """ + self.validate_signature() + while True: + if not self.atchunk: + self.atchunk = self.chunklentype() + if self.atchunk is None: + raise FormatError( + 'This PNG file has no IDAT chunks.') + if self.atchunk[1] == 'IDAT': + return + self.process_chunk(lenient=lenient) + + def chunklentype(self): + """Reads just enough of the input to determine the next + chunk's length and type, returned as a (*length*, *chunk_type*) pair + where *chunk_type* is a string. If there are no more chunks, ``None`` + is returned. + """ + x = self.file.read(8) + if not x: + return None + if len(x) != 8: + raise FormatError( + 'End of file whilst reading chunk length and type.') + length, chunk_type = struct.unpack('!I4s', x) + chunk_type = bytestostr(chunk_type) + if length > 2**31-1: + raise FormatError('Chunk %s is too large: %d.' % (chunk_type, + length)) + return length, chunk_type + + def process_chunk(self, lenient=False): + """ + Process the next chunk and its data. + + If the optional `lenient` argument evaluates to `True`, + checksum failures will raise warnings rather than exceptions. + """ + chunk_type, data = self.chunk(lenient=lenient) + method = '_process_' + chunk_type + m = getattr(self, method, None) + if m: + m(data) + + def _process_IHDR(self, data): + # http://www.w3.org/TR/PNG/#11IHDR + if len(data) != 13: + raise FormatError('IHDR chunk has incorrect length.') + (self.width, self.height, self.bitdepth, self.color_type, + self.compression, self.filter, + self.interlace) = struct.unpack("!2I5B", data) + + check_bitdepth_colortype(self.bitdepth, self.color_type) + + if self.compression != 0: + raise Error("unknown compression method %d" % self.compression) + if self.filter != 0: + raise FormatError("Unknown filter method %d," + " see http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters ." + % self.filter) + if self.interlace not in (0,1): + raise FormatError("Unknown interlace method %d," + " see http://www.w3.org/TR/2003/REC-PNG-20031110/#8InterlaceMethods ." + % self.interlace) + + # Derived values + # http://www.w3.org/TR/PNG/#6Colour-values + colormap = bool(self.color_type & 1) + greyscale = not (self.color_type & 2) + alpha = bool(self.color_type & 4) + color_planes = (3,1)[greyscale or colormap] + planes = color_planes + alpha + + self.colormap = colormap + self.greyscale = greyscale + self.alpha = alpha + self.color_planes = color_planes + self.planes = planes + self.psize = float(self.bitdepth)/float(8) * planes + if int(self.psize) == self.psize: + self.psize = int(self.psize) + self.row_bytes = int(math.ceil(self.width * self.psize)) + # Stores PLTE chunk if present, and is used to check + # chunk ordering constraints. + self.plte = None + # Stores tRNS chunk if present, and is used to check chunk + # ordering constraints. + self.trns = None + # Stores sbit chunk if present. + self.sbit = None + # If an sRGB chunk is present, rendering intent is updated + self.rendering_intent = None + + def _process_PLTE(self, data): + # http://www.w3.org/TR/PNG/#11PLTE + if self.plte: + warnings.warn("Multiple PLTE chunks present.") + self.plte = data + if len(data) % 3 != 0: + raise FormatError( + "PLTE chunk's length should be a multiple of 3.") + if len(data) > (2**self.bitdepth)*3: + raise FormatError("PLTE chunk is too long.") + if len(data) == 0: + raise FormatError("Empty PLTE is not allowed.") + + def _process_bKGD(self, data): + try: + if self.colormap: + if not self.plte: + warnings.warn( + "PLTE chunk is required before bKGD chunk.") + self.background = struct.unpack('B', data) + else: + self.background = struct.unpack("!%dH" % self.color_planes, + data) + except struct.error: + raise FormatError("bKGD chunk has incorrect length.") + + def _process_tRNS(self, data): + # http://www.w3.org/TR/PNG/#11tRNS + self.trns = data + if self.colormap: + if not self.plte: + warnings.warn("PLTE chunk is required before tRNS chunk.") + else: + if len(data) > len(self.plte)/3: + # Was warning, but promoted to Error as it + # would otherwise cause pain later on. + raise FormatError("tRNS chunk is too long.") + else: + if self.alpha: + raise FormatError( + "tRNS chunk is not valid with colour type %d." % + self.color_type) + try: + self.transparent = \ + struct.unpack("!%dH" % self.color_planes, data) + except struct.error: + raise FormatError("tRNS chunk has incorrect length.") + + def _process_gAMA(self, data): + try: + self.gamma = struct.unpack("!L", data)[0] / 100000.0 + except struct.error: + raise FormatError("gAMA chunk has incorrect length.") + + def _process_iCCP(self, data): + i = data.index(zerobyte) + self.icc_profile_name = data[:i] + compression = data[i:i + 1] + # TODO: Raise FormatError + assert (compression == zerobyte) + self.icc_profile = zlib.decompress(data[i + 2:]) + + def _process_sBIT(self, data): + self.sbit = data + if (self.colormap and len(data) != 3 or + not self.colormap and len(data) != self.planes): + raise FormatError("sBIT chunk has incorrect length.") + + def _process_sRGB(self, data): + self.rendering_intent, = struct.unpack('B', data) + + def _process_cHRM(self, data): + if len(data) != struct.calcsize("!8L"): + raise FormatError("cHRM chunk has incorrect length.") + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y = \ + tuple([value / 100000.0 for value in struct.unpack("!8L", data)]) + self.white_point = white_x, white_y + self.rgb_points = (red_x, red_y), (green_x, green_y), (blue_x, blue_y) + + def _process_tEXt(self, data): + # http://www.w3.org/TR/PNG/#11tEXt + i = data.index(zerobyte) + keyword = data[:i] + try: + keyword = str(keyword, 'latin-1') + except: + pass + self.text[keyword] = data[i + 1:].decode('latin-1') + + def _process_zTXt(self, data): + # http://www.w3.org/TR/PNG/#11zTXt + i = data.index(zerobyte) + keyword = data[:i] + try: + keyword = str(keyword, 'latin-1') + except: + pass + # TODO: Raise FormatError + assert data[i:i + 1] == zerobyte + text = zlib.decompress(data[i + 2:]).decode('latin-1') + self.text[keyword] = text + + def _process_iTXt(self, data): + # http://www.w3.org/TR/PNG/#11iTXt + i = data.index(zerobyte) + keyword = data[:i] + try: + keyword = str(keyword, 'latin-1') + except: + pass + if (data[i:i + 1] != zerobyte): + # TODO: Support for compression!! + return + # TODO: Raise FormatError + assert (data[i + 1:i + 2] == zerobyte) + data_ = data[i + 3:] + i = data_.index(zerobyte) + # skip language tag + data_ = data_[i + 1:] + i = data_.index(zerobyte) + # skip translated keyword + data_ = data_[i + 1:] + self.text[keyword] = data_.decode('utf-8') + + def _process_pHYs(self, data): + # http://www.w3.org/TR/PNG/#11pHYs + ppux, ppuy, unit = struct.unpack('!IIB', data) + self.resolution = ((ppux, ppuy), unit) + + def _process_tIME(self, data): + # http://www.w3.org/TR/PNG/#11tIME + fmt = "!H5B" + if len(data) != struct.calcsize(fmt): + raise FormatError("tIME chunk has incorrect length.") + self.last_mod_time = struct.unpack(fmt, data) + + def idat(self, lenient=False): + """Iterator that yields all the ``IDAT`` chunks as strings.""" + while True: + try: + chunk_type, data = self.chunk(lenient=lenient) + except ValueError: + e = sys.exc_info()[1] + raise ChunkError(e.args[0]) + if chunk_type == 'IEND': + # http://www.w3.org/TR/PNG/#11IEND + break + if chunk_type != 'IDAT': + continue + # chunk_type == 'IDAT' + # http://www.w3.org/TR/PNG/#11IDAT + if self.colormap and not self.plte: + warnings.warn("PLTE chunk is required before IDAT chunk") + yield data + + def idatdecomp(self, lenient=False, max_length=0): + """Iterator that yields decompressed ``IDAT`` strings.""" + # Currently, with no max_length paramter to decompress, this + # routine will do one yield per IDAT chunk. So not very + # incremental. + d = zlib.decompressobj() + # Each IDAT chunk is passed to the decompressor, then any + # remaining state is decompressed out. + for data in self.idat(lenient): + # :todo: add a max_length argument here to limit output + # size. + yield bytearray(d.decompress(data)) + yield bytearray(d.flush()) + + def read(self, lenient=False): + """ + Read the PNG file and decode it. + + Returns (`width`, `height`, `pixels`, `metadata`). + + May use excessive memory. + + `pixels` are returned in boxed row flat pixel format. + + If the optional `lenient` argument evaluates to True, + checksum failures will raise warnings rather than exceptions. + """ + self.preamble(lenient=lenient) + raw = self.idatdecomp(lenient) + + if self.interlace: + raw = bytearray(itertools.chain(*raw)) + arraycode = 'BH'[self.bitdepth > 8] + # Like :meth:`group` but producing an array.array object for + # each row. + pixels = map(lambda *row: array(arraycode, row), + *[iter(self.deinterlace(raw))]*self.width*self.planes) + else: + pixels = self.iterboxed(self.iterstraight(raw)) + meta = dict() + for attr in 'greyscale alpha planes bitdepth interlace'.split(): + meta[attr] = getattr(self, attr) + meta['size'] = (self.width, self.height) + for attr in ('gamma', 'transparent', 'background', 'last_mod_time', + 'icc_profile', 'icc_profile_name', 'resolution', 'text', + 'rendering_intent', 'white_point', 'rgb_points'): + a = getattr(self, attr, None) + if a is not None: + meta[attr] = a + if self.plte: + meta['palette'] = self.palette() + return self.width, self.height, pixels, meta + + def read_flat(self): + """ + Read a PNG file and decode it into flat row flat pixel format. + + Returns (*width*, *height*, *pixels*, *metadata*). + + May use excessive memory. + + `pixels` are returned in flat row flat pixel format. + + See also the :meth:`read` method which returns pixels in the + more stream-friendly boxed row flat pixel format. + """ + x, y, pixel, meta = self.read() + arraycode = 'BH'[meta['bitdepth'] > 8] + pixel = array(arraycode, itertools.chain(*pixel)) + return x, y, pixel, meta + + def palette(self, alpha='natural'): + """ + Returns a palette that is a sequence of 3-tuples or 4-tuples + + Synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These + chunks should have already been processed (for example, by + calling the :meth:`preamble` method). All the tuples are the + same size: 3-tuples if there is no ``tRNS`` chunk, 4-tuples when + there is a ``tRNS`` chunk. Assumes that the image is colour type + 3 and therefore a ``PLTE`` chunk is required. + + If the `alpha` argument is ``'force'`` then an alpha channel is + always added, forcing the result to be a sequence of 4-tuples. + """ + if not self.plte: + raise FormatError( + "Required PLTE chunk is missing in colour type 3 image.") + plte = group(bytearray(self.plte), 3) + if self.trns or alpha == 'force': + trns = bytearray(self.trns or strtobytes('')) + trns.extend([255]*(len(plte)-len(trns))) + plte = list(map(operator.add, plte, group(trns, 1))) + return plte + + def asDirect(self): + """Returns the image data as a direct representation of an + ``x * y * planes`` array. This method is intended to remove the + need for callers to deal with palettes and transparency + themselves. Images with a palette (colour type 3) + are converted to RGB or RGBA; images with transparency (a + ``tRNS`` chunk) are converted to LA or RGBA as appropriate. + When returned in this format the pixel values represent the + colour value directly without needing to refer to palettes or + transparency information. + + Like the :meth:`read` method this method returns a 4-tuple: + + (*width*, *height*, *pixels*, *meta*) + + This method normally returns pixel values with the bit depth + they have in the source image, but when the source PNG has an + ``sBIT`` chunk it is inspected and can reduce the bit depth of + the result pixels; pixel values will be reduced according to + the bit depth specified in the ``sBIT`` chunk (PNG nerds should + note a single result bit depth is used for all channels; the + maximum of the ones specified in the ``sBIT`` chunk. An RGB565 + image will be rescaled to 6-bit RGB666). + + The *meta* dictionary that is returned reflects the `direct` + format and not the original source image. For example, an RGB + source image with a ``tRNS`` chunk to represent a transparent + colour, will have ``planes=3`` and ``alpha=False`` for the + source image, but the *meta* dictionary returned by this method + will have ``planes=4`` and ``alpha=True`` because an alpha + channel is synthesized and added. + + *pixels* is the pixel data in boxed row flat pixel format (just + like the :meth:`read` method). + + All the other aspects of the image data are not changed. + """ + self.preamble() + # Simple case, no conversion necessary. + if not self.colormap and not self.trns and not self.sbit: + return self.read() + + x,y,pixels,meta = self.read() + + if self.colormap: + meta['colormap'] = False + meta['alpha'] = bool(self.trns) + meta['bitdepth'] = 8 + meta['planes'] = 3 + bool(self.trns) + plte = self.palette() + def iterpal(pixels): + for row in pixels: + row = [plte[i] for i in row] + yield bytearray(itertools.chain(*row)) + pixels = iterpal(pixels) + elif self.trns: + # It would be nice if there was some reasonable way + # of doing this without generating a whole load of + # intermediate tuples. But tuples does seem like the + # easiest way, with no other way clearly much simpler or + # much faster. (Actually, the L to LA conversion could + # perhaps go faster (all those 1-tuples!), but I still + # wonder whether the code proliferation is worth it) + it = self.transparent + maxval = 2**meta['bitdepth']-1 + planes = meta['planes'] + meta['alpha'] = True + meta['planes'] += 1 + if meta['bitdepth'] > 8: + def wrap_array(row): + return array('H', row) + else: + wrap_array = bytearray + + def itertrns(pixels): + for row in pixels: + # For each row we group it into pixels, then form a + # characterisation vector that says whether each + # pixel is opaque or not. Then we convert + # True/False to 0/maxval (by multiplication), + # and add it as the extra channel. + row = group(row, planes) + opa = [maxval * (it != i) for i in row] + opa = zip(opa) # convert to 1-tuples + yield wrap_array(itertools.chain(*list(map(operator.add, + row, opa)))) + pixels = itertrns(pixels) + targetbitdepth = None + if self.sbit: + sbit = struct.unpack('%dB' % len(self.sbit), self.sbit) + targetbitdepth = max(sbit) + if targetbitdepth > meta['bitdepth']: + raise Error('sBIT chunk %r exceeds bitdepth %d' % + (sbit,self.bitdepth)) + if min(sbit) <= 0: + raise Error('sBIT chunk %r has a 0-entry' % sbit) + if targetbitdepth == meta['bitdepth']: + targetbitdepth = None + if targetbitdepth: + shift = meta['bitdepth'] - targetbitdepth + meta['bitdepth'] = targetbitdepth + def itershift(pixels): + for row in pixels: + yield array('BH'[targetbitdepth > 8], + [it >> shift for it in row]) + pixels = itershift(pixels) + return x,y,pixels,meta + + def asFloat(self, maxval=1.0): + """Return image pixels as per :meth:`asDirect` method, but scale + all pixel values to be floating point values between 0.0 and + *maxval*. + """ + x,y,pixels,info = self.asDirect() + sourcemaxval = 2**info['bitdepth']-1 + del info['bitdepth'] + info['maxval'] = float(maxval) + factor = float(maxval)/float(sourcemaxval) + def iterfloat(): + for row in pixels: + yield [factor * it for it in row] + return x,y,iterfloat(),info + + def _as_rescale(self, get, targetbitdepth): + """Helper used by :meth:`asRGB8` and :meth:`asRGBA8`.""" + width,height,pixels,meta = get() + maxval = 2**meta['bitdepth'] - 1 + targetmaxval = 2**targetbitdepth - 1 + factor = float(targetmaxval) / float(maxval) + meta['bitdepth'] = targetbitdepth + + def iterscale(rows): + for row in rows: + yield array('BH'[targetbitdepth > 8], + [int(round(x * factor)) for x in row]) + if maxval == targetmaxval: + return width, height, pixels, meta + else: + if 'transparent' in meta: + transparent = meta['transparent'] + if isinstance(transparent, tuple): + transparent = tuple(list( + iterscale((transparent,)) + )[0]) + else: + transparent = tuple(list( + iterscale(((transparent,),)) + )[0])[0] + meta['transparent'] = transparent + return width, height, iterscale(pixels), meta + + def asRGB8(self): + """ + Return the image data as an RGB pixels with 8-bits per sample. + + This is like the :meth:`asRGB` method except that + this method additionally rescales the values so that they + are all between 0 and 255 (8-bit). In the case where the + source image has a bit depth < 8 the transformation preserves + all the information; where the source image has bit depth + > 8, then rescaling to 8-bit values loses precision. No + dithering is performed. Like :meth:`asRGB`, an alpha channel + in the source image will raise an exception. + + This function returns a 4-tuple: + (*width*, *height*, *pixels*, *metadata*). + *width*, *height*, *metadata* are as per the + :meth:`read` method. + + *pixels* is the pixel data in boxed row flat pixel format. + """ + return self._as_rescale(self.asRGB, 8) + + def asRGBA8(self): + """ + Return the image data as RGBA pixels with 8-bits per sample. + + This method is similar to :meth:`asRGB8` and + :meth:`asRGBA`: The result pixels have an alpha channel, *and* + values are rescaled to the range 0 to 255. The alpha channel is + synthesized if necessary (with a small speed penalty). + """ + return self._as_rescale(self.asRGBA, 8) + + def asRGB(self): + """ + Return image as RGB pixels. + + RGB colour images are passed through unchanged; + greyscales are expanded into RGB triplets + (there is a small speed overhead for doing this). + + An alpha channel in the source image will raise an exception. + + The return values are as for the :meth:`read` method + except that the *metadata* reflect the returned pixels, not the + source image. In particular, for this method + ``metadata['greyscale']`` will be ``False``. + """ + width,height,pixels,meta = self.asDirect() + if meta['alpha']: + raise Error("will not convert image with alpha channel to RGB") + if not meta['greyscale']: + return width,height,pixels,meta + meta['greyscale'] = False + newarray = (newBarray, newHarray)[meta['bitdepth'] > 8] + + def iterrgb(): + for row in pixels: + a = newarray(3 * width) + for i in range(3): + a[i::3] = row + yield a + return width,height,iterrgb(),meta + + def asRGBA(self): + """ + Return image as RGBA pixels. + + Greyscales are expanded into RGB triplets; + an alpha channel is synthesized if necessary. + The return values are as for the :meth:`read` method + except that the *metadata* reflect the returned pixels, not the + source image. In particular, for this method + ``metadata['greyscale']`` will be ``False``, and + ``metadata['alpha']`` will be ``True``. + """ + width,height,pixels,meta = self.asDirect() + if meta['alpha'] and not meta['greyscale']: + return width,height,pixels,meta + maxval = 2**meta['bitdepth'] - 1 + if meta['bitdepth'] > 8: + def newarray(): + return array('H', [maxval] * 4 * width) + else: + def newarray(): + return bytearray([maxval] * 4 * width) + + # Not best way, but we have only array of bytes accelerated now + if meta['bitdepth'] <= 8: + filt = BaseFilter() + else: + filt = iBaseFilter() + + if meta['alpha'] and meta['greyscale']: + # LA to RGBA + def convert(): + for row in pixels: + # Create a fresh target row, then copy L channel + # into first three target channels, and A channel + # into fourth channel. + a = newarray() + filt.convert_la_to_rgba(row, a) + yield a + elif meta['greyscale']: + # L to RGBA + def convert(): + for row in pixels: + a = newarray() + filt.convert_l_to_rgba(row, a) + yield a + else: + assert not meta['alpha'] and not meta['greyscale'] + # RGB to RGBA + def convert(): + for row in pixels: + a = newarray() + filt.convert_rgb_to_rgba(row, a) + yield a + meta['alpha'] = True + meta['greyscale'] = False + return width,height,convert(),meta + + +def check_bitdepth_colortype(bitdepth, colortype): + """ + Check that `bitdepth` and `colortype` are both valid, + and specified in a valid combination. Returns if valid, + raise an Exception if not valid. + """ + if bitdepth not in (1,2,4,8,16): + raise FormatError("invalid bit depth %d" % bitdepth) + if colortype not in (0,2,3,4,6): + raise FormatError("invalid colour type %d" % colortype) + # Check indexed (palettized) images have 8 or fewer bits + # per pixel; check only indexed or greyscale images have + # fewer than 8 bits per pixel. + if colortype & 1 and bitdepth > 8: + raise FormatError( + "Indexed images (colour type %d) cannot" + " have bitdepth > 8 (bit depth %d)." + " See http://www.w3.org/TR/2003/REC-PNG-20031110/#table111 ." + % (bitdepth, colortype)) + if bitdepth < 8 and colortype not in (0,3): + raise FormatError("Illegal combination of bit depth (%d)" + " and colour type (%d)." + " See http://www.w3.org/TR/2003/REC-PNG-20031110/#table111 ." + % (bitdepth, colortype)) + + +def isinteger(x): + """Check if `x` is platform native integer""" + try: + return int(x) == x + except (TypeError, ValueError): + return False + + +# === Legacy Version Support === + +# In order to work on Python 2.3 we fix up a recurring annoyance involving +# the array type. In Python 2.3 an array cannot be initialised with an +# array, and it cannot be extended with a list (or other sequence). +# Both of those are repeated issues in the code. Whilst I would not +# normally tolerate this sort of behaviour, here we "shim" a replacement +# for array into place (and hope no-one notices). You never read this. + +try: + array('B').extend([]) + array('B', array('B')) +except TypeError: + # Expect to get here on Python 2.3 + class _array_shim(array): + true_array = array + + def __new__(cls, typecode, init=None): + super_new = super(_array_shim, cls).__new__ + it = super_new(cls, typecode) + if init is None: + return it + it.extend(init) + return it + + def extend(self, extension): + super_extend = super(_array_shim, self).extend + if isinstance(extension, self.true_array): + return super_extend(extension) + if not isinstance(extension, (list, str)): + # Convert to list. Allows iterators to work. + extension = list(extension) + return super_extend(self.true_array(self.typecode, extension)) + array = _array_shim + + # Original array initialisation is faster but multiplication change class + def newBarray(length=0): + return array('B', [0] * length) + + def newHarray(length=0): + return array('H', [0] * length) + +# === Command Line Support === + +def read_pam_header(infile): + """ + Read (the rest of a) PAM header. + + `infile` should be positioned + immediately after the initial 'P7' line (at the beginning of the + second line). Returns are as for `read_pnm_header`. + """ + # Unlike PBM, PGM, and PPM, we can read the header a line at a time. + header = dict() + while True: + l = infile.readline().strip() + if l == strtobytes('ENDHDR'): + break + if not l: + raise EOFError('PAM ended prematurely') + if l[0] == strtobytes('#'): + continue + l = l.split(None, 1) + if l[0] not in header: + header[l[0]] = l[1] + else: + header[l[0]] += strtobytes(' ') + l[1] + + required = ['WIDTH', 'HEIGHT', 'DEPTH', 'MAXVAL'] + required = [strtobytes(x) for x in required] + WIDTH,HEIGHT,DEPTH,MAXVAL = required + present = [x for x in required if x in header] + if len(present) != len(required): + raise Error('PAM file must specify WIDTH, HEIGHT, DEPTH, and MAXVAL') + width = int(header[WIDTH]) + height = int(header[HEIGHT]) + depth = int(header[DEPTH]) + maxval = int(header[MAXVAL]) + if (width <= 0 or + height <= 0 or + depth <= 0 or + maxval <= 0): + raise Error( + 'WIDTH, HEIGHT, DEPTH, MAXVAL must all be positive integers') + return 'P7', width, height, depth, maxval + + +def read_pnm_header(infile, supported=('P5','P6')): + """ + Read a PNM header, returning (format,width,height,depth,maxval). + + `width` and `height` are in pixels. `depth` is the number of + channels in the image; for PBM and PGM it is synthesized as 1, for + PPM as 3; for PAM images it is read from the header. `maxval` is + synthesized (as 1) for PBM images. + """ + # Generally, see http://netpbm.sourceforge.net/doc/ppm.html + # and http://netpbm.sourceforge.net/doc/pam.html + supported = [strtobytes(x) for x in supported] + + # Technically 'P7' must be followed by a newline, so by using + # rstrip() we are being liberal in what we accept. I think this + # is acceptable. + type = infile.read(3).rstrip() + if type not in supported: + raise NotImplementedError('file format %s not supported' % type) + if type == strtobytes('P7'): + # PAM header parsing is completely different. + return read_pam_header(infile) + # Expected number of tokens in header (3 for P4, 4 for P6) + expected = 4 + pbm = ('P1', 'P4') + if type in pbm: + expected = 3 + header = [type] + + # We have to read the rest of the header byte by byte because the + # final whitespace character (immediately following the MAXVAL in + # the case of P6) may not be a newline. Of course all PNM files in + # the wild use a newline at this point, so it's tempting to use + # readline; but it would be wrong. + def getc(): + c = infile.read(1) + if not c: + raise Error('premature EOF reading PNM header') + return c + + c = getc() + while True: + # Skip whitespace that precedes a token. + while c.isspace(): + c = getc() + # Skip comments. + while c == '#': + while c not in '\n\r': + c = getc() + if not c.isdigit(): + raise Error('unexpected character %s found in header' % c) + # According to the specification it is legal to have comments + # that appear in the middle of a token. + # This is bonkers; I've never seen it; and it's a bit awkward to + # code good lexers in Python (no goto). So we break on such + # cases. + token = bytes() + while c.isdigit(): + token += c + c = getc() + # Slight hack. All "tokens" are decimal integers, so convert + # them here. + header.append(int(token)) + if len(header) == expected: + break + # Skip comments (again) + while c == '#': + while c not in '\n\r': + c = getc() + if not c.isspace(): + raise Error('expected header to end with whitespace, not %s' % c) + + if type in pbm: + # synthesize a MAXVAL + header.append(1) + depth = (1,3)[type == strtobytes('P6')] + return header[0], header[1], header[2], depth, header[3] + + +def write_pnm(file, width, height, pixels, meta): + """Write a Netpbm PNM/PAM file.""" + bitdepth = meta['bitdepth'] + maxval = 2**bitdepth - 1 + # Rudely, the number of image planes can be used to determine + # whether we are L (PGM), LA (PAM), RGB (PPM), or RGBA (PAM). + planes = meta['planes'] + # Can be an assert as long as we assume that pixels and meta came + # from a PNG file. + assert planes in (1,2,3,4) + if planes in (1,3): + if 1 == planes: + # PGM + # Could generate PBM if maxval is 1, but we don't (for one + # thing, we'd have to convert the data, not just blat it + # out). + fmt = 'P5' + else: + # PPM + fmt = 'P6' + header = '%s %d %d %d\n' % (fmt, width, height, maxval) + if planes in (2,4): + # PAM + # See http://netpbm.sourceforge.net/doc/pam.html + if 2 == planes: + tupltype = 'GRAYSCALE_ALPHA' + else: + tupltype = 'RGB_ALPHA' + header = ('P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\n' + 'TUPLTYPE %s\nENDHDR\n' % + (width, height, planes, maxval, tupltype)) + file.write(strtobytes(header)) + # Values per row + vpr = planes * width + # struct format + fmt = '>%d' % vpr + if maxval > 0xff: + fmt = fmt + 'H' + else: + fmt = fmt + 'B' + for row in pixels: + file.write(struct.pack(fmt, *row)) + file.flush() + +def color_triple(color): + """ + Convert a command line colour value to a RGB triple of integers. + FIXME: Somewhere we need support for greyscale backgrounds etc. + """ + if color.startswith('#') and len(color) == 4: + return (int(color[1], 16), + int(color[2], 16), + int(color[3], 16)) + if color.startswith('#') and len(color) == 7: + return (int(color[1:3], 16), + int(color[3:5], 16), + int(color[5:7], 16)) + elif color.startswith('#') and len(color) == 13: + return (int(color[1:5], 16), + int(color[5:9], 16), + int(color[9:13], 16)) + +def _add_common_options(parser): + """Call *parser.add_option* for each of the options that are + common between this PNG--PNM conversion tool and the gen + tool. + """ + parser.add_option("-i", "--interlace", + default=False, action="store_true", + help="create an interlaced PNG file (Adam7)") + parser.add_option("-t", "--transparent", + action="store", type="string", metavar="#RRGGBB", + help="mark the specified colour as transparent") + parser.add_option("-b", "--background", + action="store", type="string", metavar="#RRGGBB", + help="save the specified background colour") + parser.add_option("-g", "--gamma", + action="store", type="float", metavar="value", + help="save the specified gamma value") + parser.add_option("-c", "--compression", + action="store", type="int", metavar="level", + help="zlib compression level (0-9)") + return parser diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index ed30491a..ef9298a8 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -21,83 +21,110 @@ import re import urllib import urllib2 +import base64 +import math +from lib import png from urlresolver import common -from lib.aa_decoder import AADecoder from urlresolver.resolver import ResolverError net = common.Net() -def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"): - return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) - -def conv(s): - match = re.search('toString\([^\d]*(\d+)', s) - add = int(match.group(1)) if match else 0 - - match = re.search('{function\s+(.*?)\(', s) - func_name = match.group(1) if match else 'unknown' - - common.log_utils.log('|%s| |%s|' % (add, func_name)) - s = s.replace(' ', '') - match = re.search('}return(.*)', s) - if match: - s = match.group(1) - - result = '' - for part in s.split('+'): - common.log_utils.log(part) - if part.startswith(func_name): - match = re.search('\(\s*(\d+)\s*,\s*(\d+)\s*\)', part) - if match: - a, b = match.groups() - a = int(a) + add - result += baseN(int(b), a) - elif part[0] == '"' and part[-1] == '"': - result += part[1:-1] - else: - common.log_utils.log('Unrecognized Part: %s' % (part)) - - common.log_utils.log(result) - return result - def get_media_url(url): try: - headers = {'User-Agent': common.FF_USER_AGENT} - html = net.http_GET(url, headers=headers).content - if isinstance(html, unicode): - html = html.encode('utf-8') - decodes = [AADecoder(match.group(1)).decode() for match in re.finditer(']+>(゚ω゚ノ[^<]+)<', html, re.DOTALL)] - if not decodes: - raise ResolverError('No Encoded Section Found. Deleted?') - - common.log_utils.log(decodes) - enc_index = 0 - for text in decodes: - match = re.search('welikekodi_ya_rly\s*=\s*(.*?)([0-9/\*\-\+ ]+)', text) - if match: - enc_index = eval(match.group(2)) - if 'round' in match.group(1): - enc_index = int(round(enc_index)) - - common.log_utils.log('chosen encode: %s' % (decodes[enc_index])) - match = re.search('window\..+?=(.*?);', decodes[enc_index]) - if not match: - match = re.search('.*attr\(\"href\",\((.*)', decodes[enc_index]) - - if match: - common.log_utils.log('to conv: %s' % (match.group(1))) - dtext = conv(match.group(1)) - if dtext.lower().startswith('//'): - dtext = 'http:' + dtext - dtext = dtext.replace('https', 'http') - request = urllib2.Request(dtext, None, headers) - response = urllib2.urlopen(request) - url = response.geturl() - response.close() + HTTP_HEADER = { + 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', + 'Accept-Encoding': 'none', + 'Accept-Language': 'en-US,en;q=0.8', + 'Referer': url} # 'Connection': 'keep-alive' + + data = net.http_GET(url, headers=HTTP_HEADER).content + + # If you want to use the code for openload please at least put the info from were you take it: + # for example: "Code take from plugin IPTVPlayer: "https://gitlab.com/iptvplayer-for-e2/iptvplayer-for-e2/" + # It will be very nice if you send also email to me samsamsam@o2.pl and inform were this code will be used + + # get image data + imageData = re.search(''']*?id="linkimg"[^>]*?src="([^"]+?)"''', data, re.IGNORECASE).group(1) + + imageData = base64.b64decode(imageData.split('base64,')[-1]) + _x, _y, pixel, _meta = png.Reader(bytes=imageData).read() + + imageData = None + imageStr = '' + try: + for item in pixel: + for p in item: + # common.log_utils.log_notice('openload resolve : 1.7 %s' % p) + imageStr += chr(p) + except: + pass + + # split image data + imageTabs = [] + i = -1 + for idx in range(len(imageStr)): + if imageStr[idx] == '\0': + break + if 0 == (idx % (12 * 20)): + imageTabs.append([]) + i += 1 + j = -1 + if 0 == (idx % (20)): + imageTabs[i].append([]) + j += 1 + imageTabs[i][j].append(imageStr[idx]) + + # get signature data + # sts, data = self.cm.getPage('https://openload.co/assets/js/obfuscator/numbers.js', {'header': HTTP_HEADER}) + data = net.http_GET('https://openload.co/assets/js/obfuscator/numbers.js', headers=HTTP_HEADER).content + + signStr = re.search('''['"]([^"^']+?)['"]''', data, re.IGNORECASE).group(1) + + # split signature data + signTabs = [] + i = -1 + for idx in range(len(signStr)): + if signStr[idx] == '\0': + break + if 0 == (idx % (11 * 26)): + signTabs.append([]) + i += 1 + j = -1 + if 0 == (idx % (26)): + signTabs[i].append([]) + j += 1 + signTabs[i][j].append(signStr[idx]) + + # get link data + linkData = {} + for i in [2, 3, 5, 7]: + linkData[i] = [] + tmp = ord('c') + for j in range(len(signTabs[i])): + for k in range(len(signTabs[i][j])): + if tmp > 122: + tmp = ord('b') + if signTabs[i][j][k] == chr(int(math.floor(tmp))): + if len(linkData[i]) > j: + continue + tmp += 2.5 + if k < len(imageTabs[i][j]): + linkData[i].append(imageTabs[i][j][k]) + res = [] + for idx in linkData: + res.append(''.join(linkData[idx]).replace(',', '')) + res = res[3] + '~' + res[1] + '~' + res[2] + '~' + res[0] + videoUrl = 'https://openload.co/stream/{0}?mime=true'.format(res) + dtext = videoUrl.replace('https', 'http') + request = urllib2.Request(dtext, None, HTTP_HEADER) + response = urllib2.urlopen(request) + url = response.geturl() + response.close() url += '|' + urllib.urlencode({'Referer': url, 'User-Agent': common.IOS_USER_AGENT}) return url - except Exception as e: common.log_utils.log_debug('Exception during openload resolve parse: %s' % e) raise From 5b255a6f98a3f29a83e9af589623d197a3fb7ef5 Mon Sep 17 00:00:00 2001 From: tknorris Date: Sun, 31 Jul 2016 14:34:09 -0400 Subject: [PATCH 1040/1360] Bump to 3.0.16 --- addon.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.xml b/addon.xml index 0fc32380..7977d525 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + From d2cfe8100ca9a9e6e98c0c1a17ea2bf78c374e1c Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Fri, 5 Aug 2016 12:10:46 +1200 Subject: [PATCH 1041/1360] Resolver fixes Fixes for megamp4, mersalaayitten and speedplay --- lib/urlresolver/plugins/megamp4.py | 2 +- lib/urlresolver/plugins/mersalaayitten.py | 9 +++++---- lib/urlresolver/plugins/speedplay.py | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/urlresolver/plugins/megamp4.py b/lib/urlresolver/plugins/megamp4.py index fadb05da..f2742d55 100644 --- a/lib/urlresolver/plugins/megamp4.py +++ b/lib/urlresolver/plugins/megamp4.py @@ -32,7 +32,7 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - if 'Not Found' in html: + if 'was deleted' in html: raise ResolverError('File Removed') link = re.search('file:"(.*?)",', html) diff --git a/lib/urlresolver/plugins/mersalaayitten.py b/lib/urlresolver/plugins/mersalaayitten.py index c111a99f..5bc9fa27 100644 --- a/lib/urlresolver/plugins/mersalaayitten.py +++ b/lib/urlresolver/plugins/mersalaayitten.py @@ -22,8 +22,8 @@ class MersalaResolver(UrlResolver): name = "mersalaayitten.com" - domains = ["mersalaayitten.com"] - pattern = '(?://|\.)(mersalaayitten\.com)/embed/([0-9]+)' + domains = ["mersalaayitten.com", "mersalaayitten.co"] + pattern = '(?://|\.)(mersalaayitten\.(?:com|co))/embed/([0-9]+)' def __init__(self): self.net = common.Net() @@ -36,7 +36,7 @@ def get_media_url(self, host, media_id): r = re.search("config: '(.*?)'", html) if r: stream_xml = r.group(1) - referer = {'Referer': 'http://mersalaayitten.com/media/nuevo/player.swf'} + referer = {'Referer': 'http://mersalaayitten.co/media/nuevo/player.swf'} response = self.net.http_GET(stream_xml, headers=referer) xmlhtml = response.content r2 = re.search('(.*?)', xmlhtml) @@ -48,4 +48,5 @@ def get_media_url(self, host, media_id): return stream_url def get_url(self, host, media_id): - return 'http://mersalaayitten.com/embed/%s' % (media_id) + return 'http://mersalaayitten.co/embed/%s' % (media_id) + diff --git a/lib/urlresolver/plugins/speedplay.py b/lib/urlresolver/plugins/speedplay.py index f958d9b4..df25bbaa 100644 --- a/lib/urlresolver/plugins/speedplay.py +++ b/lib/urlresolver/plugins/speedplay.py @@ -22,8 +22,9 @@ class SpeedPlayResolver(UrlResolver): name = "speedplay.xyz" - domains = ["speedplay.xyz", "speedplay.us", "speedplay3.pw"] - pattern = '(?://|\.)(speedplay[0-9]?\.(?:us|xyz|pw))/(?:embed-)?([0-9a-zA-Z]+)' + domains = ["speedplay.xyz", "speedplay.us", "speedplay1.site", + "speedplay.pw", "speedplay3.pw"] + pattern = '(?://|\.)(speedplay[0-9]?\.(?:us|xyz|pw|site))/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() @@ -50,3 +51,4 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://%s/%s.html' % (host, media_id) + From b9a99fb94c8c3029c7b8afdafab6223d230de7f9 Mon Sep 17 00:00:00 2001 From: Gujal00 Date: Fri, 5 Aug 2016 23:39:00 +1200 Subject: [PATCH 1042/1360] 1 fix, 1 new resolver Flashx resolver rewrite to avoid kodi detection New resolver Youlol --- lib/urlresolver/plugins/flashx.py | 47 ++++++++++++++++++--------- lib/urlresolver/plugins/youlol.py | 53 +++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 15 deletions(-) create mode 100644 lib/urlresolver/plugins/youlol.py diff --git a/lib/urlresolver/plugins/flashx.py b/lib/urlresolver/plugins/flashx.py index 1363f0fe..c2f37eb1 100644 --- a/lib/urlresolver/plugins/flashx.py +++ b/lib/urlresolver/plugins/flashx.py @@ -1,6 +1,7 @@ """ Kodi urlresolver plugin Copyright (C) 2014 smokdpi + Updated by Gujal (c) 2016 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +17,7 @@ along with this program. If not, see . """ -import re +import re, time from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -31,22 +32,38 @@ def __init__(self): 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('href="([^"]+)', html) - if r: - web_url = r.group(1) - html = self.net.http_GET(web_url).content - - try: html = jsunpack.unpack(re.search('(eval\(function.*?)', html, re.DOTALL).group(1)) - except: pass - - stream = re.findall('file\s*:\s*"(http.*?)"\s*,\s*label\s*:\s*"', html, re.DOTALL) + resp = self.net.http_GET(web_url) + html = resp.content + cfdcookie = resp._response.info()['set-cookie'] + cfduid = re.search('cfduid=(.*?);', cfdcookie).group(1) + file_id = re.search("'file_id', '(.*?)'", html).group(1) + aff = re.search("'aff', '(.*?)'", html).group(1) + headers = { 'Referer': web_url, + 'Cookie': '__cfduid=' + cfduid + '; lang=1'} + surl = 'http://www.flashx.tv/code.js?c=' + file_id + dummy = self.net.http_GET(url=surl, headers=headers).content + headers = { 'Referer': web_url, + 'Cookie': '__cfduid=' + cfduid + '; lang=1; file_id=' + file_id + '; aff=' + aff } + html = self.net.http_GET(url=web_url, headers=headers).content + fname = re.search('name="fname" value="(.*?)"', html).group(1) + hash = re.search('name="hash" value="(.*?)"', html).group(1) + fdata = { 'op': 'download1', + 'usr_login': '', + 'id': media_id, + 'fname': fname, + 'referer': '', + 'hash': hash, + 'imhuman': 'Proceed to video' } + furl = 'http://www.flashx.tv/dl?' + media_id + time.sleep(5) + html = self.net.http_POST(url=furl, form_data=fdata, headers=headers).content + strhtml = jsunpack.unpack(re.search('(eval\(function.*?)', html, re.DOTALL).group(1)) + stream = re.search('file:"([^"]*)",label', strhtml).group(1) if stream: - return stream[-1] + return stream else: - raise ResolverError('Unable to resolve Flashx link. Filelink not found.') + raise ResolverError('Filelink not found.') def get_url(self, host, media_id): - return 'http://www.flashx.tv/embed-%s.html' % media_id + return 'http://www.flashx.tv/%s.html' % media_id diff --git a/lib/urlresolver/plugins/youlol.py b/lib/urlresolver/plugins/youlol.py new file mode 100644 index 00000000..4b827fc2 --- /dev/null +++ b/lib/urlresolver/plugins/youlol.py @@ -0,0 +1,53 @@ +''' + urlresolver Kodi plugin + Copyright (C) 2016 Gujal + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +''' + +import re +from urlresolver import common +from urlresolver.resolver import UrlResolver, ResolverError + +class YouLOLResolver(UrlResolver): + name = "youlol.biz" + domains = ["youlol.biz"] + pattern = '(?://|\.)(youlol\.biz)/(?:embed-)?([0-9a-zA-Z]+)' + + def __init__(self): + self.net = common.Net() + + def get_media_url(self, host, media_id): + web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + if 'Not Found' in html: + raise ResolverError('File Removed') + + if 'Video is processing' in html: + raise ResolverError('File still being processed') + + link = re.search('(?:m3u8").*?"(.*?)"', html) + if link: + return link.group(1) + + link = re.search('file:"(.*?)",', html) + if link: + return link.group(1) + + raise ResolverError('Unable to find youlol video') + + def get_url(self, host, media_id): + return 'http://%s/%s.html' % (host, media_id) + From 650f4da8649929aedde8b4346c120d80474482db Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 6 Aug 2016 17:49:59 -0400 Subject: [PATCH 1043/1360] update js name --- lib/urlresolver/plugins/ol_gmu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/ol_gmu.py b/lib/urlresolver/plugins/ol_gmu.py index ef9298a8..42058a08 100644 --- a/lib/urlresolver/plugins/ol_gmu.py +++ b/lib/urlresolver/plugins/ol_gmu.py @@ -78,7 +78,7 @@ def get_media_url(url): # get signature data # sts, data = self.cm.getPage('https://openload.co/assets/js/obfuscator/numbers.js', {'header': HTTP_HEADER}) - data = net.http_GET('https://openload.co/assets/js/obfuscator/numbers.js', headers=HTTP_HEADER).content + data = net.http_GET('https://openload.co/assets/js/obfuscator/n.js', headers=HTTP_HEADER).content signStr = re.search('''['"]([^"^']+?)['"]''', data, re.IGNORECASE).group(1) From 70bff056f523474f0e969eb77cfbde3f5a4056e1 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Tue, 9 Aug 2016 21:51:25 -0400 Subject: [PATCH 1044/1360] Update thevideo.py --- lib/urlresolver/plugins/thevideo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/thevideo.py b/lib/urlresolver/plugins/thevideo.py index 6e83f530..c6a4f158 100644 --- a/lib/urlresolver/plugins/thevideo.py +++ b/lib/urlresolver/plugins/thevideo.py @@ -48,7 +48,7 @@ def get_media_url(self, host, media_id): best_stream_url = stream_url max_quality = int(quality) if best_stream_url: - return best_stream_url + return '%s%s' % (best_stream_url, '?direct=false&ua=1&vt=1') else: raise ResolverError('Unable to locate link') From 6d426cd6f42d6553bcb6bcee863f7278d434c428 Mon Sep 17 00:00:00 2001 From: jsergio123 Date: Thu, 11 Aug 2016 15:36:34 -0400 Subject: [PATCH 1045/1360] Update nowvideo.py --- lib/urlresolver/plugins/nowvideo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/nowvideo.py b/lib/urlresolver/plugins/nowvideo.py index 107f0a0e..276978e9 100644 --- a/lib/urlresolver/plugins/nowvideo.py +++ b/lib/urlresolver/plugins/nowvideo.py @@ -51,7 +51,7 @@ def get_media_url(self, host, media_id): else: raise ResolverError('File Not Found or removed') - return stream_url + return '%s%s%s' % (stream_url, '?client=FLASH', '|referer=http://embed.nowvideo.sx/player/cloudplayer.swf') def get_url(self, host, media_id): return 'http://embed.nowvideo.sx/embed/?v=%s' % media_id From 2f8483af57aa62accd7e750a2698d917f6fb0455 Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 13 Aug 2016 18:16:34 -0400 Subject: [PATCH 1046/1360] merge lambda's fixes --- lib/urlresolver/plugins/cloudzilla.py | 8 ++++++ lib/urlresolver/plugins/idowatch.py | 16 ++++++++---- lib/urlresolver/plugins/megamp4.py | 12 ++++++++- lib/urlresolver/plugins/mp4stream.py | 9 ++++++- lib/urlresolver/plugins/nosvideo.py | 26 ++++++------------- lib/urlresolver/plugins/rapidvideocom.py | 27 ++++++++++++-------- lib/urlresolver/plugins/rutube.py | 31 +++++------------------ lib/urlresolver/plugins/sharesix.py | 9 ++++--- lib/urlresolver/plugins/videobee.py | 11 +++++++- lib/urlresolver/plugins/vidup_me.py | 32 +++++++++++------------- 10 files changed, 98 insertions(+), 83 deletions(-) diff --git a/lib/urlresolver/plugins/cloudzilla.py b/lib/urlresolver/plugins/cloudzilla.py index 15f80a95..19e02a2f 100644 --- a/lib/urlresolver/plugins/cloudzilla.py +++ b/lib/urlresolver/plugins/cloudzilla.py @@ -17,6 +17,7 @@ """ import re +from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -31,6 +32,13 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content + + js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) + + for i in js_data: + try: html += jsunpack.unpack(i) + except: pass + match = re.search('vurl\s*=\s*"([^"]+)', html) if match: return match.group(1) diff --git a/lib/urlresolver/plugins/idowatch.py b/lib/urlresolver/plugins/idowatch.py index 97777c2d..8b86b3ba 100644 --- a/lib/urlresolver/plugins/idowatch.py +++ b/lib/urlresolver/plugins/idowatch.py @@ -17,6 +17,8 @@ """ import re +import urllib +from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -35,12 +37,16 @@ def get_media_url(self, host, media_id): if 'File Not Found' in html: raise ResolverError('File Removed') - match = re.search('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html, re.DOTALL) + try: html += jsunpack.unpack(re.search('(eval\(function.*?)', html, re.DOTALL).group(1)) + except: pass + + match = re.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html) + if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match.group(1), re.DOTALL): - stream_url = match.group(1) - if not stream_url.endswith('smil'): - return match.group(1) + '|User-Agent=%s' % (common.FF_USER_AGENT) + stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) + stream_url = [i for i in stream_url if not i.endswith('smil')] + if stream_url: + return stream_url[0] + '|' + urllib.urlencode({'User-Agent': common.FF_USER_AGENT}) raise ResolverError('Unable to resolve idowatch link. Filelink not found.') diff --git a/lib/urlresolver/plugins/megamp4.py b/lib/urlresolver/plugins/megamp4.py index f2742d55..2bcccd23 100644 --- a/lib/urlresolver/plugins/megamp4.py +++ b/lib/urlresolver/plugins/megamp4.py @@ -17,24 +17,34 @@ ''' import re +from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError class MegaMP4Resolver(UrlResolver): name = "megamp4.net" domains = ["megamp4.net"] - pattern = '(?://|\.)(megamp4\.net)/(?:embed-|emb\.html\?)([0-9a-zA-Z]+)' + pattern = '(?://|\.)(megamp4\.net)/(?:embed-|emb\.html\?|)([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content if 'was deleted' in html: raise ResolverError('File Removed') + + js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) + + for i in js_data: + try: html += jsunpack.unpack(i) + except: pass + + link = re.search('file:"(.*?)",', html) if link: return link.group(1) diff --git a/lib/urlresolver/plugins/mp4stream.py b/lib/urlresolver/plugins/mp4stream.py index e55727c4..28592599 100644 --- a/lib/urlresolver/plugins/mp4stream.py +++ b/lib/urlresolver/plugins/mp4stream.py @@ -33,8 +33,15 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - response = self.net.http_GET(web_url) + headers = { + 'Host': 'mp4stream.com', + 'Referer': 'http://mp4stream.com' + } + + response = self.net.http_GET(web_url, headers=headers) + html = response.content + headers = dict(response._response.info().items()) r = re.search('sources\s*:\s*(\[.*?\])', html, re.DOTALL) diff --git a/lib/urlresolver/plugins/nosvideo.py b/lib/urlresolver/plugins/nosvideo.py index 5ba82256..64c3b535 100644 --- a/lib/urlresolver/plugins/nosvideo.py +++ b/lib/urlresolver/plugins/nosvideo.py @@ -17,8 +17,6 @@ ''' import re -import base64 -import urllib from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -38,30 +36,22 @@ def get_media_url(self, host, media_id): if 'File Not Found' in html: raise ResolverError('File Not Found') - r = re.search('class\s*=\s*[\'|\"]btn.+?[\'|\"]\s+href\s*=\s*[\'|\"](.+?)[\'|\"]', html) - if not r: - raise ResolverError('File Not Found') - - headers = {'Referer': r.group(1)} - web_url = 'http://nosvideo.com/vj/video.php?u=%s&w=&h=530' % media_id - html = self.net.http_GET(web_url, headers=headers).content + html = self.net.http_GET(web_url).content - stream_url = re.compile('var\stracker\s*=\s*[\'|\"](.+?)[\'|\"]').findall(html) - stream_url += re.compile("tracker *: *[\'|\"](.+?)[\'|\"]").findall(html) + smil_url = re.compile('\':\'(.+?)\'').findall(html) + smil_url = [i for i in smil_url if '.smil' in i][0] - if len(stream_url) > 0: - stream_url = stream_url[0] - else: - raise ResolverError('Unable to locate video file') + html = self.net.http_GET(smil_url).content - try: stream_url = base64.b64decode(stream_url) - except: pass + streamer = re.findall('base\s*=\s*"(.+?)"', html)[0] + playpath = re.findall('src\s*=\s*"(.+?)"', html)[0] - stream_url += '|' + urllib.urlencode({'User-Agent': common.IE_USER_AGENT}) + stream_url = '%s playpath=%s' % (streamer, playpath) return stream_url def get_url(self, host, media_id): return 'http://nosvideo.com/%s' % media_id + diff --git a/lib/urlresolver/plugins/rapidvideocom.py b/lib/urlresolver/plugins/rapidvideocom.py index 68dfc4f0..879774d9 100644 --- a/lib/urlresolver/plugins/rapidvideocom.py +++ b/lib/urlresolver/plugins/rapidvideocom.py @@ -18,9 +18,9 @@ """ import re -from lib import helpers +import urllib import random -from lib.aa_decoder import AADecoder +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,24 +34,29 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content + data = helpers.get_hidden(html) data['confirm.y'] = random.randint(0, 120) data['confirm.x'] = random.randint(0, 120) + headers['Referer'] = web_url + post_url = web_url + '#' + html = self.net.http_POST(post_url, form_data=data, headers=headers).content.encode('utf-8') - match = re.search('hide\(\);(.*?;)\s*//', html, re.DOTALL) + + match = re.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html) + if match: - dtext = AADecoder(match.group(1)).decode() - match = re.search('"?sources"?\s*:\s*\[(.*?)\]', dtext, re.DOTALL) - if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): - stream_url, _label = match.groups() - stream_url = stream_url.replace('\/', '/') - stream_url += '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) - return stream_url + stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) + if stream_url: + stream_url = stream_url[0].replace('\/', '/') + stream_url += '|' + urllib.urlencode({'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}) + return stream_url raise ResolverError('File Not Found or removed') diff --git a/lib/urlresolver/plugins/rutube.py b/lib/urlresolver/plugins/rutube.py index c178e642..7ce2e31a 100644 --- a/lib/urlresolver/plugins/rutube.py +++ b/lib/urlresolver/plugins/rutube.py @@ -20,9 +20,7 @@ """ import re -import urllib -import HTMLParser -from lib import helpers +import json from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -37,33 +35,16 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - response = self.net.http_GET(web_url) + json_url = 'http://rutube.ru/api/play/options/%s/?format=json&no_404=true' % media_id - html = response.content + json_data = self.net.http_GET(json_url).content - if html: - m3u8 = re.compile('video_balancer":\s*{.*?"m3u8":\s*"(.*?)"}').findall(html)[0] - m3u8 = HTMLParser.HTMLParser().unescape(m3u8) - response = self.net.http_GET(m3u8) - m3u8 = response.content - - sources = re.compile('\n(.+?i=(.+?))\n').findall(m3u8) - sources = sources[::-1] - sources = [sublist[::-1] for sublist in sources] - - source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') - source = source.encode('utf-8') - - if source: - return source + try: return json.loads(json_data)['video_balancer']['m3u8'] + except: pass raise ResolverError('No playable video found.') def get_url(self, host, media_id): return 'http://rutube.ru/play/embed/%s' % media_id - @classmethod - def get_settings_xml(cls): - xml = super(cls, cls).get_settings_xml() - xml.append('' % (cls.__name__)) - return xml + diff --git a/lib/urlresolver/plugins/sharesix.py b/lib/urlresolver/plugins/sharesix.py index 9b914128..b42977f3 100644 --- a/lib/urlresolver/plugins/sharesix.py +++ b/lib/urlresolver/plugins/sharesix.py @@ -31,13 +31,12 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.FF_USER_AGENT} + headers = {'User-Agent': common.IE_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content - r = re.search(']*href="([^"]+)[^>]*>(Watch online|Fast download|Slow direct download)', html) + r = re.search(']*id="go-next"[^>*]href="([^"]+)', html) if r: next_url = 'http://' + host + r.group(1) - headers['Referer'] = web_url html = self.net.http_GET(next_url, headers=headers).content if 'file you were looking for could not be found' in html: @@ -45,7 +44,9 @@ def get_media_url(self, host, media_id): r = re.search("var\s+lnk\d+\s*=\s*'(.*?)'", html) if r: - stream_url = r.group(1) + '|' + urllib.urlencode(headers) + stream_url = r.group(1) + stream_url = urllib2.urlopen(urllib2.Request(stream_url, headers=headers)).geturl() + stream_url = stream_url + '|' + urllib.urlencode(headers) return stream_url else: raise ResolverError('Unable to locate link') diff --git a/lib/urlresolver/plugins/videobee.py b/lib/urlresolver/plugins/videobee.py index 44d22506..e72679c3 100644 --- a/lib/urlresolver/plugins/videobee.py +++ b/lib/urlresolver/plugins/videobee.py @@ -31,7 +31,15 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) + html = self.net.http_GET(web_url).content + + js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) + + for i in js_data: + try: html += jsunpack.unpack(i) + except: pass + r = re.search('sources:.*file:"(.*?)"', html) if r: return r.group(1) @@ -39,4 +47,5 @@ def get_media_url(self, host, media_id): raise ResolverError('File Not Found or removed') def get_url(self, host, media_id): - return 'http://thevideobee.to/embed-%s.html' % media_id + return 'https://thevideobee.to/embed-%s.html' % media_id + diff --git a/lib/urlresolver/plugins/vidup_me.py b/lib/urlresolver/plugins/vidup_me.py index d10ae6cf..f5538060 100644 --- a/lib/urlresolver/plugins/vidup_me.py +++ b/lib/urlresolver/plugins/vidup_me.py @@ -21,7 +21,6 @@ from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError -MAX_TRIES = 3 class VidUpMeResolver(UrlResolver): name = "vidup.me" @@ -34,22 +33,21 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - best_stream_url = '' - max_quality = 0 - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - js_data = js_data.replace("\\'", "'") - r = re.findall(r"label\s*:\s*'([^']+)p'\s*,\s*file\s*:\s*'([^']+)", js_data) - if r: - for quality, stream_url in r: - if int(quality) >= max_quality: - best_stream_url = stream_url - max_quality = int(quality) - - if best_stream_url: - return best_stream_url - - raise ResolverError('File Not Found or removed') + + js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) + + for i in js_data: + try: html += jsunpack.unpack(i) + except: pass + + match = re.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html) + + if match: + stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) + if stream_url: + return stream_url[-1] + + raise ResolverError('File Not Found or removed') def get_url(self, host, media_id): return 'http://beta.vidup.me/embed-%s.html' % media_id From 7ddc2c57233d50cb402d8efbc7b0ccdd0744fb63 Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 13 Aug 2016 18:30:51 -0400 Subject: [PATCH 1047/1360] remove dead resolvers --- lib/urlresolver/plugins/bestreams.py | 46 ---------------- lib/urlresolver/plugins/ecostream.py | 72 ------------------------- lib/urlresolver/plugins/filenuke.py | 56 ------------------- lib/urlresolver/plugins/mightyupload.py | 66 ----------------------- lib/urlresolver/plugins/primeshare.py | 59 -------------------- lib/urlresolver/plugins/promptfile.py | 55 ------------------- lib/urlresolver/plugins/sharesix.py | 55 ------------------- lib/urlresolver/plugins/videoboxer.py | 59 -------------------- lib/urlresolver/plugins/videosky.py | 55 ------------------- lib/urlresolver/plugins/vidio.py | 46 ---------------- lib/urlresolver/plugins/zettahost.py | 51 ------------------ 11 files changed, 620 deletions(-) delete mode 100644 lib/urlresolver/plugins/bestreams.py delete mode 100644 lib/urlresolver/plugins/ecostream.py delete mode 100644 lib/urlresolver/plugins/filenuke.py delete mode 100644 lib/urlresolver/plugins/mightyupload.py delete mode 100644 lib/urlresolver/plugins/primeshare.py delete mode 100644 lib/urlresolver/plugins/promptfile.py delete mode 100644 lib/urlresolver/plugins/sharesix.py delete mode 100644 lib/urlresolver/plugins/videoboxer.py delete mode 100644 lib/urlresolver/plugins/videosky.py delete mode 100644 lib/urlresolver/plugins/vidio.py delete mode 100644 lib/urlresolver/plugins/zettahost.py diff --git a/lib/urlresolver/plugins/bestreams.py b/lib/urlresolver/plugins/bestreams.py deleted file mode 100644 index ee2e22c9..00000000 --- a/lib/urlresolver/plugins/bestreams.py +++ /dev/null @@ -1,46 +0,0 @@ -""" - urlresolver XBMC Addon - Copyright (C) 2014 tknorris - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -""" - -import re -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class BestreamsResolver(UrlResolver): - name = "bestreams" - domains = ["bestreams.net"] - pattern = '(?://|\.)(bestreams\.net)/(?:embed-)?([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = {'User-Agent': common.IOS_USER_AGENT} - - html = self.net.http_GET(web_url, headers=headers).content - - r = re.search('file\s*:\s*"(http.+?)"', html) - - if r: - return r.group(1) - else: - raise ResolverError("File Link Not Found") - - def get_url(self, host, media_id): - return 'http://bestreams.net/embed-%s.html' % media_id diff --git a/lib/urlresolver/plugins/ecostream.py b/lib/urlresolver/plugins/ecostream.py deleted file mode 100644 index 463788a0..00000000 --- a/lib/urlresolver/plugins/ecostream.py +++ /dev/null @@ -1,72 +0,0 @@ -""" -urlresolver XBMC Addon -Copyright (C) 2011 t0mm0 - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import re -import urllib2 -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class EcostreamResolver(UrlResolver): - name = "ecostream" - domains = ["ecostream.tv"] - pattern = '(?://|\.)(ecostream.tv)/(?:stream|embed)?/([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - if re.search('>File not found!<', html): - raise ResolverError('File Not Found or removed') - - web_url = 'http://www.ecostream.tv/js/ecoss.js' - js = self.net.http_GET(web_url).content - r = re.search("\$\.post\('([^']+)'[^;]+'#auth'\).html\(''\)", js) - if not r: - raise ResolverError('Posturl not found') - - post_url = r.group(1) - r = re.search('data\("tpm",([^\)]+)\);', js) - if not r: - raise ResolverError('Postparameterparts not found') - post_param_parts = r.group(1).split('+') - found_parts = [] - for part in post_param_parts: - pattern = "%s='([^']+)'" % part.strip() - r = re.search(pattern, html) - if not r: - raise ResolverError('Formvaluepart not found') - found_parts.append(r.group(1)) - tpm = ''.join(found_parts) - # emulate click on button "Start Stream" - headers = ({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': common.IE_USER_AGENT}) - web_url = 'http://www.ecostream.tv' + post_url - html = self.net.http_POST(web_url, {'id': media_id, 'tpm': tpm}, headers=headers).content - sPattern = '"url":"([^"]+)"' - r = re.search(sPattern, html) - if not r: - raise ResolverError('Unable to resolve Ecostream link. Filelink not found.') - stream_url = 'http://www.ecostream.tv' + r.group(1) - stream_url = urllib2.unquote(stream_url) - stream_url = urllib2.urlopen(urllib2.Request(stream_url, headers=headers)).geturl() - - return stream_url - - def get_url(self, host, media_id): - return 'http://www.ecostream.tv/stream/%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/filenuke.py b/lib/urlresolver/plugins/filenuke.py deleted file mode 100644 index 29a7e19c..00000000 --- a/lib/urlresolver/plugins/filenuke.py +++ /dev/null @@ -1,56 +0,0 @@ -''' -sharesix urlresolver plugin -Copyright (C) 2014 tknorris - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' - -import re -import urllib -import urllib2 -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class FilenukeResolver(UrlResolver): - name = "filenuke" - domains = ["filenuke.com"] - pattern = '(?://|\.)(filenuke\.com)/(?:f/)?([0-9A-Za-z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.IE_USER_AGENT} - - html = self.net.http_GET(web_url, headers=headers).content - r = re.search(']*id="go-next"[^>*]href="([^"]+)', html) - if r: - next_url = 'http://' + host + r.group(1) - html = self.net.http_GET(next_url, headers=headers).content - - if 'file you were looking for could not be found' in html: - raise ResolverError('File Not Found or removed') - - r = re.search("var\s+lnk\d+\s*=\s*'(.*?)'", html) - if r: - stream_url = r.group(1) - stream_url = urllib2.urlopen(urllib2.Request(stream_url, headers=headers)).geturl() - stream_url = stream_url + '|' + urllib.urlencode(headers) - return stream_url - else: - raise ResolverError('Unable to locate link') - - def get_url(self, host, media_id): - return 'http://filenuke.com/%s' % media_id diff --git a/lib/urlresolver/plugins/mightyupload.py b/lib/urlresolver/plugins/mightyupload.py deleted file mode 100644 index e874fdfc..00000000 --- a/lib/urlresolver/plugins/mightyupload.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -mightyupload urlresolver plugin -Copyright (C) 2013 Lynx187 - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import re -import urllib -from lib import jsunpack -from lib import helpers -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class MightyuploadResolver(UrlResolver): - name = "mightyupload" - domains = ["mightyupload.com"] - pattern = '(?://|\.)(mightyupload\.com)/(?:embed-)?([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - stream_url = None - form_values = helpers.get_hidden(html) - html = self.net.http_POST(web_url, form_data=form_values).content - r = re.search('', html, re.DOTALL) - if r: - html = self.net.http_GET(r.group(1)).content - r = re.search("

.*?", html, re.DOTALL) - if not r: - raise ResolverError('Unable to resolve Mightyupload link. Player config not found.') - r_temp = re.search("file: '([^']+)'", r.group(1)) - if r_temp: - stream_url = r_temp.group(1) - else: - js = jsunpack.unpack(r.group(1)) - r = re.search("'file','([^']+)'", js.replace('\\', '')) - if not r: - r = re.search('"src"value="([^"]+)', js.replace('\\', '')) - - if not r: - raise ResolverError('Unable to resolve Mightyupload link. Filelink not found.') - - stream_url = r.group(1) - - if stream_url: - return stream_url + '|' + urllib.urlencode({'User-Agent': common.IE_USER_AGENT}) - else: - raise ResolverError('Unable to resolve link') - - def get_url(self, host, media_id): - return 'http://www.mightyupload.com/embed-%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/primeshare.py b/lib/urlresolver/plugins/primeshare.py deleted file mode 100644 index b5a4ed06..00000000 --- a/lib/urlresolver/plugins/primeshare.py +++ /dev/null @@ -1,59 +0,0 @@ -""" -primeshare urlresolver plugin -Copyright (C) 2013 Lynx187 - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -""" - -import re -import urllib2 -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class PrimeshareResolver(UrlResolver): - name = "primeshare" - domains = ["primeshare.tv"] - pattern = '(?://|\.)(primeshare\.tv)/download/([0-9a-zA-Z-_]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = {'User-Agent': common.IOS_USER_AGENT} - - html = self.net.http_GET(web_url, headers=headers).content - - r = re.search('
', '', html, flags = re.MULTILINE | re.DOTALL | re.IGNORECASE) + pattern = ']*id\s*=\s*[\'"]main[\'"][^>]*>.*?[^"]+[\.|%s]\/(\w+\/\w+\.\w+).*?' % host # api-js pattern += '"([^"]+%s[^"]+(?:\d+|)\.\w{1,3}\?\w+=[^"]+)".*?' % host # cgi pattern += ']*id=["|\']\s*\w+(?:\d+|)\s*["|\'][^>]*>(\d+)<' # countdown From d835042b9a66d568dcf613944e74d304536913b1 Mon Sep 17 00:00:00 2001 From: Viper2k4 Date: Fri, 11 Nov 2016 00:20:15 +0100 Subject: [PATCH 1256/1360] update flashX.tv #11 --- lib/urlresolver/plugins/flashx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/flashx.py b/lib/urlresolver/plugins/flashx.py index 12c5fbd9..f72e5218 100644 --- a/lib/urlresolver/plugins/flashx.py +++ b/lib/urlresolver/plugins/flashx.py @@ -42,8 +42,6 @@ def get_media_url(self, host, media_id): cookie.update(self.__get_cookies(html)) headers.update({'Cookie': cookie, 'Referer': 'http://%s' % host}) - html = re.sub(']*style\s*=\s*["|\']visibility\:(\s)?hidden["|\'][^>]*>.*?
', '', html, flags = re.MULTILINE | re.DOTALL | re.IGNORECASE) - pattern = ']*id\s*=\s*[\'"]main[\'"][^>]*>.*?[^"]+[\.|%s]\/(\w+\/\w+\.\w+).*?' % host # api-js pattern += '"([^"]+%s[^"]+(?:\d+|)\.\w{1,3}\?\w+=[^"]+)".*?' % host # cgi pattern += ']*id=["|\']\s*\w+(?:\d+|)\s*["|\'][^>]*>(\d+)<' # countdown @@ -61,6 +59,8 @@ def get_media_url(self, host, media_id): if not matchjs: raise ResolverError('Site structure changed!') + html = re.sub(']*style\s*=\s*["|\']visibility\:(\s)?hidden["|\'][^>]*>.*?
', '', html, flags=re.MULTILINE | re.DOTALL | re.IGNORECASE) + postUrl = '' for matchPff in re.finditer('var\s+s\s*=\s*["|\'](.*?)["|\']', html, re.DOTALL): decStr = self.pff(matchPff.group(1)) From 5b2fa0d2fc4ae66e5e89393666171e726f41c716 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 10 Nov 2016 19:03:22 -0500 Subject: [PATCH 1257/1360] update dm --- lib/urlresolver/plugins/dailymotion.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/dailymotion.py b/lib/urlresolver/plugins/dailymotion.py index b85be51f..0ace648f 100644 --- a/lib/urlresolver/plugins/dailymotion.py +++ b/lib/urlresolver/plugins/dailymotion.py @@ -42,11 +42,11 @@ def get_media_url(self, host, media_id): raise ResolverError('File not found') if livesource and not sources: - return livesource[0] + return self.net.http_HEAD(livesource[0]).get_url() sources = sorted(sources, key=lambda x: x[0])[::-1] - source = helpers.pick_source(sources) + source = helpers.pick_source(sources, self.get_setting('auto_pick') == 'true') if not '.m3u8' in source: raise ResolverError('File not found') @@ -61,3 +61,9 @@ def get_media_url(self, host, media_id): def get_url(self, host, media_id): return 'http://www.dailymotion.com/embed/video/%s' % media_id + + @classmethod + def get_settings_xml(cls): + xml = super(cls, cls).get_settings_xml() + xml.append('' % (cls.__name__)) + return xml From df42ce362cb8bd4f802baac137f0c2bc9defb2b1 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 10 Nov 2016 22:00:10 -0500 Subject: [PATCH 1258/1360] make flashx dynamic --- lib/urlresolver/plugins/flashx.py | 160 +++++++++--------------------- lib/urlresolver/plugins/fx_gmu.py | 48 +++++++++ 2 files changed, 96 insertions(+), 112 deletions(-) create mode 100644 lib/urlresolver/plugins/fx_gmu.py diff --git a/lib/urlresolver/plugins/flashx.py b/lib/urlresolver/plugins/flashx.py index f72e5218..f3fac691 100644 --- a/lib/urlresolver/plugins/flashx.py +++ b/lib/urlresolver/plugins/flashx.py @@ -16,13 +16,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ - -import re -from lib import jsunpack -from lib import helpers +import os +import hashlib from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError +FX_SOURCE = 'https://offshoregit.com/tvaresolvers/fx_gmu.py' +FX_PATH = os.path.join(common.plugins_path, 'fx_gmu.py') + class FlashxResolver(UrlResolver): name = "flashx" domains = ["flashx.tv"] @@ -31,114 +32,49 @@ class FlashxResolver(UrlResolver): def __init__(self): self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = {'User-Agent': common.FF_USER_AGENT} - response = self.net.http_GET(web_url, headers=headers) - html = response.content - - cookie = response.get_headers(as_dict=True).get('Set-Cookie', {}) - cookie.update(self.__get_cookies(html)) - headers.update({'Cookie': cookie, 'Referer': 'http://%s' % host}) - - pattern = ']*id\s*=\s*[\'"]main[\'"][^>]*>.*?[^"]+[\.|%s]\/(\w+\/\w+\.\w+).*?' % host # api-js - pattern += '"([^"]+%s[^"]+(?:\d+|)\.\w{1,3}\?\w+=[^"]+)".*?' % host # cgi - pattern += ']*id=["|\']\s*\w+(?:\d+|)\s*["|\'][^>]*>(\d+)<' # countdown - match = re.search(pattern, html, re.DOTALL | re.I) - # FlashX: If you are tired of this cat and mouse game then we have a pairing solution that would still let you get revenue and still allow kodi users to view your streams - # Read more about it here: https://www.tvaddons.ag/rickroll-thevideo/ - # We've used this solution with OpenLoad, thevideo.me, vidup.me and others to good effect. Contact tknorris via PM @ https://forums.tvaddons.ag/ to talk details - - if not match: - raise ResolverError('Site structure changed!') - - jscontent = self.net.http_GET('http://%s/%s' % (host, match.group(1)), headers=headers).content - matchjs = re.search('!=\s*null.*?{(\w+):', jscontent, re.DOTALL | re.I) - - if not matchjs: - raise ResolverError('Site structure changed!') - - html = re.sub(']*style\s*=\s*["|\']visibility\:(\s)?hidden["|\'][^>]*>.*?
', '', html, flags=re.MULTILINE | re.DOTALL | re.IGNORECASE) - - postUrl = '' - for matchPff in re.finditer('var\s+s\s*=\s*["|\'](.*?)["|\']', html, re.DOTALL): - decStr = self.pff(matchPff.group(1)) - matchAct = re.search('action\s*=\s*[\'"]([^\'"]+)[\'"].*?', decStr) - if matchAct: - html = html.replace(matchPff.group(1), decStr) - postUrl = matchAct.group(1) - else: - html += decStr - - if not postUrl: - matchAct = re.search(']*action\s*=\s*[\'"]([^\'"]+)[\'"].*?', html, re.DOTALL | re.I) - if matchAct: - postUrl = matchAct.group(1) - - if postUrl and not host in postUrl: - postUrl = 'http://%s/%s' % (host, postUrl) - - if not postUrl: - raise ResolverError('Site structure changed!') - - self.net.http_GET('http://www.%s/flashx.php?%s=1' % (host, matchjs.group(1)), headers=headers) - self.net.http_GET(match.group(2).strip(), headers=headers) - data = self.get_postvalues(html) - common.kodi.sleep(int(match.group(3)) * 1000 + 500) - html = self.net.http_POST(postUrl, data, headers=headers).content - - sources = [] - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - packed_data = jsunpack.unpack(match.group(1)) - sources += self.__parse_sources_list(packed_data) - - if len(sources) > 0: - return helpers.pick_source(sources) - - raise ResolverError('Unable to find video') - - @staticmethod - def pff(decStr): - m="" - for i in range(0, len(decStr)): - if ord(decStr[i]) == 28: - m += '&' - elif ord(decStr[i]) == 23: - m += '!' + @common.cache.cache_method(cache_limit=1) + def get_fx_code(self): + try: + headers = self.net.http_HEAD(FX_SOURCE).get_headers(as_dict=True) + common.log_utils.log(headers) + old_etag = self.get_setting('etag') + new_etag = headers.get('Etag', '') + old_len = self.__old_length() + new_len = int(headers.get('Content-Length', 0)) + if old_etag != new_etag or old_len != new_len: + common.log_utils.log('Updating fx_gmu: |%s|%s|%s|%s|' % (old_etag, new_etag, old_len, new_len)) + self.set_setting('etag', new_etag) + new_py = self.net.http_GET(FX_SOURCE).content + if new_py: + with open(FX_PATH, 'w') as f: + f.write(new_py) else: - m += chr(ord(decStr[i]) - 1) - return m - - def get_postvalues(self, html): - postvals = {} - valid_names = ['hash', 'imhuman', 'usr_login', 'referer', 'fname', 'id', 'op'] - - for i, form in enumerate(re.finditer('''|]+>(.*?)''', html, re.DOTALL | re.I)): - for field in re.finditer(''']*type=['"]?[hidden|submit]['"]?[^>]*>''', form.group(1)): - match = re.search('''name\s*=\s*['"]([^'"]+)''', field.group(0)) - match1 = re.search('''value\s*=\s*['"]([^'"]*)''', field.group(0)) - if match and match1 and match.group(1).lower() in valid_names: - postvals[match.group(1)] = match1.group(1) - - return postvals - - def __get_cookies(self, html): - cookies = {} - for match in re.finditer("\$\.cookie\(\s*'([^']+)'\s*,\s*'([^']+)", html): - key, value = match.groups() - cookies[key] = value - return cookies - - def __parse_sources_list(self, html): - sources = [] - match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) - if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): - stream_url, label = match.groups() - stream_url = stream_url.replace('\/', '/') - sources.append((label, stream_url)) - return sources + common.log_utils.log('Reusing existing fx_gmu.py: |%s|%s|%s|%s|' % (old_etag, new_etag, old_len, new_len)) + except Exception as e: + common.log_utils.log_warning('Exception during flashx code retrieve: %s' % e) + + def __old_length(self): + try: + with open(FX_PATH, 'r') as f: + old_py = f.read() + old_len = len(old_py) + except: + old_len = 0 + return old_len + def get_media_url(self, host, media_id): + try: + if self.get_setting('auto_update') == 'true': + self.get_fx_code() + with open(FX_PATH, 'r') as f: + py_data = f.read() + common.log_utils.log('fx_gmu hash: %s' % (hashlib.md5(py_data).hexdigest())) + import fx_gmu + web_url = self.get_url(host, media_id) + return fx_gmu.get_media_url(web_url) + except Exception as e: + common.log_utils.log_debug('Exception during flashx resolve parse: %s' % e) + raise + def get_url(self, host, media_id): - return self._default_get_url(host, media_id, 'http://{host}/{media_id}') + return self._default_get_url(host, media_id, 'http://{host}/embed.php?c={media_id}') diff --git a/lib/urlresolver/plugins/fx_gmu.py b/lib/urlresolver/plugins/fx_gmu.py new file mode 100644 index 00000000..ff32a0c4 --- /dev/null +++ b/lib/urlresolver/plugins/fx_gmu.py @@ -0,0 +1,48 @@ +""" +flashx.tv urlresolver plugin +Copyright (C) 2015 tknorris + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" +import re +from lib import jsunpack +from lib import helpers +from urlresolver import common +from urlresolver.resolver import ResolverError + +SORT_KEY = {'High': 3, 'Middle': 2, 'Low': 1} + +def get_media_url(url): + try: + headers = {'User-Agent': common.FF_USER_AGENT} + net = common.Net() + html = net.http_GET(url, headers=headers).content + match = re.search('''href=['"]([^'"]+)''', html) + if match: + html = net.http_GET(match.group(1), headers=headers).content + headers.update({'Referer': url}) + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + html += jsunpack.unpack(match.group(1)) + + sources = helpers.parse_sources_list(html) + try: sources.sort(key=lambda x: SORT_KEY.get(x[0], 0), reverse=True) + except: pass + source = helpers.pick_source(sources) + return source + helpers.append_headers(headers) + + except Exception as e: + common.log_utils.log_debug('Exception during flashx resolve parse: %s' % e) + raise + + raise ResolverError('Unable to resolve flashx link. Filelink not found.') From f12ecccc9c12c76797ef4ecb18613626eb2fb83d Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 10 Nov 2016 22:30:38 -0500 Subject: [PATCH 1259/1360] fix movshare --- lib/urlresolver/plugins/movshare.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/urlresolver/plugins/movshare.py b/lib/urlresolver/plugins/movshare.py index 45178b69..e5faa6d7 100644 --- a/lib/urlresolver/plugins/movshare.py +++ b/lib/urlresolver/plugins/movshare.py @@ -32,16 +32,28 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content stream_url = '' match = re.search('', html, re.DOTALL) if match: links = re.findall(']+src="([^"]+)', match.group(0), re.DOTALL) if links: stream_url = random.choice(links) + + if not stream_url: + match = re.search('fkzd="([^"]+)', html) + if match: + query = {'pass': 'undefined', 'key': match.group(1), 'cid3': 'undefined', 'cid': 0, 'numOfErrors': 0, 'file': media_id, 'cid2': 'undefined', 'user': 'undefined'} + api_url = 'http://www.wholecloud.net//api/player.api.php?' + urllib.urlencode(query) + html = self.net.http_GET(api_url, headers=headers).content + match = re.search('url=([^&]+)', html) + if match: + stream_url = match.group(1) if stream_url: - return stream_url + helpers.append_headers({'Referer': web_url, 'User-Agent': common.FF_USER_AGENT}) + headers.update({'Referer': web_url, }) + return stream_url + helpers.append_headers(headers) else: raise ResolverError('File Not Found or removed') From 667df4d4a4b2954631f189440bb67bbc16a6f9d1 Mon Sep 17 00:00:00 2001 From: tknorris Date: Thu, 10 Nov 2016 23:46:28 -0500 Subject: [PATCH 1260/1360] update streamplay --- lib/urlresolver/plugins/streamplay.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/urlresolver/plugins/streamplay.py b/lib/urlresolver/plugins/streamplay.py index bc627ab4..1b4c6e36 100644 --- a/lib/urlresolver/plugins/streamplay.py +++ b/lib/urlresolver/plugins/streamplay.py @@ -15,9 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ - import re from lib import jsunpack +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -31,21 +31,23 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content - - encoded = re.search('(eval\(function.*?)', html, re.DOTALL) - if not encoded: - raise ResolverError('File not found') - - else: - js_data = jsunpack.unpack(encoded.group(1)) + headers = {'User-Agent': common.FF_USER_AGENT, 'Accept': '*/*'} + html = self.net.http_GET(web_url, headers=headers).content + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + js_data = jsunpack.unpack(match.group(1)) + html += js_data.replace('\\', '') - match = re.findall('[\'"]?file[\'"]?\s*:\s*[\'"]([^\'"]+)', js_data) + match = re.findall('[\'"]?file[\'"]?\s*:\s*[\'"]([^\'"]+)', html) if match: stream_url = [i for i in match if i.endswith('.mp4')] if stream_url: - return stream_url[0] + match = re.search("\$\.get\('([^']+)", html) + if match: + headers.update({'Referer': web_url, 'X-Requested-With': 'XMLHttpRequest'}) + self.net.http_GET(match.group(1), headers=headers) + # returned stream still doesn't work, probably either a header issue or a pre-http call needed + # commenting out until someone else can fix it + # return stream_url[0] + helpers.append_headers({'User-Agent': common.FF_USER_AGENT}) raise ResolverError('File not found') From 3c99df7e0f0dba67fce0afbc4b70646ce28c0509 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 00:04:25 -0500 Subject: [PATCH 1261/1360] update xvidstage --- lib/urlresolver/plugins/xvidstage.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/urlresolver/plugins/xvidstage.py b/lib/urlresolver/plugins/xvidstage.py index 8878ea9c..c282a170 100644 --- a/lib/urlresolver/plugins/xvidstage.py +++ b/lib/urlresolver/plugins/xvidstage.py @@ -32,26 +32,18 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - data = helpers.get_hidden(html) - data['method_free'] = 'Kostenloser stream / Kostenloser Download' - html = self.net.http_POST(web_url, data).content - - js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) + data['method_free'] = 'Continue to video / Continue to Free Download' + html = self.net.http_POST(web_url, form_data=data).content - for i in js_data: - try: html += jsunpack.unpack(i) - except: pass - - html = html.replace('\\\'', '\'') - html = html.replace('\\\'', '\'') + for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): + html += jsunpack.unpack(match.group(1)) + html = html.replace('\\', '') stream_url = re.findall(' Date: Fri, 11 Nov 2016 00:05:54 -0500 Subject: [PATCH 1262/1360] remove vidfile --- lib/urlresolver/plugins/vidfile.py | 56 ------------------------------ 1 file changed, 56 deletions(-) delete mode 100644 lib/urlresolver/plugins/vidfile.py diff --git a/lib/urlresolver/plugins/vidfile.py b/lib/urlresolver/plugins/vidfile.py deleted file mode 100644 index a409cec0..00000000 --- a/lib/urlresolver/plugins/vidfile.py +++ /dev/null @@ -1,56 +0,0 @@ -''' - urlresolver XBMC Addon - Copyright (C) 2016 MavWolverine - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -''' - -import re -from lib import jsunpack -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError - -class VidFileResolver(UrlResolver): - name = "vidfile" - domains = ["vidfile.xyz"] - pattern = '(?://|\.)(vidfile.xyz)/(?:embed-)?([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url, headers={'Referer': 'abc'}).content - - if 'File was deleted' in html: - raise ResolverError('File Removed') - - if 'Video is processing' in html: - raise ResolverError('File still being processed') - - packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) - if packed: - js = jsunpack.unpack(packed.group(1)) - else: - js = html - - link = re.search('([^"]*.mp4)', js) - if link: - common.log_utils.log_debug('vidfile.xyz Link Found: %s' % link.group(1)) - return link.group(1) - - raise ResolverError('Unable to find vidfile.xyz video') - - def get_url(self, host, media_id): - return self._default_get_url(host, media_id, 'http://{host}/{media_id}.html') From 5fd548597ecd85a8b2a62b323f44ef6c858991c6 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 9 Nov 2016 15:47:42 -0500 Subject: [PATCH 1263/1360] gmu updates half working (link but no playback | error 600 Timeouts) if updated, exact result reproduced --- nosvideo / results and final link (fails creating demuxer) cloudzilla/neodrive / finds file but 404, web results in same uploadc vidcrazy videorev / rtmp vshare_eu # was 503 / 600 time out now zstream need fix --- happystreams streamplay --- watchpass # no links found to test vidspot # no links at all, redirect to static content or are not vidspot --- .../plugins/__generic_template__.py | 51 ++++++++++++ lib/urlresolver/plugins/aliez.py | 22 +----- lib/urlresolver/plugins/ani-stream.py | 23 ++---- lib/urlresolver/plugins/blazefile.py | 31 +------- lib/urlresolver/plugins/cloudzilla.py | 21 +---- lib/urlresolver/plugins/divxstage.py | 19 +---- .../plugins/{filehoot.py => downace.py} | 32 +++----- lib/urlresolver/plugins/estream.py | 37 +-------- lib/urlresolver/plugins/exashare.py | 19 ++--- lib/urlresolver/plugins/fastplay.py | 29 +------ lib/urlresolver/plugins/gorillavid.py | 21 +---- lib/urlresolver/plugins/grifthost.py | 29 ++----- lib/urlresolver/plugins/happystreams.py | 6 +- lib/urlresolver/plugins/idowatch.py | 27 +------ lib/urlresolver/plugins/indavideo.py | 4 +- lib/urlresolver/plugins/jetload.py | 13 +--- lib/urlresolver/plugins/letwatch.py | 31 +------- lib/urlresolver/plugins/lib/helpers.py | 78 ++++++++++++++----- lib/urlresolver/plugins/megamp4.py | 29 +------ lib/urlresolver/plugins/movdivx.py | 27 ++----- lib/urlresolver/plugins/movpod.py | 21 +++-- lib/urlresolver/plugins/mp4engine.py | 23 +----- lib/urlresolver/plugins/mp4stream.py | 31 +------- lib/urlresolver/plugins/mp4upload.py | 13 +--- lib/urlresolver/plugins/myvidstream.py | 28 +------ lib/urlresolver/plugins/nosvideo.py | 21 ++--- lib/urlresolver/plugins/play44_net.py | 18 +---- lib/urlresolver/plugins/playedto.py | 20 +---- lib/urlresolver/plugins/playhd.py | 17 +--- lib/urlresolver/plugins/playu.py | 23 +++--- lib/urlresolver/plugins/powerwatch.py | 26 +++---- lib/urlresolver/plugins/promptfile.py | 19 ++--- lib/urlresolver/plugins/putload.py | 5 +- lib/urlresolver/plugins/rapidvideo.py | 27 +------ lib/urlresolver/plugins/speedplay.py | 27 +------ lib/urlresolver/plugins/stagevu.py | 16 +--- lib/urlresolver/plugins/streamcloud.py | 23 +++--- lib/urlresolver/plugins/streamenet.py | 25 +----- lib/urlresolver/plugins/thevideos.py | 22 +----- lib/urlresolver/plugins/trollvid.py | 9 ++- lib/urlresolver/plugins/tusfiles.py | 22 +----- lib/urlresolver/plugins/uploadc.py | 27 +------ lib/urlresolver/plugins/userscloud.py | 29 +------ lib/urlresolver/plugins/usersfiles.py | 25 +----- lib/urlresolver/plugins/vidbull.py | 14 ++-- lib/urlresolver/plugins/vidcrazynet.py | 17 +--- lib/urlresolver/plugins/videobee.py | 27 +------ lib/urlresolver/plugins/videorev.py | 26 ++----- lib/urlresolver/plugins/vidlox.py | 4 +- lib/urlresolver/plugins/vidmad.py | 25 ++---- lib/urlresolver/plugins/vidto.py | 13 ++-- lib/urlresolver/plugins/vidup_org.py | 17 +--- lib/urlresolver/plugins/vidzi.py | 26 +------ lib/urlresolver/plugins/vodlocker.py | 19 +---- lib/urlresolver/plugins/vodmine.py | 26 +------ lib/urlresolver/plugins/vshare.py | 18 +---- lib/urlresolver/plugins/vshareeu.py | 29 +++---- lib/urlresolver/plugins/watchonline.py | 18 ++--- lib/urlresolver/plugins/watchvideo.py | 31 +------- lib/urlresolver/plugins/weshare.py | 17 ++-- lib/urlresolver/plugins/xvidstage.py | 24 ++---- lib/urlresolver/plugins/yourupload.py | 23 +----- lib/urlresolver/plugins/youwatch.py | 19 ++--- lib/urlresolver/plugins/zstream.py | 20 +---- 64 files changed, 380 insertions(+), 1099 deletions(-) create mode 100644 lib/urlresolver/plugins/__generic_template__.py rename lib/urlresolver/plugins/{filehoot.py => downace.py} (50%) diff --git a/lib/urlresolver/plugins/__generic_template__.py b/lib/urlresolver/plugins/__generic_template__.py new file mode 100644 index 00000000..72aa609d --- /dev/null +++ b/lib/urlresolver/plugins/__generic_template__.py @@ -0,0 +1,51 @@ +""" + Kodi urlresolver plugin + Copyright (C) 2016 script.module.urlresolver + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +""" + +from lib import helpers +from urlresolver.resolver import UrlResolver, ResolverError + + +class TemplateResolver(UrlResolver): + """ + Template Resolver + - change class name from TemplateResolver to Resolver + ___ + name |str| : resolver name + domains |list of str| : list of supported domains + pattern |str| : supported uri regex pattern, match groups: 1=host, 2=media_id + """ + name = 'template' + domains = ['templ.ate'] + pattern = '(?://|\.)(templ\.ate)/(?:embed/)?([0-9a-zA-Z]+)' + + def get_media_url(self, host, media_id): + """ + source scraping to get resolved uri goes here + return |str| : resolved/playable uri or raise ResolverError + ___ + helpers.get_media_url result_blacklist: |list of str| : list of strings to blacklist in source results + """ + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=None) + + def get_url(self, host, media_id): + """ + return |str| : uri to be used by get_media_url + ___ + _default_get_url template: |str| : 'http://{host}/embed-{media_id}.html' + """ + return self._default_get_url(host, media_id, template=None) diff --git a/lib/urlresolver/plugins/aliez.py b/lib/urlresolver/plugins/aliez.py index cdfafc3d..109765d1 100644 --- a/lib/urlresolver/plugins/aliez.py +++ b/lib/urlresolver/plugins/aliez.py @@ -20,31 +20,17 @@ """ import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class AliezResolver(UrlResolver): name = "aliez" domains = ['aliez.me'] pattern = '(?://|\.)(aliez\.me)/(?:(?:player/video\.php\?id=([0-9]+)&s=([A-Za-z0-9]+))|(?:video/([0-9]+)/([A-Za-z0-9]+)))' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - response = self.net.http_GET(web_url) - html = response.content - - if html: - try: - stream_url = re.search(r"file:\s'(.+?)'", html).groups()[0] - return stream_url - - except: - pass - - raise ResolverError('No playable video found.') + return helpers.get_media_url(self.get_url(host, media_id)) def get_host_and_id(self, url): r = re.search(self.pattern, url, re.I) @@ -54,7 +40,7 @@ def get_host_and_id(self, url): return r else: return False - + def get_url(self, host, media_id): media_id = media_id.split("|") return self._default_get_url(host, media_id, 'http://emb.%s/player/video.php?id=%s&s=%s&w=590&h=332' % (host, media_id[0], media_id[1])) diff --git a/lib/urlresolver/plugins/ani-stream.py b/lib/urlresolver/plugins/ani-stream.py index f3efe74e..c88fbf66 100644 --- a/lib/urlresolver/plugins/ani-stream.py +++ b/lib/urlresolver/plugins/ani-stream.py @@ -16,30 +16,17 @@ along with this program. If not, see . """ -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class AniStreamResolver(UrlResolver): name = "ani-stream" domains = ["ani-stream.com"] - pattern = '(?://|\.)(www\.ani-stream\.com)/([0-9a-zA-Z\.-]+)' - - def __init__(self): - self.net = common.Net(http_debug=True) + pattern = '(?://|\.)(www\.ani-stream\.com)/(?:embed-)?([0-9a-zA-Z\.-]+)' def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - resp = self.net.http_GET(web_url) - html = resp.content - if re.search('>(File Not Found)<', html): - raise ResolverError('File Not Found or removed') - - r = re.search("file: '(.+?)',", html) - if r: - return r.group(1) - else: - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): - return 'http://www.ani-stream.com/%s' % (media_id) + return 'http://www.ani-stream.com/embed-%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/blazefile.py b/lib/urlresolver/plugins/blazefile.py index 8b2ad577..63ad1252 100644 --- a/lib/urlresolver/plugins/blazefile.py +++ b/lib/urlresolver/plugins/blazefile.py @@ -16,10 +16,7 @@ along with this program. If not, see . """ -import re -import urllib -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError @@ -28,32 +25,8 @@ class BlazefileResolver(UrlResolver): domains = ['blazefile.co'] pattern = '(?://|\.)(blazefile\.co)/(?:embed-)?([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = {'User-Agent': common.FF_USER_AGENT} - - html = self.net.http_GET(web_url, headers=headers).content - - if jsunpack.detect(html): - html = jsunpack.unpack(html) + html - - url = re.findall('. """ -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class CloudZillaResolver(UrlResolver): name = "cloudzilla" domains = ['cloudzilla.to', 'neodrive.co'] pattern = '(?://|\.)(cloudzilla.to|neodrive.co)/(?:share/file|embed)/([A-Za-z0-9]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - html += jsunpack.unpack(match.group(1)) - - common.log_utils.log(html) - - match = re.search('vurl\s*=\s*"([^"]+)', html) - if match: - return match.group(1) - else: - raise ResolverError('Unable to resolve cloudtime link. Filelink not found.') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/embed/{media_id}') diff --git a/lib/urlresolver/plugins/divxstage.py b/lib/urlresolver/plugins/divxstage.py index 6c2e8cc9..dc4d50ff 100644 --- a/lib/urlresolver/plugins/divxstage.py +++ b/lib/urlresolver/plugins/divxstage.py @@ -16,32 +16,17 @@ along with this program. If not, see . ''' -import re from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class DivxstageResolver(UrlResolver): name = 'divxstage' domains = ['divxstage.eu', 'divxstage.net', 'divxstage.to', 'cloudtime.to'] pattern = '(?://|\.)(divxstage.eu|divxstage.net|divxstage.to|cloudtime.to)/(?:video/|embed/\?v=)([A-Za-z0-9]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content - - sources = [] - for idx, match in enumerate(re.finditer('. """ -import re -from urlresolver import common + +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError -class FilehootResolver(UrlResolver): - name = "filehoot" - domains = ['filehoot.com'] - pattern = '(?://|\.)(filehoot\.com)/(?:embed-)?([0-9a-z]+)' - def __init__(self): - self.net = common.Net() +class DownaceResolver(UrlResolver): + name = 'downace' + domains = ['downace.com'] + pattern = '(?://|\.)(downace\.com)/(?:embed/)?([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - if '404 Not Found' in html: - raise ResolverError('The requested video was not found.') - - pattern = "file\s*:\s*'([^']+)'\s*,\s*'provider'\s*:\s*'http" - match = re.search(pattern, html) - if match: - return match.group(1) - - raise ResolverError('No video link found.') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): - return self._default_get_url(host, media_id) + return 'https://www.downace.com/embed/%s' % media_id diff --git a/lib/urlresolver/plugins/estream.py b/lib/urlresolver/plugins/estream.py index fb288950..85117a1c 100644 --- a/lib/urlresolver/plugins/estream.py +++ b/lib/urlresolver/plugins/estream.py @@ -19,50 +19,17 @@ along with this program. If not, see . """ -import re,urllib -from lib import jsunpack from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class EstreamResolver(UrlResolver): name = "estream" domains = ['estream.to'] pattern = '(?://|\.)(estream\.to)/(?:embed-)?([a-zA-Z0-9]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - sources = [] - for packed in re.finditer('(eval\(function.*?)', html, re.DOTALL): - packed_data = jsunpack.unpack(packed.group(1)) - sources += self.__parse_sources_list(packed_data) - - source = helpers.pick_source(sources) - headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url, 'Cookie': self.__get_cookies(html)} - return source + helpers.append_headers(headers) - - raise ResolverError('No playable video found.') + return helpers.get_media_url(self.get_url(host, media_id)) - def __get_cookies(self, html): - cookies = ['lang=1', 'ref_url=https://www.estream.to/'] - for match in re.finditer("\$\.cookie\(\s*'([^']+)'\s*,\s*'([^']+)", html): - key, value = match.groups() - cookies.append('%s=%s' % (key, value)) - return '; '.join(cookies) - - def __parse_sources_list(self, html): - sources = [] - match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) - if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): - stream_url, label = match.groups() - stream_url = stream_url.replace('\/', '/') - sources.append((label, stream_url)) - return sources - def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/exashare.py b/lib/urlresolver/plugins/exashare.py index 34542c92..f51f4a8a 100644 --- a/lib/urlresolver/plugins/exashare.py +++ b/lib/urlresolver/plugins/exashare.py @@ -17,13 +17,14 @@ """ import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError class ExashareResolver(UrlResolver): name = "exashare" - domains = ["exashare.com"] - pattern = '(?://|\.)(exashare\.com)/(?:embed-)?([0-9a-zA-Z]+)' + domains = ["exashare.com", "uame8aij4f.com", "yahmaib3ai.com"] + pattern = '(?://|\.)((?:yahmaib3ai|uame8aij4f|exashare)\.com)/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = common.Net() @@ -31,19 +32,11 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url('exashare.com', media_id) html = self.net.http_GET(web_url).content - try: r = re.search('src="([^"]+)', html).group(1) - except: return - headers = {'Referer': web_url} + try: web_url = re.search('src="([^"]+)', html).group(1) + except: raise ResolverError('Unable to locate link') - html = self.net.http_GET(r, headers=headers).content - - stream_url = re.search('file\s*:\s*"(http.+?)"', html) - - if stream_url: - return stream_url.group(1) - else: - raise ResolverError('Unable to locate link') + return helpers.get_media_url(web_url) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/fastplay.py b/lib/urlresolver/plugins/fastplay.py index 84b1dd05..37ce02ba 100644 --- a/lib/urlresolver/plugins/fastplay.py +++ b/lib/urlresolver/plugins/fastplay.py @@ -16,9 +16,7 @@ along with this program. If not, see . ''' -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError @@ -27,31 +25,8 @@ class FastplayResolver(UrlResolver): domains = ['fastplay.sx', 'fastplay.cc'] pattern = '(?://|\.)(fastplay\.(?:sx|cc))/(?:flash-|embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - if '404 Not Found' in html: - raise ResolverError('File Removed') - - if 'Video is processing' in html: - raise ResolverError('File still being processed') - - packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) - if packed: - js = jsunpack.unpack(packed.group(1)) - else: - js = html - - link = re.search('sources[\d\D]+(http.*?)",label', js) - if link: - common.log_utils.log_debug('fastplay.sx Link Found: %s' % link.group(1)) - return link.group(1) - - raise ResolverError('Unable to find fastplay.sx video') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/gorillavid.py b/lib/urlresolver/plugins/gorillavid.py index f3a642f5..ccdf7f1c 100644 --- a/lib/urlresolver/plugins/gorillavid.py +++ b/lib/urlresolver/plugins/gorillavid.py @@ -16,34 +16,17 @@ along with this program. If not, see . """ -import re from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class GorillavidResolver(UrlResolver): name = "gorillavid" domains = ["gorillavid.in", "gorillavid.com"] pattern = '(?://|\.)(gorillavid\.(?:in|com))/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - resp = self.net.http_GET(web_url) - html = resp.content - r = re.findall(r"404 - Not Found", html) - if r: - raise ResolverError('File Not Found or removed') - post_url = resp.get_url() - form_values = helpers.get_hidden(html) - html = self.net.http_POST(post_url, form_data=form_values).content - r = re.search('file: "(.+?)"', html) - if r: - return r.group(1) - else: - raise ResolverError('Unable to resolve Gorillavid link') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://gorillavid.in/%s' % (media_id) diff --git a/lib/urlresolver/plugins/grifthost.py b/lib/urlresolver/plugins/grifthost.py index 4e2d96d8..01b0d158 100644 --- a/lib/urlresolver/plugins/grifthost.py +++ b/lib/urlresolver/plugins/grifthost.py @@ -16,13 +16,11 @@ along with this program. If not, see . """ -import re -import urllib from lib import helpers -from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class GrifthostResolver(UrlResolver): name = "grifthost" domains = ["grifthost.com"] @@ -33,26 +31,15 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content data = helpers.get_hidden(html) data['method_free'] = 'Proceed to Video' - html = self.net.http_POST(web_url, form_data=data).content - stream_url = '' - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - match2 = re.search('', html, re.DOTALL): packed_data = jsunpack.unpack(match.group(1)) source = re.search(r'file:\"(.*?)\"', packed_data).groups()[0] - + return source def __get_cookies(self, host, html): diff --git a/lib/urlresolver/plugins/idowatch.py b/lib/urlresolver/plugins/idowatch.py index 6e177607..82e2f711 100644 --- a/lib/urlresolver/plugins/idowatch.py +++ b/lib/urlresolver/plugins/idowatch.py @@ -16,40 +16,17 @@ along with this program. If not, see . """ -import re -import urllib -from lib import jsunpack -from urlresolver import common from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class IDoWatchResolver(UrlResolver): name = 'idowatch' domains = ['idowatch.net'] pattern = '(?://|\.)(idowatch\.net)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - if 'File Not Found' in html: - raise ResolverError('File Removed') - - try: html += jsunpack.unpack(re.search('(eval\(function.*?)', html, re.DOTALL).group(1)) - except: pass - - match = re.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html) - - if match: - stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) - stream_url = [i for i in stream_url if not i.endswith('smil')] - if stream_url: - return stream_url[0] + helpers.append_headers({'User-Agent': common.FF_USER_AGENT}) - - raise ResolverError('Unable to resolve idowatch link. Filelink not found.') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://idowatch.net/%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/indavideo.py b/lib/urlresolver/plugins/indavideo.py index 45398405..d6ecaf15 100644 --- a/lib/urlresolver/plugins/indavideo.py +++ b/lib/urlresolver/plugins/indavideo.py @@ -53,10 +53,8 @@ def get_media_url(self, host, media_id): sources = [(data['data']['video_file'].rsplit('/', 1)[0] + '/' + i) for i in flv_files] sources = [(i.rsplit('.', 2)[1] + 'p', i) for i in sources] sources = sorted(sources, key=lambda x: x[0])[::-1] - source = helpers.pick_source(sources) + return helpers.pick_source(sources) - return source - raise ResolverError('File not found') def get_url(self, host, media_id): diff --git a/lib/urlresolver/plugins/jetload.py b/lib/urlresolver/plugins/jetload.py index badbfa72..57cd2d8a 100644 --- a/lib/urlresolver/plugins/jetload.py +++ b/lib/urlresolver/plugins/jetload.py @@ -17,8 +17,6 @@ along with this program. If not, see . """ -import re -from urlresolver import common from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError @@ -29,16 +27,7 @@ class JetloadResolver(UrlResolver): pattern = '(?://|\.)(jetload\.tv)/(?:.+?embed\.php\?u=)?([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): - net = common.Net() - web_url = self.get_url(host, media_id) - - html = net.http_GET(web_url).content - - stream_url = re.compile('file\s*:\s*"(http.+?)"').findall(html) - if stream_url: - return stream_url[-1] + helpers.append_headers({'User-Agent': common.FF_USER_AGENT}) - - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/plugins/mediaplayer/site/_embed.php?u={media_id}') diff --git a/lib/urlresolver/plugins/letwatch.py b/lib/urlresolver/plugins/letwatch.py index 60eb0263..089059e3 100644 --- a/lib/urlresolver/plugins/letwatch.py +++ b/lib/urlresolver/plugins/letwatch.py @@ -16,9 +16,7 @@ along with this program. If not, see . ''' -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError @@ -27,31 +25,8 @@ class LetwatchResolver(UrlResolver): domains = ['letwatch.us', 'letwatch.to', 'vidshare.us'] pattern = '(?://|\.)(letwatch\.(?:us|to)|vidshare\.us)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - if 'Not Found' in html: - raise ResolverError('File Removed') - - if 'Video is processing' in html: - raise ResolverError('File still being processed') - - packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) - if packed: - js = jsunpack.unpack(packed.group(1)) - else: - js = html - - link = re.search('file\s*:\s*"([^"]+)', js) - if link: - #common.log_utils.log_debug('letwatch.us Link Found: %s' % link.group(1)) - return link.group(1) - - raise ResolverError('Unable to find letwatch.us video') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): - return self._default_get_url(host, media_id, 'http://{host}/embed-{media_id}-640x400.html') + return self._default_get_url(host, media_id, 'http://{host}/embed-{media_id}.html') diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 706b9dd4..7a9ad133 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -74,16 +74,69 @@ def parse_html5_source_list(html): sources = [(match[1], match[0].replace('\/', '/')) for match in re.findall(''' 1: + if i.group(2) is not None: + label = i.group(2) + sources += [(label, '%s playpath=%s' % (base, i.group(1)))] + return sources + +def scrape_sources(html, result_blacklist=None): def _parse_to_list(_html, regex): + _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', + '.srt', '.sub', '.xml', '.swf', '.vtt'] + if isinstance(result_blacklist, list): + _blacklist = list(set(_blacklist + result_blacklist)) matches = [] for i in re.finditer(regex, _html, re.DOTALL): match = i.group(1) - parsed_match = urlparse(match) - sub_label = parsed_match.path.split('.')[-1] - matches.append(('%s[%s]' % (parsed_match.hostname, sub_label), match)) + trimmed_path = urlparse(match).path.split('/')[-1] + if ('://' not in match) or (not trimmed_path) or (any(match == m[1] for m in matches)) or \ + (any(bl in trimmed_path.lower() for bl in _blacklist)): + continue + label = trimmed_path + if len(i.groups()) > 1: + if i.group(2) is not None: + label = i.group(2) + matches.append(('%s' % label, match)) + if matches: + common.log_utils.log_debug('Scrape sources |%s| found |%s|' % (regex, matches)) return matches + for packed in re.finditer('(eval\(function.*?)', html, re.DOTALL): + try: + unpacked_data = jsunpack.unpack(packed.group(1)) + unpacked_data = unpacked_data.replace('\\\'', '\'') + html += unpacked_data + except: + pass + + source_list = _parse_to_list(html, '''video[^><]+src\s*=\s*['"]([^'"]+)''') + source_list += _parse_to_list(html, '''source\s+src\s*=\s*['"]([^'"]+)''') + source_list += _parse_to_list(html, '''["']?\s*file\s*["']?\s*[:=,]?\s*["']([^"']+)(?:[^}>\],]?["',]?\s*label\s*["']?\s*[:=]?\s*["']([^"']+))?''') + source_list += _parse_to_list(html, '''["']?\s*url\s*["']?\s*[:=]\s*["']([^"']+)''') + source_list += _parse_to_list(html, '''param\s+name\s*=\s*"src"\s*value\s*=\s*"([^"]+)''') + + source_list = list(set(source_list)) + try: source_list.sort(key=lambda x: int(x[0]), reverse=True) + except: + common.log_utils.log_debug('Scrape sources sort failed |int(x[0])|') + try: source_list.sort(key=lambda x: int(x[0][:-1]), reverse=True) + except: + common.log_utils.log_debug('Scrape sources sort failed |int(x[0][:-1])|') + try: source_list.sort(key=lambda x: x[0], reverse=True) + except: + common.log_utils.log_debug('Scrape sources sort failed |x[0]|') + + return source_list + +def get_media_url(url, result_blacklist=None): + if not isinstance(result_blacklist, list): result_blacklist = [] + result_blacklist = list(set(result_blacklist + ['.smil'])) # smil(not playable) contains potential sources, only blacklist when called from here net = common.Net() parsed_url = urlparse(url) headers = {'User-Agent': common.FF_USER_AGENT, @@ -91,25 +144,12 @@ def _parse_to_list(_html, regex): response = net.http_GET(url, headers=headers) response_headers = response.get_headers(as_dict=True) + headers.update({'Referer': url}) cookie = response_headers.get('Set-Cookie', None) if cookie: headers.update({'Cookie': cookie}) html = response.content - unpacked = '' - for packed in re.finditer('(eval\(function.*?)', html, re.DOTALL): - try: - unpacked_data = jsunpack.unpack(packed.group(1)) - unpacked_data = unpacked_data.replace('\\\'', '\'') - unpacked += unpacked_data - except: - pass - - html += unpacked - source_list = _parse_to_list(html, '''video\s+src\s*=\s*['"]([^'"]+)''') - source_list += _parse_to_list(html, '''source\s+src\s*=\s*['"]([^'"]+)''') - source_list += _parse_to_list(html, '''["']?\s*file\s*["']?\s*[:=]\s*["']([^"']+)''') - source_list += _parse_to_list(html, '''["']?\s*url\s*["']?\s*[:=]\s*["']([^"']+)''') - + source_list = scrape_sources(html, result_blacklist) source = pick_source(source_list) return source + append_headers(headers) diff --git a/lib/urlresolver/plugins/megamp4.py b/lib/urlresolver/plugins/megamp4.py index 2bcccd23..4d2bb520 100644 --- a/lib/urlresolver/plugins/megamp4.py +++ b/lib/urlresolver/plugins/megamp4.py @@ -16,40 +16,17 @@ along with this program. If not, see . ''' -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class MegaMP4Resolver(UrlResolver): name = "megamp4.net" domains = ["megamp4.net"] pattern = '(?://|\.)(megamp4\.net)/(?:embed-|emb\.html\?|)([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content - - if 'was deleted' in html: - raise ResolverError('File Removed') - - - js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) - - for i in js_data: - try: html += jsunpack.unpack(i) - except: pass - - - link = re.search('file:"(.*?)",', html) - if link: - return link.group(1) - - raise ResolverError('Unable to find megamp4 video') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://megamp4.net/embed-%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index 7747f419..b063cc48 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -16,12 +16,11 @@ along with this program. If not, see . """ -import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class MovDivxResolver(UrlResolver): name = "movdivx" domains = ["movdivx.com"] @@ -32,25 +31,15 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content data = helpers.get_hidden(html) data['method_free'] = 'Continue to Stream >>' - html = self.net.http_POST(web_url, data).content - - # get url from packed javascript - sPattern = '(eval\(function\(p,a,c,k,e,d\).*?)' - for match in re.finditer(sPattern, html, re.DOTALL | re.IGNORECASE): - fragment = match.group(1) - js_data = jsunpack.unpack(fragment) - match = re.search('name="src"\s*value="([^"]+)', js_data) - if match: - return match.group(1) - else: - match = re.search('file\s*:\s*"([^"]+)', js_data) - if match: - return match.group(1) - - raise ResolverError('failed to parse link') + headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '') + html = self.net.http_POST(web_url, headers=headers, form_data=data).content + sources = helpers.scrape_sources(html) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://movdivx.com/%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/movpod.py b/lib/urlresolver/plugins/movpod.py index 0c69559d..6d03dbdf 100644 --- a/lib/urlresolver/plugins/movpod.py +++ b/lib/urlresolver/plugins/movpod.py @@ -16,11 +16,11 @@ along with this program. If not, see . """ -import re from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class MovpodResolver(UrlResolver): name = "movpod" domains = ["movpod.net", "movpod.in"] @@ -31,17 +31,14 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() - - form_values = helpers.get_hidden(html) - html = self.net.http_POST(post_url, form_data=form_values).content - r = re.search('file: "http(.+?)"', html) - if r: - return "http" + r.group(1) - else: - raise ResolverError('Unable to resolve Movpod Link') + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content + data = helpers.get_hidden(html) + headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '') + html = self.net.http_POST(response.get_url(), headers=headers, form_data=data).content + sources = helpers.scrape_sources(html) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://movpod.in/%s' % (media_id) diff --git a/lib/urlresolver/plugins/mp4engine.py b/lib/urlresolver/plugins/mp4engine.py index 8d57b8eb..28d89493 100644 --- a/lib/urlresolver/plugins/mp4engine.py +++ b/lib/urlresolver/plugins/mp4engine.py @@ -16,9 +16,7 @@ along with this program. If not, see . """ -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError @@ -27,25 +25,8 @@ class Mp4EngineResolver(UrlResolver): domains = ["mp4engine.com"] pattern = '(?://|\.)(mp4engine\.com)/(?:embed-)?([0-9a-zA-Z]+)(?:-[0-9]x[0-9].html)?' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) - - for i in js_data: - try: html += jsunpack.unpack(i) - except: pass - - match = re.search('''file:(?:\s+|\v+)?['|"]([^'"]+)['|"]''', html) - - if match: - return match.group(1).replace(" ", "%20") - - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)).replace(" ", "%20") def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/mp4stream.py b/lib/urlresolver/plugins/mp4stream.py index 13d76298..7086f224 100644 --- a/lib/urlresolver/plugins/mp4stream.py +++ b/lib/urlresolver/plugins/mp4stream.py @@ -16,44 +16,17 @@ along with this program. If not, see . """ - -import re -import urllib -from urlresolver import common from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class Mp4streamResolver(UrlResolver): name = "mp4stream" domains = ["mp4stream.com"] pattern = '(?://|\.)(mp4stream\.com)/embed/([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = { - 'Host': 'mp4stream.com', - 'Referer': 'https://www.mp4stream.com' - } - - response = self.net.http_GET(web_url, headers=headers) - - html = response.content - - headers = dict(response._response.info().items()) - - r = re.search('sources\s*:\s*(\[.*?\])', html, re.DOTALL) - - if r: - html = r.group(1) - r = re.search("'file'\s*:\s*'(.+?)'", html) - if r: - return r.group(1) + helpers.append_headers({'Cookie': headers['set-cookie']}) - else: - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://mp4stream.com/embed/%s' % media_id diff --git a/lib/urlresolver/plugins/mp4upload.py b/lib/urlresolver/plugins/mp4upload.py index f171c07f..a7f84855 100644 --- a/lib/urlresolver/plugins/mp4upload.py +++ b/lib/urlresolver/plugins/mp4upload.py @@ -16,24 +16,17 @@ along with this program. If not, see . """ - -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver + class Mp4uploadResolver(UrlResolver): name = "mp4upload" domains = ["mp4upload.com"] pattern = '(?://|\.)(mp4upload\.com)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - url = re.findall('(?:\"|\')file(?:\"|\')\s*:\s*(?:\"|\')(.+?)(?:\"|\')', html)[0] - return url + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['error.']) def get_url(self, host, media_id): return 'http://www.mp4upload.com/embed-%s.html' % media_id diff --git a/lib/urlresolver/plugins/myvidstream.py b/lib/urlresolver/plugins/myvidstream.py index e41a3c90..91609d38 100644 --- a/lib/urlresolver/plugins/myvidstream.py +++ b/lib/urlresolver/plugins/myvidstream.py @@ -16,41 +16,17 @@ along with this program. If not, see . """ -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError -MAX_TRIES = 3 class myVidStream(UrlResolver): name = "myvidstream" domains = ["myvidstream.net"] pattern = '(?://|\.)(myvidstream\.net)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - tries = 0 - while tries < MAX_TRIES: - data = {} - - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - js_data = js_data.replace('\\\'', '\'') - - match2 = re.search("\('file','([^']+)", js_data) - if match2: - stream_url = match2.group(1) - return stream_url.replace(" ", "%20") - - tries += 1 - - raise ResolverError('Unable to resolve myvidstream link. Filelink not found.') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/nosvideo.py b/lib/urlresolver/plugins/nosvideo.py index 64c3b535..fe0562cd 100644 --- a/lib/urlresolver/plugins/nosvideo.py +++ b/lib/urlresolver/plugins/nosvideo.py @@ -17,9 +17,11 @@ ''' import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class NosvideoResolver(UrlResolver): name = "nosvideo" domains = ["nosvideo.com", "noslocker.com"] @@ -30,28 +32,21 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content if 'File Not Found' in html: raise ResolverError('File Not Found') web_url = 'http://nosvideo.com/vj/video.php?u=%s&w=&h=530' % media_id - - html = self.net.http_GET(web_url).content + html = self.net.http_GET(web_url, headers=headers).content smil_url = re.compile('\':\'(.+?)\'').findall(html) smil_url = [i for i in smil_url if '.smil' in i][0] - html = self.net.http_GET(smil_url).content - - streamer = re.findall('base\s*=\s*"(.+?)"', html)[0] - playpath = re.findall('src\s*=\s*"(.+?)"', html)[0] - - stream_url = '%s playpath=%s' % (streamer, playpath) - - return stream_url + smil = self.net.http_GET(smil_url, headers=headers).content + sources = helpers.parse_smil_source_list(smil) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://nosvideo.com/%s' % media_id - diff --git a/lib/urlresolver/plugins/play44_net.py b/lib/urlresolver/plugins/play44_net.py index 7d75714a..18e38b90 100644 --- a/lib/urlresolver/plugins/play44_net.py +++ b/lib/urlresolver/plugins/play44_net.py @@ -16,29 +16,17 @@ along with this program. If not, see . """ -import re -import urllib -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class Play44Resolver(UrlResolver): name = "play44.net" domains = ["play44.net"] pattern = '(?://|\.)(play44\.net)/embed\.php?.*?vid=([0-9a-zA-Z_\-\./]+)[\?&]*' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - resp = self.net.http_GET(web_url) - html = resp.content - r = re.search("playlist:\s*\n*\s*\[\s*\n*\s*\{\s*\n*\s*\s*\n*\s*url\s*:\s*'(.+?)'", html) - if r: - stream_url = urllib.unquote_plus(r.group(1)) - else: - raise ResolverError('no file located') - return stream_url + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['%']) def get_url(self, host, media_id): return 'http://play44.net/embed.php?&vid=%s' % (media_id) diff --git a/lib/urlresolver/plugins/playedto.py b/lib/urlresolver/plugins/playedto.py index 85f2d841..e8b33378 100644 --- a/lib/urlresolver/plugins/playedto.py +++ b/lib/urlresolver/plugins/playedto.py @@ -16,29 +16,17 @@ along with this program. If not, see . ''' -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class PlayedtoResolver(UrlResolver): name = "playedto" domains = ["playedto.me"] pattern = '(?://|\.)(playedto\.me)/(?:embed-|)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - 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.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html) - if match: - stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) - stream_url = [i for i in stream_url if not i.endswith('smil')] - if stream_url: - return stream_url[0] - - raise ResolverError('File Not Found or removed') - + return helpers.get_media_url(self.get_url(host, media_id)) + def get_url(self, host, media_id): return 'http://playedto.me/embed-%s.html' % media_id diff --git a/lib/urlresolver/plugins/playhd.py b/lib/urlresolver/plugins/playhd.py index 4d34d98c..4bd7f57b 100644 --- a/lib/urlresolver/plugins/playhd.py +++ b/lib/urlresolver/plugins/playhd.py @@ -16,8 +16,6 @@ along with this program. If not, see . """ -import re -from urlresolver import common from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError @@ -25,21 +23,10 @@ class PlayHDResolver(UrlResolver): name = "playhd.video" domains = ["www.playhd.video", "www.playhd.fo"] - pattern = '(?://|\.)(playhd\.(?:video|fo))/embed\.php?.*?vid=([0-9]+)[\?&]*' - - def __init__(self): - self.net = common.Net() + pattern = '(?://|\.)(playhd\.(?:video|fo))/(?:embed\.php?.*?vid=|video/)([0-9]+)' def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - url = 'http://www.%s/' % (host) - resp = self.net.http_GET(url) - headers = resp.get_headers(as_dict=True) - headers = {'Cookie': headers.get('set-cookie', ''), 'User-Agent': common.FF_USER_AGENT, 'Referer': web_url} - html = self.net.http_GET(web_url, headers=headers).content - sources = helpers.parse_html5_source_list(html) - source = helpers.pick_source(sources) - return source + helpers.append_headers(headers) + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://www.playhd.video/embed.php?vid=%s' % (media_id) diff --git a/lib/urlresolver/plugins/playu.py b/lib/urlresolver/plugins/playu.py index a35ff780..fa12530b 100644 --- a/lib/urlresolver/plugins/playu.py +++ b/lib/urlresolver/plugins/playu.py @@ -16,11 +16,11 @@ along with this program. If not, see . """ - -import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class PlayUResolver(UrlResolver): name = "playu" domains = ["playu.net", "playu.me"] @@ -31,15 +31,16 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - if 'was deleted' in link : - raise ResolverError('File Removed') - - r = re.search('file\s*:\s*"(http[^"]+)', link) - if r: - return r.group(1) - - raise ResolverError('Unable to find playu.net video') + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content + headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '') + sources = helpers.scrape_sources(html, result_blacklist=['dl', '.mp4']) # mp4 fails + source = helpers.pick_source(sources) + if '.smil' in source: + smil = self.net.http_GET(source, headers=headers).content + sources = helpers.parse_smil_source_list(smil) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://playu.me/embed-%s.html' % media_id diff --git a/lib/urlresolver/plugins/powerwatch.py b/lib/urlresolver/plugins/powerwatch.py index 4af45c29..4c74901c 100644 --- a/lib/urlresolver/plugins/powerwatch.py +++ b/lib/urlresolver/plugins/powerwatch.py @@ -16,11 +16,11 @@ along with this program. If not, see . """ -import re from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class PowerwatchResolver(UrlResolver): name = "powerwatch" domains = ["powerwatch.pw"] @@ -31,23 +31,15 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() - - if re.search('>(File Not Found)<', html): - raise ResolverError('File Not Found or removed') - - common.kodi.sleep(5000) - + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content data = helpers.get_hidden(html) - html = self.net.http_POST(post_url, data).content - - r = re.search('file:"(.+?)",', html) - if r: - return r.group(1) - else: - raise ResolverError('File Not Found or removed') + common.kodi.sleep(5000) + headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '') + html = self.net.http_POST(response.get_url(), headers=headers, form_data=data).content + sources = helpers.scrape_sources(html) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/{media_id}') diff --git a/lib/urlresolver/plugins/promptfile.py b/lib/urlresolver/plugins/promptfile.py index 2ed1d92a..7bea691f 100644 --- a/lib/urlresolver/plugins/promptfile.py +++ b/lib/urlresolver/plugins/promptfile.py @@ -16,11 +16,11 @@ along with this program. If not, see . ''' import re -import urllib2 from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class PromptfileResolver(UrlResolver): name = "promptfile" domains = ["promptfile.com"] @@ -38,20 +38,15 @@ def get_media_url(self, host, media_id): data = helpers.get_hidden(html) for name in data: data[name] = prefix + data[name] - - common.log_utils.log(data) + headers['Referer'] = web_url html = self.net.http_POST(web_url, form_data=data, headers=headers).content - html = re.search(r'clip\s*:\s*\{.*?(?:url|src)\s*:\s*[\"\'](.+?)[\"\']', html, re.DOTALL) - if not html: + match = re.search('''clip\s*:\s*\{.*?(?:url|src)\s*:\s*["'](?P[^"']+)["']''', html, re.DOTALL) + if not match: raise ResolverError('File Not Found or removed') - - stream_url = html.group(1) - req = urllib2.Request(stream_url) - for key in headers: - req.add_header(key, headers[key]) - stream_url = urllib2.urlopen(req).geturl() - return stream_url + '|User-Agent=%s&Referer=%s' % (common.FF_USER_AGENT, web_url) + + source = self.net.http_GET(match.group('url'), headers=headers).get_url() + return source + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://www.promptfile.com/l/%s' % (media_id) diff --git a/lib/urlresolver/plugins/putload.py b/lib/urlresolver/plugins/putload.py index c1997255..f64ac807 100644 --- a/lib/urlresolver/plugins/putload.py +++ b/lib/urlresolver/plugins/putload.py @@ -17,17 +17,14 @@ ''' from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class PutLoadResolver(UrlResolver): name = "putload.tv" domains = ["putload.tv", "youlolx.site", "youlol.biz", "shitmovie.com"] pattern = '(?://|\.)((?:putload\.tv|youlol[x]?\.(?:site|biz)|shitmovie\.com))/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): return helpers.get_media_url(self.get_url(host, media_id)) diff --git a/lib/urlresolver/plugins/rapidvideo.py b/lib/urlresolver/plugins/rapidvideo.py index 488e325d..500a622c 100644 --- a/lib/urlresolver/plugins/rapidvideo.py +++ b/lib/urlresolver/plugins/rapidvideo.py @@ -16,36 +16,17 @@ along with this program. If not, see . """ -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class RapidVideoResolver(UrlResolver): name = "rapidvideo.ws" domains = ["rapidvideo.ws"] - pattern = '(?://|\.)(rapidvideo\.ws)/(?:embed-|)?([0-9A-Za-z]+)' - - def __init__(self): - self.net = common.Net() + pattern = '(?://|\.)(rapidvideo\.ws)/(?:embed[/-])?([0-9A-Za-z]+)' def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content - - for match in re.finditer('(eval\(function\(.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - js_data = js_data.replace('\\\'', '\'') - - stream_url = re.findall('. ''' -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class SpeedPlayResolver(UrlResolver): name = "speedplay.xyz" domains = ["speedplay.xyz", "speedplay.us", "speedplay1.site", "speedplay.pw", "speedplay3.pw", "speedplayy.site"] pattern = '(?://|\.)(speedplay[0-9a-z]?\.(?:us|xyz|pw|site))/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - if 'File was deleted' in html: - raise ResolverError('File was deleted') - - if 'Video is processing' in html: - raise ResolverError('File still being processed') - - link = re.search('(?:m3u8").*?"(.*?)"', html) - if link: - return link.group(1) - - link = re.search('file:"(.*?)",', html) - if link: - return link.group(1) - - raise ResolverError('Unable to find speedplay video') + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['dl']) def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/embed-{media_id}.html') - diff --git a/lib/urlresolver/plugins/stagevu.py b/lib/urlresolver/plugins/stagevu.py index 630a368f..c68ed7d3 100644 --- a/lib/urlresolver/plugins/stagevu.py +++ b/lib/urlresolver/plugins/stagevu.py @@ -16,27 +16,17 @@ along with this program. If not, see . ''' -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class StagevuResolver(UrlResolver): name = "stagevu" domains = ["stagevu.com"] pattern = '(?://|\.)(stagevu\.com)/(?:video/|embed.+?uid=)?([A-Za-z0-9]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - p = re.compile('type="video/.+?"\s+src="(.+?)"') - match = p.findall(link) - if match: - return match[0] - else: - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://www.stagevu.com/video/%s' % media_id diff --git a/lib/urlresolver/plugins/streamcloud.py b/lib/urlresolver/plugins/streamcloud.py index 8ece9ce4..e2f165cd 100644 --- a/lib/urlresolver/plugins/streamcloud.py +++ b/lib/urlresolver/plugins/streamcloud.py @@ -17,9 +17,11 @@ """ import re +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class StreamcloudResolver(UrlResolver): name = "streamcloud" domains = ["streamcloud.eu"] @@ -30,22 +32,19 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - resp = self.net.http_GET(web_url) - html = resp.content - post_url = resp.get_url() + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content if re.search('>(File Not Found)<', html): raise ResolverError('File Not Found or removed') - form_values = {} + data = {} for i in re.finditer('', html): - form_values[i.group(1)] = i.group(2).replace("download1", "download2") - html = self.net.http_POST(post_url, form_data=form_values).content - - r = re.search('file: "(.+?)",', html) - if r: - return r.group(1) - else: - raise ResolverError('File Not Found or removed') + data[i.group(1)] = i.group(2).replace("download1", "download2") + headers['Cookie'] = response.get_headers(as_dict=True).get('Set-Cookie', '') + html = self.net.http_POST(response.get_url(), headers=headers, form_data=data).content + sources = helpers.scrape_sources(html) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://streamcloud.eu/%s' % (media_id) diff --git a/lib/urlresolver/plugins/streamenet.py b/lib/urlresolver/plugins/streamenet.py index 1fc0e1e5..8b4943ee 100644 --- a/lib/urlresolver/plugins/streamenet.py +++ b/lib/urlresolver/plugins/streamenet.py @@ -19,36 +19,17 @@ along with this program. If not, see . """ -import re from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class EstreamResolver(UrlResolver): name = "streame.net" domains = ['streame.net'] pattern = '(?://|\.)(streame\.net)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url} - html = self.net.http_GET(web_url, headers=headers).content - sources = self.__parse_sources_list(html) - source = helpers.pick_source(sources) - return source + helpers.append_headers(headers) - - def __parse_sources_list(self, html): - sources = [] - match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) - if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): - stream_url, label = match.groups() - stream_url = stream_url.replace('\/', '/') - sources.append((label, stream_url)) - return sources - + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['dl']).replace('\/', '/') + def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/thevideos.py b/lib/urlresolver/plugins/thevideos.py index d522f660..11a9f7f5 100644 --- a/lib/urlresolver/plugins/thevideos.py +++ b/lib/urlresolver/plugins/thevideos.py @@ -15,34 +15,18 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import re + from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class TheVideosResolver(UrlResolver): name = "thevideos" domains = ['thevideos.tv'] pattern = '(?://|\.)(thevideos\.tv)/(?:embed-)?([0-9A-Za-z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.FF_USER_AGENT} - html = self.net.http_GET(web_url, headers=headers).content - sources = [] - match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) - if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): - stream_url, label = match.groups() - sources.append((label, stream_url)) - - try: sources.sort(key=lambda x: int(x[0][:-1]), reverse=True) - except: pass - source = helpers.pick_source(sources) - return source + helpers.append_headers({'User-Agent': common.FF_USER_AGENT}) + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/trollvid.py b/lib/urlresolver/plugins/trollvid.py index f3b45bdd..9c97394e 100644 --- a/lib/urlresolver/plugins/trollvid.py +++ b/lib/urlresolver/plugins/trollvid.py @@ -20,7 +20,7 @@ import base64 import urllib from urlresolver import common -from urlresolver.resolver import UrlResolver +from urlresolver.resolver import UrlResolver, ResolverError class TrollVidResolver(UrlResolver): name = 'trollvid.net' @@ -34,7 +34,7 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content - + stream_url = None try: stream_url = re.search('url\s*:\s*"(http.+?)"', html).group(1) except: pass @@ -44,9 +44,10 @@ def get_media_url(self, host, media_id): try: stream_url = base64.b64decode(re.search('atob\(\'(.+?)\'', html).group(1)) except: pass - stream_url = urllib.unquote_plus(stream_url) + if not stream_url: + raise ResolverError('File not found') - return stream_url + return urllib.unquote_plus(stream_url) def get_url(self, host, media_id): return 'http://trollvid.net/embed/%s' % media_id diff --git a/lib/urlresolver/plugins/tusfiles.py b/lib/urlresolver/plugins/tusfiles.py index 99486c57..6e4c80f0 100644 --- a/lib/urlresolver/plugins/tusfiles.py +++ b/lib/urlresolver/plugins/tusfiles.py @@ -15,34 +15,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import re -from lib import jsunpack -from urlresolver import common + +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class TusfilesResolver(UrlResolver): name = "tusfiles" domains = ['tusfiles.net'] pattern = '(?://|\.)(tusfiles\.net)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): direct_url = 'http://%s/%s' % (host, media_id) for web_url in [self.get_url(host, media_id), direct_url]: - html = self.net.http_GET(web_url).content - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - - stream_url = re.findall('. """ -import re -import urllib -from lib import jsunpack -from urlresolver import common + from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class UploadcResolver(UrlResolver): name = 'uploadc' domains = ['uploadc.com', 'uploadc.ch', 'zalaa.com'] pattern = '(?://|\.)(uploadc.com|uploadc.ch|zalaa.com)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - r = re.search('src="([^"]+)', js_data) - if r: - stream_url = r.group(1).replace(' ', '%20') - stream_url += helpers.append_headers({'Referer': web_url}) - return stream_url - - match = re.search("'file'\s*,\s*'([^']+)", html) - if match: - stream_url = match.group(1).replace(' ', '%20') - stream_url += helpers.append_headers({'Referer': web_url}) - return stream_url - - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)).replace(' ', '%20') def get_url(self, host, media_id): return 'http://uploadc.com/embed-%s.html' % (media_id) diff --git a/lib/urlresolver/plugins/userscloud.py b/lib/urlresolver/plugins/userscloud.py index d19472ba..6f4de5b1 100644 --- a/lib/urlresolver/plugins/userscloud.py +++ b/lib/urlresolver/plugins/userscloud.py @@ -16,40 +16,17 @@ along with this program. If not, see . """ -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class UsersCloudResolver(UrlResolver): name = "userscloud" domains = ["userscloud.com"] pattern = '(?://|\.)(userscloud\.com)/(?:embed-)?([0-9a-zA-Z/]+)' - def __init__(self): - self.net = common.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\).+?)', html, re.DOTALL) - - try: html += jsunpack.unpack(r.group(1)) - except: pass - - stream_url = re.findall('. """ -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class UsersFilesResolver(UrlResolver): name = "UsersFiles" domains = ["usersfiles.com"] pattern = '(?://|\.)(usersfiles\.com)/(?:embed-)?([0-9a-zA-Z/]+)' - def __init__(self): - self.net = common.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(']*>(eval.*?)', html, re.DOTALL) - if match: - js_data = jsunpack.unpack(match.group(1)) - - stream_url = re.findall('. """ -import re -import urllib -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class VidCrazyResolver(UrlResolver): name = 'vidcrazy.net' domains = ['vidcrazy.net', 'uploadcrazy.net'] pattern = '(?://|\.)(vidcrazy.net|uploadcrazy.net)/\D+.php\?file=([0-9a-zA-Z\-_]+)' - def __init__(self): - self.net = common.Net() - 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("'file'\s*:\s*'(.+?)'", html) - if r: - stream_url = urllib.unquote_plus(r.group(1)) - else: - raise ResolverError('no file located') - return stream_url + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://vidcrazy.net/embed.php?file=%s' % (media_id) diff --git a/lib/urlresolver/plugins/videobee.py b/lib/urlresolver/plugins/videobee.py index 22ce608e..a450439b 100644 --- a/lib/urlresolver/plugins/videobee.py +++ b/lib/urlresolver/plugins/videobee.py @@ -16,38 +16,17 @@ along with this program. If not, see . ''' -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class VideoBeeResolver(UrlResolver): name = "thevideobee.to" domains = ["thevideobee.to"] pattern = '(?://|\.)(thevideobee\.to)/(?:embed-)?([0-9A-Za-z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - js_data = re.findall('(eval\(function.*?)', html.replace('\n', '')) - - for i in js_data: - try: html += jsunpack.unpack(i) - except: pass - - stream_url = re.findall('. ''' -import re from lib import helpers -from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class VidMadResolver(UrlResolver): name = "vidmad.net" domains = ["vidmad.net", "tamildrive.com"] @@ -32,29 +31,17 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content if 'Not Found' in html: raise ResolverError('File Removed') if 'Video is processing' in html: raise ResolverError('File still being processed') - packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) - if packed: - js = jsunpack.unpack(packed.group(1)) - else: - js = html - - match = re.search('sources\s*:\s*\[(.*?)\]', js, re.DOTALL) - if match: - sources = eval(match.group(1).replace('file', '"file"').replace('label', '"label"')) - if 'label' not in sources[0]: - sources[0]['label'] = 'HLS' - sources = [(s['label'], s['file']) for s in sources] - return helpers.pick_source(sources) - - raise ResolverError('Unable to find %s video' % (host)) + sources = helpers.scrape_sources(html) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/vidto.py b/lib/urlresolver/plugins/vidto.py index 9838a336..acbdf1da 100644 --- a/lib/urlresolver/plugins/vidto.py +++ b/lib/urlresolver/plugins/vidto.py @@ -21,6 +21,7 @@ from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class VidtoResolver(UrlResolver): name = "vidto" domains = ["vidto.me"] @@ -31,25 +32,21 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content + headers = {'User-Agent': common.FF_USER_AGENT} + html = self.net.http_GET(web_url, headers=headers).content if jsunpack.detect(html): js_data = jsunpack.unpack(html) sources = [] - stream_url = '' for match in re.finditer('label:\s*"([^"]+)"\s*,\s*file:\s*"([^"]+)', js_data): label, stream_url = match.groups() sources.append((label, stream_url)) if sources: sources = sorted(sources, key=lambda x: x[0])[::-1] - source = helpers.pick_source(sources) - - if source: - return source - + return helpers.pick_source(sources) + helpers.append_headers(headers) + raise ResolverError("File Link Not Found") def get_url(self, host, media_id): diff --git a/lib/urlresolver/plugins/vidup_org.py b/lib/urlresolver/plugins/vidup_org.py index 50de193f..4bdc6797 100644 --- a/lib/urlresolver/plugins/vidup_org.py +++ b/lib/urlresolver/plugins/vidup_org.py @@ -14,28 +14,17 @@ along with this program. If not, see . """ -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class VidUpResolver(UrlResolver): name = "vidup.org" domains = ["vidup.org"] pattern = '(?://|\.)(vidup\.org)/(?:embed\.php\?file=)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - 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("clip:\s+{\s+url:\s\"([^\"']+)", html) - if match: - stream_url = match.group(1) - return stream_url.replace(" ", "%20") - - raise ResolverError('Unable to resolve vidup.org link. Filelink not found.') + return helpers.get_media_url(self.get_url(host, media_id)).replace(" ", "%20") def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/embed.php?file={media_id}') diff --git a/lib/urlresolver/plugins/vidzi.py b/lib/urlresolver/plugins/vidzi.py index 475881f2..e32d1c53 100644 --- a/lib/urlresolver/plugins/vidzi.py +++ b/lib/urlresolver/plugins/vidzi.py @@ -16,39 +16,17 @@ along with this program. If not, see . ''' -import re -import urllib -from lib import jsunpack from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class VidziResolver(UrlResolver): name = "vidzi" domains = ["vidzi.tv"] pattern = '(?://|\.)(vidzi\.tv)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - if '404 Not Found' in html: - raise ResolverError('File Not Found or removed') - - r = re.search('file\s*:\s*"([^"]+)', html) - if r: - return r.group(1) + helpers.append_headers({'Referer': 'http://vidzi.tv/nplayer/jwplayer.flash.swf'}) - else: - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - r = re.search('file\s*:\s*"([^"]+)', js_data) - if r: - return r.group(1) - - raise ResolverError('Unable to locate link') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/vodlocker.py b/lib/urlresolver/plugins/vodlocker.py index 3f283123..3d916a68 100644 --- a/lib/urlresolver/plugins/vodlocker.py +++ b/lib/urlresolver/plugins/vodlocker.py @@ -16,30 +16,17 @@ along with this program. If not, see . """ -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class VodlockerResolver(UrlResolver): name = "vodlocker.com" domains = ["vodlocker.com"] pattern = '(?://|\.)(vodlocker\.com)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - if 'FILE WAS DELETED' in link: - raise ResolverError('File deleted.') - - video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0]) - - if len(video_link) > 0: - return video_link - else: - raise ResolverError('No playable video found.') + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['dl']) def get_url(self, host, media_id): return 'http://vodlocker.com/embed-%s-640x400.html' % media_id diff --git a/lib/urlresolver/plugins/vodmine.py b/lib/urlresolver/plugins/vodmine.py index 454c7341..26cb73d8 100644 --- a/lib/urlresolver/plugins/vodmine.py +++ b/lib/urlresolver/plugins/vodmine.py @@ -15,11 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import re -import urllib -from urlresolver import common -from urlresolver.resolver import UrlResolver, ResolverError +from lib import helpers +from urlresolver.resolver import UrlResolver, ResolverError class VodmineResolver(UrlResolver): @@ -27,26 +25,8 @@ class VodmineResolver(UrlResolver): domains = ['vodmine.com'] pattern = '(?://|\.)(vodmine\.com)/(?:video|embed)/([0-9a-zA-Z]+)' - - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = {'User-Agent': common.FF_USER_AGENT} - - html = self.net.http_GET(web_url, headers=headers).content - - url = re.findall('. """ -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class VshareResolver(UrlResolver): name = "vshare" domains = ['vshare.io'] pattern = '(?://|\.)(vshare\.io)/\w?/(\w+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - link = self.net.http_GET(web_url).content - if link.find('404 - Error') >= 0: - raise ResolverError('The requested video was not found.') - - video_link = str(re.compile("url[: ]*'(.+?)'").findall(link)[0]) - if len(video_link) > 0: - return video_link - else: - raise ResolverError('No playable video found.') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://vshare.io/v/%s/width-620/height-280/' % media_id diff --git a/lib/urlresolver/plugins/vshareeu.py b/lib/urlresolver/plugins/vshareeu.py index e6ac44ba..4f46efc6 100644 --- a/lib/urlresolver/plugins/vshareeu.py +++ b/lib/urlresolver/plugins/vshareeu.py @@ -16,12 +16,11 @@ along with this program. If not, see . """ -import re from lib import helpers -from lib import jsunpack from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class VshareEuResolver(UrlResolver): name = "vshare.eu" domains = ['vshare.eu'] @@ -33,10 +32,8 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - headers = { - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': common.FF_USER_AGENT - } + headers = {'Upgrade-Insecure-Requests': '1', + 'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content @@ -46,20 +43,12 @@ def get_media_url(self, host, media_id): data = helpers.get_hidden(html) data['method_free'] = 'Proceed+to+video' headers['Referer'] = web_url - html = self.net.http_POST(web_url, data, headers=headers).content - - match = re.search('file\s*:\s*"([^"]+)', html) - - if match: - return match.group(1) - else: - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - match = re.search('''file\s*:\s*['"]([^"']+)''', js_data) - if match: - return match.group(1) - - raise ResolverError('No playable video found.') + response = self.net.http_POST(web_url, data, headers=headers) + html = response.content + headers = {'Cookie': response.get_headers(as_dict=True).get('Set-Cookie', ''), + 'User-Agent': common.FF_USER_AGENT} + sources = helpers.scrape_sources(html) + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://vshare.eu/%s' % (media_id) diff --git a/lib/urlresolver/plugins/watchonline.py b/lib/urlresolver/plugins/watchonline.py index 3beeec0b..6f7e24d1 100644 --- a/lib/urlresolver/plugins/watchonline.py +++ b/lib/urlresolver/plugins/watchonline.py @@ -18,11 +18,11 @@ """ import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class WatchonlineResolver(UrlResolver): name = "watchonline" domains = ["watchonline.to"] @@ -34,26 +34,24 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} - + html = self.net.http_GET(web_url, headers=headers).content match = re.search('file\s*:\s*["\']([^"\']+)', html) if not match: - ResolverError('File Not Found or removed') + raise ResolverError('File Not Found or removed') else: source = match.group(1) - + html = self.net.http_GET(source).content html = html.replace('\n', '') - + sources = re.findall('RESOLUTION\s*=\s*([^,]+).+?(http[^\#]+)', html) + sources.sort(key=lambda x: int(x[0].split('x')[0]), reverse=True) if not sources: - ResolverError('File Not Found or removed') + raise ResolverError('File Not Found or removed') else: - source = helpers.pick_source(sources) - return source - - raise ResolverError('File not found') + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'http://www.%s/embed-%s.html' % (host, media_id) diff --git a/lib/urlresolver/plugins/watchvideo.py b/lib/urlresolver/plugins/watchvideo.py index b79a9409..fa0a4a5b 100644 --- a/lib/urlresolver/plugins/watchvideo.py +++ b/lib/urlresolver/plugins/watchvideo.py @@ -16,11 +16,10 @@ along with this program. If not, see . ''' -import re -from lib import jsunpack -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class WatchVideoResolver(UrlResolver): name = "watchvideo" domains = ["watchvideo.us", "watchvideo2.us", "watchvideo3.us", @@ -29,32 +28,8 @@ class WatchVideoResolver(UrlResolver): "watchvideo10.us"] pattern = '(?://|\.)(watchvideo[0-9]?[0-9]?\.us)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content - - if 'File was deleted' in html: - raise ResolverError('File Removed') - - if 'Video is processing' in html: - raise ResolverError('File still being processed') - - packed = re.search('(eval\(function.*?)\s*', html, re.DOTALL) - if packed: - js = jsunpack.unpack(packed.group(1)) - else: - js = html - - link = re.search('file:"(.*?m3u8)"', js) - #link = re.search('(?:m3u8").*?"(.*?)"', js) - if link: - common.log_utils.log_debug('watchvideo.us Link Found: %s' % link.group(1)) - return link.group(1) - - raise ResolverError('Unable to find watchvideo.us video') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/{media_id}.html') diff --git a/lib/urlresolver/plugins/weshare.py b/lib/urlresolver/plugins/weshare.py index 4f91f702..27821768 100644 --- a/lib/urlresolver/plugins/weshare.py +++ b/lib/urlresolver/plugins/weshare.py @@ -21,6 +21,7 @@ from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class WeShareResolver(UrlResolver): name = "weshare.me" domains = ["weshare.me"] @@ -33,18 +34,14 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content - match = re.search(''']+src=["']([^'"]+)[^>]+type=['"]video''', html) - if match: - return match.group(1) + helpers.append_headers({'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}) - - match = re.search('''{\s*file\s*:\s*['"]([^'"]+)''', html, re.DOTALL) - if not match: + sources = helpers.scrape_sources(html) + if not sources: match = re.search('''href="([^"]+)[^>]+>\(download\)''', html, re.DOTALL) + if match: + sources = [('Download', match.group(1))] - if match: - return match.group(1) + helpers.append_headers({'User-Agent': common.FF_USER_AGENT, 'Referer': web_url}) - - raise ResolverError('Unable to resolve weshare link. Filelink not found.') + headers['Referer'] = web_url + return helpers.pick_source(sources) + helpers.append_headers(headers) def get_url(self, host, media_id): return 'https://weshare.me/services/mediaplayer/site/_embed.max.php?u=%s' % (media_id) diff --git a/lib/urlresolver/plugins/xvidstage.py b/lib/urlresolver/plugins/xvidstage.py index c282a170..263c0923 100644 --- a/lib/urlresolver/plugins/xvidstage.py +++ b/lib/urlresolver/plugins/xvidstage.py @@ -16,12 +16,11 @@ along with this program. If not, see . """ -import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class XvidstageResolver(UrlResolver): name = "xvidstage" domains = ["xvidstage.com"] @@ -32,22 +31,15 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - html = self.net.http_GET(web_url).content + headers = {'User-Agent': common.FF_USER_AGENT} + response = self.net.http_GET(web_url, headers=headers) + html = response.content data = helpers.get_hidden(html) data['method_free'] = 'Continue to video / Continue to Free Download' - html = self.net.http_POST(web_url, form_data=data).content - - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - html += jsunpack.unpack(match.group(1)) - html = html.replace('\\', '') - - stream_url = re.findall('. """ -import re -import urllib2 +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class YourUploadResolver(UrlResolver): name = "yourupload.com" domains = ["yourupload.com", "yucache.net"] @@ -30,23 +30,8 @@ def __init__(self): self.net = common.Net() def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - headers = { - 'User-Agent': common.IE_USER_AGENT, - 'Referer': web_url - } - - html = self.net.http_GET(web_url, headers=headers).content - - r = re.search("file\s*:\s*'(.+?)'", html) - if r: - stream_url = r.group(1) - stream_url = urllib2.urlopen(urllib2.Request(stream_url, headers=headers)).geturl() - - return stream_url - else: - raise ResolverError('no file located') + web_url = self.net.http_HEAD(self.get_url(host, media_id)).get_url() + return helpers.get_media_url(web_url, result_blacklist=None) def get_url(self, host, media_id): return 'http://www.yourupload.com/embed/%s' % media_id diff --git a/lib/urlresolver/plugins/youwatch.py b/lib/urlresolver/plugins/youwatch.py index a5778f57..2e6daf65 100644 --- a/lib/urlresolver/plugins/youwatch.py +++ b/lib/urlresolver/plugins/youwatch.py @@ -17,14 +17,13 @@ along with this program. If not, see . """ import re -import urllib -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError MAX_TRIES = 5 + class YouWatchResolver(UrlResolver): name = "youwatch" domains = ["youwatch.org", "chouhaa.info"] @@ -35,12 +34,13 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) - web_url = self.net.http_GET(web_url)._response.url - headers = {'Referer': web_url} + headers = {'User-Agent': common.FF_USER_AGENT} + web_url = self.net.http_HEAD(web_url, headers=headers).get_url() + headers['Referer'] = web_url tries = 0 while tries < MAX_TRIES: - html = self.net.http_GET(web_url).content + html = self.net.http_GET(web_url, headers=headers).content html = html.replace('\n', '') r = re.search('. """ - -import re -from urlresolver import common +from lib import helpers from urlresolver.resolver import UrlResolver, ResolverError + class ZstreamResolver(UrlResolver): name = 'zstream.to' domains = ['zstream.to'] pattern = '(?://|\.)(zstream\.to)/(?:embed-)?([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - def get_media_url(self, host, media_id): - web_url = self.get_url(host, media_id) - - html = self.net.http_GET(web_url).content - - stream_url = re.compile('file *: *"(http.+?)"').findall(html) - stream_url = [i for i in stream_url if not i.endswith('.srt')] - - if stream_url: - return stream_url[-1] - - raise ResolverError('File Not Found or removed') + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://zstream.to/embed-%s.html' % media_id From a895ff14e51905cd7bc22f16788c1d028f5652f6 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 11 Nov 2016 12:03:50 -0500 Subject: [PATCH 1264/1360] vidlox --- lib/urlresolver/plugins/vidlox.py | 40 +++---------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/lib/urlresolver/plugins/vidlox.py b/lib/urlresolver/plugins/vidlox.py index 68888587..af4f8f6b 100644 --- a/lib/urlresolver/plugins/vidlox.py +++ b/lib/urlresolver/plugins/vidlox.py @@ -19,51 +19,17 @@ along with this program. If not, see . """ -import re from lib import helpers -from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class VidloxResolver(UrlResolver): name = "vidlox" domains = ['vidlox.tv'] pattern = '(?://|\.)(vidlox\.tv)/([0-9a-zA-Z]+)' - def __init__(self): - self.net = common.Net() - - def get_media_url(self, host, media_id): # needs fix - web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url} - html = self.net.http_GET(web_url, headers=headers).content - - data = helpers.get_hidden(html) - data['imhuman'] = 'Proceed to this video' - common.kodi.sleep(5000) - cookies = self.__get_cookies(html, web_url) - headers.update({'Cookie': "; ".join("=".join((str(k),str(v))) for k,v in cookies.items())}) - - html = self.net.http_POST(web_url, data, headers=headers).content - sources = self.__parse_sources_list(html) - source = helpers.pick_source(sources) - return source + helpers.append_headers(headers) + def get_media_url(self, host, media_id): + return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['dl']) - def __get_cookies(self, html, web_url): - cookies = {'ref_url': web_url} - for match in re.finditer("\$\.cookie\(\s*'([^']+)'\s*,\s*'([^']+)", html): - key, value = match.groups() - cookies[key] = value - return cookies - - def __parse_sources_list(self, html): - sources = [] - match = re.search('sources\s*:\s*\[(.*?)\]', html, re.DOTALL) - if match: - for match in re.finditer('''['"]?file['"]?\s*:\s*['"]([^'"]+)['"][^}]*['"]?label['"]?\s*:\s*['"]([^'"]*)''', match.group(1), re.DOTALL): - stream_url, label = match.groups() - stream_url = stream_url.replace('\/', '/') - sources.append((label, stream_url)) - return sources - def get_url(self, host, media_id): return self._default_get_url(host, media_id, 'http://{host}/{media_id}') From 9a31ff13c55e48e4c5bdee2f5eadb12eb4173d8e Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 11 Nov 2016 12:37:48 -0500 Subject: [PATCH 1265/1360] vidcrazynet --- lib/urlresolver/plugins/vidcrazynet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/vidcrazynet.py b/lib/urlresolver/plugins/vidcrazynet.py index 783d1940..3a02f566 100644 --- a/lib/urlresolver/plugins/vidcrazynet.py +++ b/lib/urlresolver/plugins/vidcrazynet.py @@ -29,4 +29,4 @@ def get_media_url(self, host, media_id): return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): - return 'http://vidcrazy.net/embed.php?file=%s' % (media_id) + return self._default_get_url('uploadcrazy.net', media_id, template='http://{host}/embed.php?file={media_id}') From f7f8ef239a41cdc3e073541ac18397f64a90ff1f Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 12:38:03 -0500 Subject: [PATCH 1266/1360] add submit button to get_hidden --- lib/urlresolver/plugins/clicknupload.py | 1 - lib/urlresolver/plugins/fileweed.py | 1 - lib/urlresolver/plugins/grifthost.py | 1 - lib/urlresolver/plugins/happystreams.py | 1 - lib/urlresolver/plugins/hugefiles.py | 1 - lib/urlresolver/plugins/kingfiles.py | 1 - lib/urlresolver/plugins/lib/captcha_lib.py | 2 +- lib/urlresolver/plugins/lib/helpers.py | 10 +++++++++- lib/urlresolver/plugins/movdivx.py | 1 - lib/urlresolver/plugins/uploadaf.py | 1 - lib/urlresolver/plugins/uploadx.py | 1 - lib/urlresolver/plugins/uploadz.py | 1 - lib/urlresolver/plugins/uptobox.py | 2 +- lib/urlresolver/plugins/vidlox.py | 3 +-- lib/urlresolver/plugins/vshareeu.py | 5 ++--- lib/urlresolver/plugins/xvidstage.py | 1 - 16 files changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/urlresolver/plugins/clicknupload.py b/lib/urlresolver/plugins/clicknupload.py index ebca4aa1..16526c4b 100644 --- a/lib/urlresolver/plugins/clicknupload.py +++ b/lib/urlresolver/plugins/clicknupload.py @@ -44,7 +44,6 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html) - data['method_free'] = 'Free+Download+>>' data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(web_url, data, headers=headers).content r = re.search('''class="downloadbtn"[^>]+onClick\s*=\s*\"window\.open\('([^']+)''', html) diff --git a/lib/urlresolver/plugins/fileweed.py b/lib/urlresolver/plugins/fileweed.py index f960bb0a..08158ab2 100644 --- a/lib/urlresolver/plugins/fileweed.py +++ b/lib/urlresolver/plugins/fileweed.py @@ -39,7 +39,6 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html, index=1) - data['method_free'] = urllib.quote_plus('Click Here >>') data.update(captcha_lib.do_captcha(html)) common.log_utils.log_debug(data) html = self.net.http_POST(web_url, data, headers=headers).content diff --git a/lib/urlresolver/plugins/grifthost.py b/lib/urlresolver/plugins/grifthost.py index 4e2d96d8..1378cd1f 100644 --- a/lib/urlresolver/plugins/grifthost.py +++ b/lib/urlresolver/plugins/grifthost.py @@ -36,7 +36,6 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url).content data = helpers.get_hidden(html) - data['method_free'] = 'Proceed to Video' html = self.net.http_POST(web_url, form_data=data).content stream_url = '' for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): diff --git a/lib/urlresolver/plugins/happystreams.py b/lib/urlresolver/plugins/happystreams.py index bc4d4fc7..3364aafc 100644 --- a/lib/urlresolver/plugins/happystreams.py +++ b/lib/urlresolver/plugins/happystreams.py @@ -37,7 +37,6 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content data = helpers.get_hidden(html) - data['imhuman'] = 'Proceed+to+video' furl = 'http://happystreams.net/dl' headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url, 'Cookie': self.__get_cookies(host, html)} diff --git a/lib/urlresolver/plugins/hugefiles.py b/lib/urlresolver/plugins/hugefiles.py index 45a93880..1449b4ad 100644 --- a/lib/urlresolver/plugins/hugefiles.py +++ b/lib/urlresolver/plugins/hugefiles.py @@ -44,7 +44,6 @@ def get_media_url(self, host, media_id): # Grab data values data = helpers.get_hidden(html) - data['method_free'] = 'Free Download' data.update(captcha_lib.do_captcha(html)) common.log_utils.log_debug('HugeFiles - Requesting POST URL: %s with data: %s' % (web_url, data)) html = self.net.http_POST(web_url, data).content diff --git a/lib/urlresolver/plugins/kingfiles.py b/lib/urlresolver/plugins/kingfiles.py index 3ef249b2..0d57b30b 100644 --- a/lib/urlresolver/plugins/kingfiles.py +++ b/lib/urlresolver/plugins/kingfiles.py @@ -40,7 +40,6 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html) - data['method_free'] = 'Free Download' data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(web_url, form_data=data).content diff --git a/lib/urlresolver/plugins/lib/captcha_lib.py b/lib/urlresolver/plugins/lib/captcha_lib.py index 5c761171..fa60c99b 100644 --- a/lib/urlresolver/plugins/lib/captcha_lib.py +++ b/lib/urlresolver/plugins/lib/captcha_lib.py @@ -78,7 +78,7 @@ def do_solvemedia_captcha(captcha_url): data = { 'adcopy_challenge': '' # set to blank just in case not found; avoids exception on return } - data.update(helpers.get_hidden(html)) + data.update(helpers.get_hidden(html), include_submit=False) captcha_img = os.path.join(common.profile_path, IMG_FILE) try: os.remove(captcha_img) except: pass diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 706b9dd4..2ebb8596 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -23,7 +23,7 @@ from urlresolver import common from urlresolver.resolver import ResolverError -def get_hidden(html, form_id=None, index=None): +def get_hidden(html, form_id=None, index=None, include_submit=True): hidden = {} if form_id: pattern = '''
]*id\s*=\s*['"]?%s['"]?[^>]*>(.*?)
''' % (form_id) @@ -38,6 +38,14 @@ def get_hidden(html, form_id=None, index=None): if match and match1: hidden[match.group(1)] = match1.group(1) + if include_submit: + match = re.search(''']*type=['"]?submit['"]?[^>]*>''', form.group(1)) + if match: + name = re.search('''name\s*=\s*['"]([^'"]+)''', match.group(0)) + value = re.search('''value\s*=\s*['"]([^'"]*)''', match.group(0)) + if name and value: + hidden[name.group(1)] = value.group(1) + common.log_utils.log_debug('Hidden fields are: %s' % (hidden)) return hidden diff --git a/lib/urlresolver/plugins/movdivx.py b/lib/urlresolver/plugins/movdivx.py index 7747f419..4676570b 100644 --- a/lib/urlresolver/plugins/movdivx.py +++ b/lib/urlresolver/plugins/movdivx.py @@ -34,7 +34,6 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content data = helpers.get_hidden(html) - data['method_free'] = 'Continue to Stream >>' html = self.net.http_POST(web_url, data).content # get url from packed javascript diff --git a/lib/urlresolver/plugins/uploadaf.py b/lib/urlresolver/plugins/uploadaf.py index c278484d..2b22c38b 100644 --- a/lib/urlresolver/plugins/uploadaf.py +++ b/lib/urlresolver/plugins/uploadaf.py @@ -39,7 +39,6 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html) - data['method_free'] = 'Free Download >>' data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(web_url, form_data=data).content diff --git a/lib/urlresolver/plugins/uploadx.py b/lib/urlresolver/plugins/uploadx.py index 6abf4c83..7a08168a 100644 --- a/lib/urlresolver/plugins/uploadx.py +++ b/lib/urlresolver/plugins/uploadx.py @@ -41,7 +41,6 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html, index=0) - data['method_free'] = urllib.quote_plus('Free Download >>') data.update(captcha_lib.do_captcha(html)) common.log_utils.log_debug(data) html = self.net.http_POST(web_url, data, headers=headers).content diff --git a/lib/urlresolver/plugins/uploadz.py b/lib/urlresolver/plugins/uploadz.py index 0c925307..30f5761f 100644 --- a/lib/urlresolver/plugins/uploadz.py +++ b/lib/urlresolver/plugins/uploadz.py @@ -39,7 +39,6 @@ def get_media_url(self, host, media_id): tries = 0 while tries < MAX_TRIES: data = helpers.get_hidden(html, index=0) - data['method_free'] = urllib.quote_plus('Free Download >>') data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(web_url, form_data=data).content diff --git a/lib/urlresolver/plugins/uptobox.py b/lib/urlresolver/plugins/uptobox.py index 333fdc17..07081420 100644 --- a/lib/urlresolver/plugins/uptobox.py +++ b/lib/urlresolver/plugins/uptobox.py @@ -50,7 +50,7 @@ def get_media_url(self, host, media_id): raise ResolverError('Cooldown in effect') data = helpers.get_hidden(html) - for i in range(0, 3): + for _ in range(0, 3): try: html = self.net.http_POST(web_url, data, headers=self.headers).content if isinstance(html, unicode): diff --git a/lib/urlresolver/plugins/vidlox.py b/lib/urlresolver/plugins/vidlox.py index 634eda1b..e93c04eb 100644 --- a/lib/urlresolver/plugins/vidlox.py +++ b/lib/urlresolver/plugins/vidlox.py @@ -38,10 +38,9 @@ def get_media_url(self, host, media_id): html = self.net.http_GET(web_url, headers=headers).content data = helpers.get_hidden(html) - data['imhuman'] = 'Proceed to this video' common.kodi.sleep(5000) cookies = self.__get_cookies(html, web_url) - headers.update({'Cookie': "; ".join("=".join((str(k),str(v))) for k,v in cookies.items())}) + headers.update({'Cookie': "; ".join("=".join((str(k), str(v))) for k, v in cookies.items())}) html = self.net.http_POST(web_url, data, headers=headers).content sources = self.__parse_sources_list(html) diff --git a/lib/urlresolver/plugins/vshareeu.py b/lib/urlresolver/plugins/vshareeu.py index e6ac44ba..917df9d5 100644 --- a/lib/urlresolver/plugins/vshareeu.py +++ b/lib/urlresolver/plugins/vshareeu.py @@ -34,8 +34,8 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = { - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': common.FF_USER_AGENT + 'Upgrade-Insecure-Requests': '1', + 'User-Agent': common.FF_USER_AGENT } html = self.net.http_GET(web_url, headers=headers).content @@ -44,7 +44,6 @@ def get_media_url(self, host, media_id): raise ResolverError('The requested video was not found.') data = helpers.get_hidden(html) - data['method_free'] = 'Proceed+to+video' headers['Referer'] = web_url html = self.net.http_POST(web_url, data, headers=headers).content diff --git a/lib/urlresolver/plugins/xvidstage.py b/lib/urlresolver/plugins/xvidstage.py index c282a170..7f8668a6 100644 --- a/lib/urlresolver/plugins/xvidstage.py +++ b/lib/urlresolver/plugins/xvidstage.py @@ -34,7 +34,6 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) html = self.net.http_GET(web_url).content data = helpers.get_hidden(html) - data['method_free'] = 'Continue to video / Continue to Free Download' html = self.net.http_POST(web_url, form_data=data).content for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): From 592d51fa6a566d35606f163c0f72ede570acb025 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 13:01:52 -0500 Subject: [PATCH 1267/1360] add add_packed_data helper --- lib/urlresolver/plugins/allvid.py | 16 +++++----------- lib/urlresolver/plugins/fx_gmu.py | 4 +--- lib/urlresolver/plugins/happystreams.py | 8 ++------ lib/urlresolver/plugins/kingfiles.py | 11 ++++------- lib/urlresolver/plugins/lib/helpers.py | 19 ++++++++++++------- lib/urlresolver/plugins/streamplay.py | 6 +----- lib/urlresolver/plugins/vidto.py | 21 ++++++++------------- 7 files changed, 33 insertions(+), 52 deletions(-) diff --git a/lib/urlresolver/plugins/allvid.py b/lib/urlresolver/plugins/allvid.py index 930d2243..3bec7a55 100644 --- a/lib/urlresolver/plugins/allvid.py +++ b/lib/urlresolver/plugins/allvid.py @@ -17,7 +17,7 @@ """ import re -from lib import jsunpack +from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -43,16 +43,10 @@ def get_media_url(self, host, media_id): web_url = r.group(1) html = self.net.http_GET(web_url, headers=self.headers).content - for match in re.finditer('(eval\(function.*?)', 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 ResolverError('File not found') + html = helpers.add_packed_data(html) + r = re.search('sources\s*:\s*\[\s*\{\s*file\s*:\s*["\'](.+?)["\']', html) + if r: + return r.group(1) def get_url(self, host, media_id): return self._default_get_url(host, media_id) diff --git a/lib/urlresolver/plugins/fx_gmu.py b/lib/urlresolver/plugins/fx_gmu.py index ff32a0c4..83902515 100644 --- a/lib/urlresolver/plugins/fx_gmu.py +++ b/lib/urlresolver/plugins/fx_gmu.py @@ -16,7 +16,6 @@ along with this program. If not, see . """ import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import ResolverError @@ -32,8 +31,7 @@ def get_media_url(url): if match: html = net.http_GET(match.group(1), headers=headers).content headers.update({'Referer': url}) - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - html += jsunpack.unpack(match.group(1)) + html = helpers.add_packed_data(html) sources = helpers.parse_sources_list(html) try: sources.sort(key=lambda x: SORT_KEY.get(x[0], 0), reverse=True) diff --git a/lib/urlresolver/plugins/happystreams.py b/lib/urlresolver/plugins/happystreams.py index c847a16b..a3ca3c5b 100644 --- a/lib/urlresolver/plugins/happystreams.py +++ b/lib/urlresolver/plugins/happystreams.py @@ -20,7 +20,6 @@ """ import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -39,12 +38,9 @@ def get_media_url(self, host, media_id): # need fix data = helpers.get_hidden(html) furl = 'http://happystreams.net/dl' headers = {'User-Agent': common.FF_USER_AGENT, 'Referer': web_url, 'Cookie': self.__get_cookies(host, html)} - html = self.net.http_POST(url=furl, form_data=data, headers=headers).content - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - packed_data = jsunpack.unpack(match.group(1)) - source = re.search(r'file:\"(.*?)\"', packed_data).groups()[0] - + html = helpers.add_packed_data(html) + source = re.search(r'file:\"(.*?)\"', html).groups()[0] return source def __get_cookies(self, host, html): diff --git a/lib/urlresolver/plugins/kingfiles.py b/lib/urlresolver/plugins/kingfiles.py index 0d57b30b..31e7e460 100644 --- a/lib/urlresolver/plugins/kingfiles.py +++ b/lib/urlresolver/plugins/kingfiles.py @@ -19,7 +19,6 @@ from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError from lib import captcha_lib -from lib import jsunpack from lib import helpers import re @@ -43,12 +42,10 @@ def get_media_url(self, host, media_id): data.update(captcha_lib.do_captcha(html)) html = self.net.http_POST(web_url, form_data=data).content - # try to find source in packed data - if jsunpack.detect(html): - js_data = jsunpack.unpack(html) - match = re.search('name="src"\s*value="([^"]+)', js_data) - if match: - return match.group(1) + html = helpers.add_packed_data(html) + match = re.search('name="src"\s*value="([^"]+)', html) + if match: + return match.group(1) # try to find source in html match = re.search(']*>\s*', html, re.DOTALL): + try: + js_data = jsunpack.unpack(match.group(1)) + js_data = js_data.replace('\\', '') + html += js_data + except: + pass + + return html + def parse_sources_list(html): sources = [] match = re.search('''['"]?sources['"]?\s*:\s*\[(.*?)\]''', html, re.DOTALL) @@ -115,13 +126,7 @@ def _parse_to_list(_html, regex): common.log_utils.log_debug('Scrape sources |%s| found |%s|' % (regex, matches)) return matches - for packed in re.finditer('(eval\(function.*?)', html, re.DOTALL): - try: - unpacked_data = jsunpack.unpack(packed.group(1)) - unpacked_data = unpacked_data.replace('\\\'', '\'') - html += unpacked_data - except: - pass + html = add_packed_data(html) source_list = _parse_to_list(html, '''video[^><]+src\s*=\s*['"]([^'"]+)''') source_list += _parse_to_list(html, '''source\s+src\s*=\s*['"]([^'"]+)''') diff --git a/lib/urlresolver/plugins/streamplay.py b/lib/urlresolver/plugins/streamplay.py index 1b4c6e36..dfa37c99 100644 --- a/lib/urlresolver/plugins/streamplay.py +++ b/lib/urlresolver/plugins/streamplay.py @@ -16,7 +16,6 @@ along with this program. If not, see . """ import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -33,10 +32,7 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT, 'Accept': '*/*'} html = self.net.http_GET(web_url, headers=headers).content - for match in re.finditer('(eval\(function.*?)', html, re.DOTALL): - js_data = jsunpack.unpack(match.group(1)) - html += js_data.replace('\\', '') - + html = helpers.add_packed_data(html) match = re.findall('[\'"]?file[\'"]?\s*:\s*[\'"]([^\'"]+)', html) if match: stream_url = [i for i in match if i.endswith('.mp4')] diff --git a/lib/urlresolver/plugins/vidto.py b/lib/urlresolver/plugins/vidto.py index acbdf1da..c75f35e4 100644 --- a/lib/urlresolver/plugins/vidto.py +++ b/lib/urlresolver/plugins/vidto.py @@ -16,7 +16,6 @@ """ import re -from lib import jsunpack from lib import helpers from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError @@ -34,18 +33,14 @@ def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) headers = {'User-Agent': common.FF_USER_AGENT} html = self.net.http_GET(web_url, headers=headers).content - - if jsunpack.detect(html): - js_data = jsunpack.unpack(html) - - sources = [] - for match in re.finditer('label:\s*"([^"]+)"\s*,\s*file:\s*"([^"]+)', js_data): - label, stream_url = match.groups() - sources.append((label, stream_url)) - - if sources: - sources = sorted(sources, key=lambda x: x[0])[::-1] - return helpers.pick_source(sources) + helpers.append_headers(headers) + html = helpers.add_packed_data(html) + sources = [] + for match in re.finditer('label:\s*"([^"]+)"\s*,\s*file:\s*"([^"]+)', html): + label, stream_url = match.groups() + sources.append((label, stream_url)) + + sources = sorted(sources, key=lambda x: x[0])[::-1] + return helpers.pick_source(sources) + helpers.append_headers(headers) raise ResolverError("File Link Not Found") From 9725029bb60c1d970497cc6e21d85368de3112ca Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 13:16:59 -0500 Subject: [PATCH 1268/1360] fix from add_packed_data --- lib/urlresolver/plugins/fx_gmu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/fx_gmu.py b/lib/urlresolver/plugins/fx_gmu.py index 83902515..9159f71b 100644 --- a/lib/urlresolver/plugins/fx_gmu.py +++ b/lib/urlresolver/plugins/fx_gmu.py @@ -29,10 +29,11 @@ def get_media_url(url): html = net.http_GET(url, headers=headers).content match = re.search('''href=['"]([^'"]+)''', html) if match: - html = net.http_GET(match.group(1), headers=headers).content headers.update({'Referer': url}) + html = net.http_GET(match.group(1), headers=headers).content html = helpers.add_packed_data(html) + common.log_utils.log(html) sources = helpers.parse_sources_list(html) try: sources.sort(key=lambda x: SORT_KEY.get(x[0], 0), reverse=True) except: pass From 3b21627fa26bf8a12b6afa2704576031e9b2a81e Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 11 Nov 2016 13:21:08 -0500 Subject: [PATCH 1269/1360] allvid --- lib/urlresolver/plugins/allvid.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/urlresolver/plugins/allvid.py b/lib/urlresolver/plugins/allvid.py index 3bec7a55..eebad2ef 100644 --- a/lib/urlresolver/plugins/allvid.py +++ b/lib/urlresolver/plugins/allvid.py @@ -21,6 +21,7 @@ from urlresolver import common from urlresolver.resolver import UrlResolver, ResolverError + class AllVidResolver(UrlResolver): name = "allvid" domains = ["allvid.ch"] @@ -28,25 +29,20 @@ class AllVidResolver(UrlResolver): def __init__(self): self.net = common.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 - - r = re.search(' Date: Fri, 11 Nov 2016 16:35:25 -0500 Subject: [PATCH 1270/1360] helper gmu - favor site order over alpha sort --- lib/urlresolver/plugins/lib/helpers.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 958abef2..738e2d64 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -105,6 +105,8 @@ def parse_smil_source_list(smil): return sources def scrape_sources(html, result_blacklist=None): + source_list = [] + def _parse_to_list(_html, regex): _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] @@ -114,8 +116,8 @@ def _parse_to_list(_html, regex): for i in re.finditer(regex, _html, re.DOTALL): match = i.group(1) trimmed_path = urlparse(match).path.split('/')[-1] - if ('://' not in match) or (not trimmed_path) or (any(match == m[1] for m in matches)) or \ - (any(bl in trimmed_path.lower() for bl in _blacklist)): + if ('//' not in match) or (not trimmed_path) or (any(match == m[1] for m in matches)) or \ + (any(bl in trimmed_path.lower() for bl in _blacklist)) or (any(match == t[1] for t in source_list)): continue label = trimmed_path if len(i.groups()) > 1: @@ -128,22 +130,19 @@ def _parse_to_list(_html, regex): html = add_packed_data(html) - source_list = _parse_to_list(html, '''video[^><]+src\s*=\s*['"]([^'"]+)''') - source_list += _parse_to_list(html, '''source\s+src\s*=\s*['"]([^'"]+)''') source_list += _parse_to_list(html, '''["']?\s*file\s*["']?\s*[:=,]?\s*["']([^"']+)(?:[^}>\],]?["',]?\s*label\s*["']?\s*[:=]?\s*["']([^"']+))?''') + source_list += _parse_to_list(html, '''video[^><]+src\s*=\s*['"]([^'"]+)''') + source_list += _parse_to_list(html, '''source\s+src\s*=\s*['"]([^'"]+)['"](?:.*?data-res\s*=\s*['"]([^'"]+))?''') source_list += _parse_to_list(html, '''["']?\s*url\s*["']?\s*[:=]\s*["']([^"']+)''') source_list += _parse_to_list(html, '''param\s+name\s*=\s*"src"\s*value\s*=\s*"([^"]+)''') - source_list = list(set(source_list)) - try: source_list.sort(key=lambda x: int(x[0]), reverse=True) - except: - common.log_utils.log_debug('Scrape sources sort failed |int(x[0])|') - try: source_list.sort(key=lambda x: int(x[0][:-1]), reverse=True) + if len(source_list) > 1: + try: source_list.sort(key=lambda x: int(x[0]), reverse=True) except: - common.log_utils.log_debug('Scrape sources sort failed |int(x[0][:-1])|') - try: source_list.sort(key=lambda x: x[0], reverse=True) + common.log_utils.log_debug('Scrape sources sort failed |int(x[0])|') + try: source_list.sort(key=lambda x: int(x[0][:-1]), reverse=True) except: - common.log_utils.log_debug('Scrape sources sort failed |x[0]|') + common.log_utils.log_debug('Scrape sources sort failed |int(x[0][:-1])|') return source_list From b5cdad1ccbca9b2e3aca2e5bf45ba079b9330b79 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 22:40:15 -0500 Subject: [PATCH 1271/1360] improve helpers --- lib/urlresolver/plugins/lib/helpers.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 738e2d64..7702edb9 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -29,6 +29,9 @@ def get_hidden(html, form_id=None, index=None, include_submit=True): pattern = '''
]*id\s*=\s*['"]?%s['"]?[^>]*>(.*?)
''' % (form_id) else: pattern = ''']*>(.*?)''' + + for match in re.finditer('', html, re.DOTALL): + if match.group(1) != '//': html = html.replace(match.group(0), '') for i, form in enumerate(re.finditer(pattern, html, re.DOTALL | re.I)): if index is None or i == index: @@ -105,13 +108,12 @@ def parse_smil_source_list(smil): return sources def scrape_sources(html, result_blacklist=None): + if result_blacklist is None: result_blacklist = [] source_list = [] def _parse_to_list(_html, regex): - _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', - '.srt', '.sub', '.xml', '.swf', '.vtt'] - if isinstance(result_blacklist, list): - _blacklist = list(set(_blacklist + result_blacklist)) + _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] + _blacklist = list(set(_blacklist + result_blacklist)) matches = [] for i in re.finditer(regex, _html, re.DOTALL): match = i.group(1) @@ -119,11 +121,11 @@ def _parse_to_list(_html, regex): if ('//' not in match) or (not trimmed_path) or (any(match == m[1] for m in matches)) or \ (any(bl in trimmed_path.lower() for bl in _blacklist)) or (any(match == t[1] for t in source_list)): continue - label = trimmed_path - if len(i.groups()) > 1: - if i.group(2) is not None: - label = i.group(2) - matches.append(('%s' % label, match)) + + try: label = i.group(2) + except AttributeError: label = trimmed_path + matches.append((label, match)) + if matches: common.log_utils.log_debug('Scrape sources |%s| found |%s|' % (regex, matches)) return matches From 5b1e1060a6c528cb7c72df1e781438665c27c710 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 23:11:42 -0500 Subject: [PATCH 1272/1360] simplify stream exclusion --- lib/urlresolver/plugins/lib/helpers.py | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 7702edb9..3fb2b9b6 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -108,24 +108,30 @@ def parse_smil_source_list(smil): return sources def scrape_sources(html, result_blacklist=None): - if result_blacklist is None: result_blacklist = [] + if result_blacklist is None: + result_blacklist = [] + elif isinstance(result_blacklist, str): + result_blacklist = [result_blacklist] + source_list = [] def _parse_to_list(_html, regex): - _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] - _blacklist = list(set(_blacklist + result_blacklist)) - matches = [] - for i in re.finditer(regex, _html, re.DOTALL): - match = i.group(1) - trimmed_path = urlparse(match).path.split('/')[-1] - if ('//' not in match) or (not trimmed_path) or (any(match == m[1] for m in matches)) or \ - (any(bl in trimmed_path.lower() for bl in _blacklist)) or (any(match == t[1] for t in source_list)): + _blacklist = ['', '.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] + _blacklist = set(_blacklist + result_blacklist) + streams = [] + labels = [] + for match in re.finditer(regex, _html, re.DOTALL): + stream_url = match.group(1) + trimmed_path = urlparse(stream_url).path.split('/')[-1] + if '://' not in stream_url or stream_url in streams or trimmed_path in _blacklist or any(stream_url == t[1] for t in source_list): continue - try: label = i.group(2) + try: label = match.group(2) except AttributeError: label = trimmed_path - matches.append((label, match)) + labels.append(label) + streams.append(stream_url) + matches = zip(labels, streams) if matches: common.log_utils.log_debug('Scrape sources |%s| found |%s|' % (regex, matches)) return matches From 3c822c167c954fa7e0c22a418a88f0b4a3062f09 Mon Sep 17 00:00:00 2001 From: tknorris Date: Fri, 11 Nov 2016 23:12:31 -0500 Subject: [PATCH 1273/1360] make path check lowercase --- lib/urlresolver/plugins/lib/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 3fb2b9b6..16b6ae16 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -123,7 +123,7 @@ def _parse_to_list(_html, regex): for match in re.finditer(regex, _html, re.DOTALL): stream_url = match.group(1) trimmed_path = urlparse(stream_url).path.split('/')[-1] - if '://' not in stream_url or stream_url in streams or trimmed_path in _blacklist or any(stream_url == t[1] for t in source_list): + if '://' not in stream_url or stream_url in streams or trimmed_path.lower() in _blacklist or any(stream_url == t[1] for t in source_list): continue try: label = match.group(2) From 8d057230c2f5e025586f53e90417383f6feb95cb Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 12 Nov 2016 00:38:41 -0500 Subject: [PATCH 1274/1360] fix blacklist changes --- lib/urlresolver/plugins/lib/helpers.py | 12 +++++++----- lib/urlresolver/plugins/vodmine.py | 2 +- lib/urlresolver/plugins/yourupload.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index 16b6ae16..fddc0d5e 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -116,20 +116,22 @@ def scrape_sources(html, result_blacklist=None): source_list = [] def _parse_to_list(_html, regex): - _blacklist = ['', '.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] + _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] _blacklist = set(_blacklist + result_blacklist) streams = [] labels = [] for match in re.finditer(regex, _html, re.DOTALL): stream_url = match.group(1) trimmed_path = urlparse(stream_url).path.split('/')[-1] - if '://' not in stream_url or stream_url in streams or trimmed_path.lower() in _blacklist or any(stream_url == t[1] for t in source_list): + blocked = not trimmed_path or any(item in trimmed_path.lower() for item in _blacklist) + if '://' not in stream_url or blocked or (stream_url in streams) or any(stream_url == t[1] for t in source_list): continue try: label = match.group(2) - except AttributeError: label = trimmed_path - labels.append(label) - streams.append(stream_url) + except IndexError: label = trimmed_path + if label: + labels.append(label) + streams.append(stream_url) matches = zip(labels, streams) if matches: diff --git a/lib/urlresolver/plugins/vodmine.py b/lib/urlresolver/plugins/vodmine.py index 26cb73d8..6c989c29 100644 --- a/lib/urlresolver/plugins/vodmine.py +++ b/lib/urlresolver/plugins/vodmine.py @@ -26,7 +26,7 @@ class VodmineResolver(UrlResolver): pattern = '(?://|\.)(vodmine\.com)/(?:video|embed)/([0-9a-zA-Z]+)' def get_media_url(self, host, media_id): - return helpers.get_media_url(self.get_url(host, media_id), result_blacklist=None) + return helpers.get_media_url(self.get_url(host, media_id)) def get_url(self, host, media_id): return 'http://vodmine.com/embed/%s' % media_id diff --git a/lib/urlresolver/plugins/yourupload.py b/lib/urlresolver/plugins/yourupload.py index 87efd966..089d698a 100644 --- a/lib/urlresolver/plugins/yourupload.py +++ b/lib/urlresolver/plugins/yourupload.py @@ -31,7 +31,7 @@ def __init__(self): def get_media_url(self, host, media_id): web_url = self.net.http_HEAD(self.get_url(host, media_id)).get_url() - return helpers.get_media_url(web_url, result_blacklist=None) + return helpers.get_media_url(web_url) def get_url(self, host, media_id): return 'http://www.yourupload.com/embed/%s' % media_id From a1e4429198d419df3bb10de0d73be0a23df573fc Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 12 Nov 2016 01:05:10 -0500 Subject: [PATCH 1275/1360] label fix --- lib/urlresolver/plugins/lib/helpers.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index fddc0d5e..c371a0e7 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -101,9 +101,8 @@ def parse_smil_source_list(smil): base = re.search('base\s*=\s*"([^"]+)', smil).groups()[0] for i in re.finditer('src\s*=\s*"([^"]+)(?:"\s*(?:width|height)\s*=\s*"([^"]+))?', smil): label = 'Unknown' - if len(i.groups()) > 1: - if i.group(2) is not None: - label = i.group(2) + if (len(i.groups()) > 1) and (i.group(2) is not None): + label = i.group(2) sources += [(label, '%s playpath=%s' % (base, i.group(1)))] return sources @@ -126,12 +125,13 @@ def _parse_to_list(_html, regex): blocked = not trimmed_path or any(item in trimmed_path.lower() for item in _blacklist) if '://' not in stream_url or blocked or (stream_url in streams) or any(stream_url == t[1] for t in source_list): continue - - try: label = match.group(2) - except IndexError: label = trimmed_path - if label: - labels.append(label) - streams.append(stream_url) + + label = trimmed_path + if (len(match.groups()) > 1) and (match.group(2) is not None): + label = match.group(2) + + labels.append(label) + streams.append(stream_url) matches = zip(labels, streams) if matches: @@ -157,7 +157,11 @@ def _parse_to_list(_html, regex): return source_list def get_media_url(url, result_blacklist=None): - if not isinstance(result_blacklist, list): result_blacklist = [] + if result_blacklist is None: + result_blacklist = [] + elif isinstance(result_blacklist, str): + result_blacklist = [result_blacklist] + result_blacklist = list(set(result_blacklist + ['.smil'])) # smil(not playable) contains potential sources, only blacklist when called from here net = common.Net() parsed_url = urlparse(url) From b3ebb3b3c850e87eee0ff83bec95b753a8ff8d41 Mon Sep 17 00:00:00 2001 From: tknorris Date: Sat, 12 Nov 2016 01:47:58 -0500 Subject: [PATCH 1276/1360] use groupdict in scrape --- lib/urlresolver/plugins/lib/helpers.py | 38 ++++++++++++-------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/urlresolver/plugins/lib/helpers.py b/lib/urlresolver/plugins/lib/helpers.py index c371a0e7..75ab2c88 100644 --- a/lib/urlresolver/plugins/lib/helpers.py +++ b/lib/urlresolver/plugins/lib/helpers.py @@ -107,29 +107,20 @@ def parse_smil_source_list(smil): return sources def scrape_sources(html, result_blacklist=None): - if result_blacklist is None: - result_blacklist = [] - elif isinstance(result_blacklist, str): - result_blacklist = [result_blacklist] - - source_list = [] - - def _parse_to_list(_html, regex): + def __parse_to_list(_html, regex): _blacklist = ['.jpg', '.jpeg', '.gif', '.png', '.js', '.css', '.htm', '.html', '.php', '.srt', '.sub', '.xml', '.swf', '.vtt'] _blacklist = set(_blacklist + result_blacklist) streams = [] labels = [] - for match in re.finditer(regex, _html, re.DOTALL): - stream_url = match.group(1) + for r in re.finditer(regex, _html, re.DOTALL): + match = r.groupdict() + stream_url = match['url'] trimmed_path = urlparse(stream_url).path.split('/')[-1] blocked = not trimmed_path or any(item in trimmed_path.lower() for item in _blacklist) if '://' not in stream_url or blocked or (stream_url in streams) or any(stream_url == t[1] for t in source_list): continue - - label = trimmed_path - if (len(match.groups()) > 1) and (match.group(2) is not None): - label = match.group(2) - + + label = match.get('label', trimmed_path) labels.append(label) streams.append(stream_url) @@ -138,13 +129,19 @@ def _parse_to_list(_html, regex): common.log_utils.log_debug('Scrape sources |%s| found |%s|' % (regex, matches)) return matches + if result_blacklist is None: + result_blacklist = [] + elif isinstance(result_blacklist, str): + result_blacklist = [result_blacklist] + html = add_packed_data(html) - source_list += _parse_to_list(html, '''["']?\s*file\s*["']?\s*[:=,]?\s*["']([^"']+)(?:[^}>\],]?["',]?\s*label\s*["']?\s*[:=]?\s*["']([^"']+))?''') - source_list += _parse_to_list(html, '''video[^><]+src\s*=\s*['"]([^'"]+)''') - source_list += _parse_to_list(html, '''source\s+src\s*=\s*['"]([^'"]+)['"](?:.*?data-res\s*=\s*['"]([^'"]+))?''') - source_list += _parse_to_list(html, '''["']?\s*url\s*["']?\s*[:=]\s*["']([^"']+)''') - source_list += _parse_to_list(html, '''param\s+name\s*=\s*"src"\s*value\s*=\s*"([^"]+)''') + source_list = [] + source_list += __parse_to_list(html, '''["']?\s*file\s*["']?\s*[:=,]?\s*["'](?P[^"']+)(?:[^}>\],]?["',]?\s*label\s*["']?\s*[:=]?\s*["'](?P