Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/MusterGit/xbmc-urlresolver
Browse files Browse the repository at this point in the history
…into MusterGit-master

Conflicts:
	plugin.video.t0mm0.test/default.py
	script.module.urlresolver/lib/urlresolver/plugins/sharefiles.py
  • Loading branch information
t0mm0 committed Nov 3, 2011
2 parents fc2141e + 60b0c8a commit c095bd5
Show file tree
Hide file tree
Showing 6 changed files with 358 additions and 3 deletions.
12 changes: 12 additions & 0 deletions plugin.video.t0mm0.test/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
{'title': 'putlocker url'})
addon.add_video_item({'host': 'putlocker.com', 'media_id': 'DFE7599AE064911A'},
{'title': 'putlocker media id'})
addon.add_video_item({'url': 'http://rapidvideo.com/view/hwksai28'},
{'title': 'rapidvideo url'})
addon.add_video_item({'host': 'rapidvideo', 'media_id': 'hwksai28'},
{'title': 'rapidvideo media id'})
addon.add_video_item({'url': 'http://www.seeon.tv/view/19412/CBS'},
{'title': 'seeon.tv url'})
addon.add_video_item({'host': 'seeon.tv', 'media_id': '19412'},
Expand All @@ -107,6 +111,10 @@
{'title': 'tubeplus url'})
addon.add_video_item({'host': 'tubeplus.me', 'media_id': '1962655'},
{'title': 'tubeplus media id'})
addon.add_video_item({'url': 'http://www.ufliq.com/embed-rw52re7f5aul.html'},
{'title': 'ufliq url'})
addon.add_video_item({'host': 'ufliq', 'media_id': 'rw52re7f5aul'},
{'title': 'ufliq media id'})
addon.add_video_item({'url': 'http://www.uploadc.com/wheon4xa0sh6'},
{'title': 'uploadc url'})
addon.add_video_item({'host': 'uploadc.com', 'media_id': 'wheon4xa0sh6'},
Expand All @@ -123,6 +131,10 @@
{'title': 'videozer url'})
addon.add_video_item({'host': 'videozer', 'media_id': '3LsT'},
{'title': 'videozer media id'})
addon.add_video_item({'url': 'http://vidstream.us/video/7XK5WMYBAM5R/RAONE'},
{'title': 'vidstream url'})
addon.add_video_item({'host': 'vidstream', 'media_id': '7XK5WMYBAM5R/RAONE'},
{'title': 'vidstream media id'})
addon.add_video_item({'url': 'http://www.vidxden.com/rn3h4gbh5se7/kdshn-4x4_watchseries-online.dot.com.avi.html'},
{'title': 'vidxden url'})
addon.add_video_item({'host': 'vidxden.com', 'media_id': 'rn3h4gbh5se7'},
Expand Down
72 changes: 72 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/rapidvideo.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
"""

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):
implements = [UrlResolver, PluginSettings]
name = "rapidvideo"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
#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
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, web_url))
return False

# get stream url
sPattern = "so.addVariable\(\s*'file'\s*,\s*'([^']+)'\s*\)"
r = re.search(sPattern, html)
if r:
return r.group(1)

return False

def get_url(self, host, media_id):
return 'http://rapidvideo.com/view/%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
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ def get_media_url(self, host, media_id):
common.addon.log_error(self.name + ': no fields found')
return False


# get url from packed javascript
r = re.findall("<script type='text/javascript'>eval.*?return p}" +
"\((.*?)\)\s*</script>", html, re.DOTALL + re.IGNORECASE)
sPattern = "<div id=\"player_code\">\s*<script type='text/javascript'>eval.*?return p}\((.*?)\)\s*</script>"
r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
if r:
sJavascript = r[1]
sJavascript = r.group(1)
sUnpacked = jsunpack.unpack(sJavascript)
sPattern = '<param name="src"0="(.*?)"'
r = re.search(sPattern, sUnpacked)
Expand Down
79 changes: 79 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/ufliq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""
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 <http://www.gnu.org/licenses/>.
"""

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]+).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
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, api_url))
return False

# get url from packed javascript
sPattern = "<script type='text/javascript'>eval.*?return p}\((.*?)\)\s*</script>"
r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
if r:
sJavascript = r.group(1)
sUnpacked = jsunpack.unpack(sJavascript)
print(sUnpacked)
sPattern = ".addVariable\(\s*'file'\s*,\s*'([^']+)'\s*\)"
r = re.search(sPattern, sUnpacked)
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
84 changes: 84 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/vidstream.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
"""

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 VidstreamResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "vidstream"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
#e.g. http://vidstream.us/video/7XK5WMYBAM5R/RAONE
self.pattern = 'http://((?:www.)?vidstream.us)/video/(.*)'


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

# get settings file
sPattern = 'settingsFile:\s*"([^"]+)"'
r = re.search(sPattern, html)
if r:
settings_url = r.group(1)
try:
html = self.net.http_GET(settings_url).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, settings_url))
return False

# get stream url
sPattern = '<videoPath value="([^"]+)"/>'
r = re.search(sPattern, html)
if r:
return r.group(1)

return False

def get_url(self, host, media_id):
return 'http://vidstream.us/video/%s' % (media_id)

def get_host_and_id(self, url):
r = re.search(self.pattern, url)
if r:
return r.groups()
else:
return False


def valid_url(self, url, host):
return re.match(self.pattern, url) or self.name in host
107 changes: 107 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/zshare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
"""
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 <http://www.gnu.org/licenses/>.
"""

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

class ZshareResolver(Plugin, UrlResolver, PluginSettings):
implements = [UrlResolver, PluginSettings]
name = "zshare"

def __init__(self):
p = self.get_setting('priority') or 100
self.priority = int(p)
self.net = Net()
self.pattern ='http://((?:www.)?zshare.net)/([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
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, api_url))
return False

# get iframe redirect
sPattern = '<iframe src="(http://www.zshare.net[^"]+)"'
r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
if r:
iframe = r.group(1)
try:
html = self.net.http_GET(iframe).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, api_url))
return False


# get stream url
stream_url = ''
sPattern = 'file: "([^"]+)"'
r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
if r:
stream_url = r.group(1) + "?start=0" + '|user-agent=Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.109 Safari/535.1'


# get download url
download_url = ''
# emulate download button click
sPattern = '<a href="([^"]+)"[^>]*>Download Video</a>'
r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
if r:
buttonlink = r.group(1)
data = {'referer2': '',
'download': 1,
'imageField.x': 76,
'imageField.y': 28
}
try:
html = self.net.http_POST(buttonlink, data).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, api_url))
return False

sPattern = 'new Array\(([^\)]*)\);'
r = re.search(sPattern, html, re.DOTALL + re.IGNORECASE)
if r:
download_url = r.group(1).replace("'","").replace(",","")


return stream_url

def get_url(self, host, media_id):
return 'http://www.zshare.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

def valid_url(self, url, host):
return re.match(self.pattern, url) or self.name in host

0 comments on commit c095bd5

Please sign in to comment.