Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added plugins: FlashX, uFliq, Sharefiles, zShare
  • Loading branch information
MusterGit committed Nov 1, 2011
2 parents 3dd06e4 + 6d72c20 commit 6977828
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 124 deletions.
51 changes: 34 additions & 17 deletions plugin.video.t0mm0.test/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,18 @@
urlresolver.display_settings()

elif mode == 'test':
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://flashx.tv/player/embed_player.php?vid=1503&width=600&height=370&autoplay=no'},
{'title': 'flashx url'})
{'title': 'flashx url'})
addon.add_video_item({'host': 'flashx','media_id': '1503'},
{'title': 'flashx media id'})
{'title': 'flashx media id'})
addon.add_video_item({'url': 'http://www.sharefiles4u.com/pknlizmgi6mw/contagion-md-dubbed-german.avi'},
{'title': 'sharefiles url'})
{'title': 'sharefiles url'})
addon.add_video_item({'host': 'sharefiles','media_id': 'pknlizmgi6mw'},
{'title': 'sharefiles media id'})
addon.add_video_item({'url': 'http://skyload.net/File/a25454887fd8cce41bac2e316d9d0a51.flv'},
{'title': 'skyload url'})
addon.add_video_item({'host': 'skyload', 'media_id': 'a25454887fd8cce41bac2e316d9d0a51'},
{'title': 'skyload media id'})
addon.add_video_item({'url': 'http://server4.stream2k.com/playerjw/vConfig56.php?vkey=1d8dc00940da661ffba9'},
{'title': 'stream2k url'})
addon.add_video_item({'host': 'stream2k', 'media_id': '1d8dc00940da661ffba9'},
{'title': 'stream2k media id'})
addon.add_video_item({'url': 'http://www.ecostream.tv/stream/b83c3c5d07b1ab195fb8245576c27daa.html?' +
'width=679&height=365&bGetRedirectUrl=False&sFileName=Larry+Crowne'},
{'title': 'ecostream url'})
addon.add_video_item({'host': 'ecostream', 'media_id': 'b83c3c5d07b1ab195fb8245576c27daa'},
{'title': 'ecostream media id'})
{'title': 'sharefiles media id'})
addon.add_video_item({'url': 'http://www.2gb-hosting.com/v/94fb733db6e9f984b07da3cb238eb277/2074fe10f41c7e1.flv.html'},
{'title': '2gbhosting url'})
addon.add_video_item({'host': '2gb-hosting.com', 'media_id': 'e1593e96e19f7ecced3778668e809c77/efc5d03968fbca6.avi.html'},
Expand All @@ -75,6 +66,11 @@
{'title': 'divxstage url'})
addon.add_video_item({'host': 'divxstage.eu', 'media_id': 'eb20c352c3ccc'},
{'title': 'divxstage media id'})
addon.add_video_item({'url': 'http://www.ecostream.tv/stream/b83c3c5d07b1ab195fb8245576c27daa.html?' +
'width=679&height=365&bGetRedirectUrl=False&sFileName=Larry+Crowne'},
{'title': 'ecostream url'})
addon.add_video_item({'host': 'ecostream', 'media_id': 'b83c3c5d07b1ab195fb8245576c27daa'},
{'title': 'ecostream media id'})
addon.add_video_item({'url': 'http://www.megaupload.com/?d=9T8NHCK4'},
{'title': 'megaupload url'})
addon.add_video_item({'host': 'megaupload.com', 'media_id': '9T8NHCK4'},
Expand Down Expand Up @@ -103,10 +99,22 @@
{'title': 'seeon.tv url'})
addon.add_video_item({'host': 'seeon.tv', 'media_id': '19412'},
{'title': 'seeon.tv media id'})
addon.add_video_item({'url': 'http://skyload.net/File/a25454887fd8cce41bac2e316d9d0a51.flv'},
{'title': 'skyload url'})
addon.add_video_item({'host': 'skyload', 'media_id': 'a25454887fd8cce41bac2e316d9d0a51'},
{'title': 'skyload media id'})
addon.add_video_item({'url': 'http://server4.stream2k.com/playerjw/vConfig56.php?vkey=1d8dc00940da661ffba9'},
{'title': 'stream2k url'})
addon.add_video_item({'host': 'stream2k', 'media_id': '1d8dc00940da661ffba9'},
{'title': 'stream2k media id'})
addon.add_video_item({'url': 'http://www.tubeplus.me/player/1962655/Entourage/season_8/episode_2/Out_With_a_Bang_/'},
{'title': 'tubeplus url'})
addon.add_video_item({'host': 'tubeplus.me', 'media_id': '1962655'},
{'title': 'tubeplus 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'},
{'title': 'uploadc media id'})
addon.add_video_item({'url': 'http://videobb.com/video/8FvAG6AQpHi8'},
{'title': 'videobb url'})
addon.add_video_item({'host': 'videobb.com', 'media_id': '8FvAG6AQpHi8'},
Expand All @@ -115,6 +123,10 @@
{'title': 'videoweed url'})
addon.add_video_item({'host': 'videoweed.com', 'media_id': 'crirmdz3tj116'},
{'title': 'videoweed media id'})
addon.add_video_item({'url': 'http://www.videozer.com/video/3LsT'},
{'title': 'videozer url'})
addon.add_video_item({'host': 'videozer', 'media_id': '3LsT'},
{'title': 'videozer 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 All @@ -123,10 +135,15 @@
{'title': 'vimeo url'})
addon.add_video_item({'host': 'vimeo.com', 'media_id': '30081785'},
{'title': 'vimeo media id'})
addon.add_video_item({'url': 'http://xvidstage.com/v9t09l63m9vn'},
{'title': 'xvidstage url'})
addon.add_video_item({'host': 'xvidstage', 'media_id': 'v9t09l63m9vn'},
{'title': 'xvidstage media id'})
addon.add_video_item({'url': 'http://www.youtube.com/watch?v=Q3VJOl_XeGs'},
{'title': 'youtube url'})
addon.add_video_item({'host': 'youtube.com', 'media_id': 'Q3VJOl_XeGs'},
{'title': 'youtube media id'})

elif mode == 'tv':
browse = addon.queries.get('browse', False)
if browse == 'alpha':
Expand Down
28 changes: 17 additions & 11 deletions script.module.t0mm0.common/lib/t0mm0/common/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,17 +678,23 @@ def unescape(self, text):
Returns:
Cleaned string.
'''
text = self.decode(text)
rep = {'&lt;': '<',
'&gt;': '>',
'&quot': '"',
'&rsquo;': '\'',
'&acute;': '\'',
}
for s, r in rep.items():
text = text.replace(s, r)
# this has to be last:
text = text.replace("&amp;", "&")
try:
text = self.decode(text)
rep = {'&lt;': '<',
'&gt;': '>',
'&quot': '"',
'&rsquo;': '\'',
'&acute;': '\'',
}
for s, r in rep.items():
text = text.replace(s, r)
# this has to be last:
text = text.replace("&amp;", "&")

#we don't want to fiddle with non-string types
except TypeError:
pass

return text


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_media_url(self, host, media_id):
html = self.net.http_GET(sNextUrl).content
except urllib2.URLError, e:
common.addon.log_error(self.name + ': got http error %d fetching %s' %
(e.code, web_url))
(e.code, sNextUrl))
return False

sPattern = '<param name="flashvars" value="file=(.*?)&'
Expand All @@ -91,4 +91,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
return re.match(self.pattern, url) or self.name in host
45 changes: 45 additions & 0 deletions script.module.urlresolver/lib/urlresolver/plugins/lib/jsunpack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""
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/>.
"""

import re

def unpack(sJavascript):
aSplit = sJavascript.split(";',")
p = str(aSplit[0])
aSplit = aSplit[1].split(",")
a = int(aSplit[0])
c = int(aSplit[1])
k = aSplit[2].split(".")[0].replace("'", '').split('|')
e = ''
d = ''
sUnpacked = str(__unpack(p, a, c, k, e, d))
return sUnpacked.replace('\\', '')

def __unpack(p, a, c, k, e, d):
while (c > 1):
c = c -1
if (k[c]):
p = re.sub('\\b' + str(__itoa(c, a)) +'\\b', k[c], p)
return p

def __itoa(num, radix):
result = ""
while num > 0:
result = "0123456789abcdefghijklmnopqrstuvwxyz"[num % radix] + result
num /= radix
return result
36 changes: 6 additions & 30 deletions script.module.urlresolver/lib/urlresolver/plugins/sharefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from urlresolver.plugnplay import Plugin
import urllib2
from urlresolver import common
from lib import jsunpack

# Custom imports
import re
Expand All @@ -38,32 +39,6 @@ def __init__(self):
self.net = Net()
self.pattern = 'http://((?:www.)?sharefiles4u.com)/([0-9a-zA-Z]+)'

def unpackByString(self, sJavascript):
aSplit = sJavascript.split(";',")
p = str(aSplit[0])
aSplit = aSplit[1].split(",")
a = int(aSplit[0])
c = int(aSplit[1])
k = aSplit[2].split(".")[0].replace("'", '').split('|')
e = ''
d = ''
sUnpacked = str(self.__unpack(p, a, c, k, e, d))
return sUnpacked.replace('\\', '')

def __unpack(self, p, a, c, k, e, d):
while (c > 1):
c = c -1
if (k[c]):
p = re.sub('\\b' + str(self.__itoa(c, a)) +'\\b', k[c], p)
return p

def __itoa(self, num, radix):
result = ""
while num > 0:
result = "0123456789abcdefghijklmnopqrstuvwxyz"[num % radix] + result
num /= radix
return result

def get_media_url(self, host, media_id):
web_url = self.get_url(host, media_id)

Expand All @@ -89,12 +64,13 @@ 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]
sUnpacked = self.unpackByString(sJavascript)
sJavascript = r.group(1)
sUnpacked = jsunpack.unpack(sJavascript)
sPattern = '<param name="src"0="(.*?)"'
r = re.search(sPattern, sUnpacked)
if r:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_media_url(self, host, media_id):
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))
(e.code, web_url))
sPattern = "<file>(.*?)</file>"

# get stream url
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
Loading

0 comments on commit 6977828

Please sign in to comment.