The branch, eden has been updated
       via  ba4ff1b1174d2f131247c18efe9f79d4265e4b96 (commit)
      from  07d274ad22ef9521cb721c18f82980ae6a01040f (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=ba4ff1b1174d2f131247c18efe9f79d4265e4b96

commit ba4ff1b1174d2f131247c18efe9f79d4265e4b96
Author: Martijn Kaijser <[email protected]>
Date:   Tue Jan 8 22:39:08 2013 +0100

    [script.module.urlresolver] -1.0.5

diff --git a/script.module.urlresolver/addon.xml 
b/script.module.urlresolver/addon.xml
index 569ad0b..4363e3d 100644
--- a/script.module.urlresolver/addon.xml
+++ b/script.module.urlresolver/addon.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.module.urlresolver" 
             name="urlresolver" 
-            version="1.0.4" 
+            version="1.0.5" 
             provider-name="XBMCHub.com">
   <requires>
     <import addon="xbmc.python" version="2.0" />
     <import addon="script.module.t0mm0.common" version="1.0.0"/>
-    <import addon="plugin.video.youtube"/>
+    <import addon="plugin.video.youtube" version="3.3.0"/>
   </requires>
   <extension point="xbmc.python.module" library="lib" />
   <extension point="xbmc.addon.metadata">
diff --git a/script.module.urlresolver/changelog.txt 
b/script.module.urlresolver/changelog.txt
index 00f5dcc..b5018f9 100644
--- a/script.module.urlresolver/changelog.txt
+++ b/script.module.urlresolver/changelog.txt
@@ -1,3 +1,12 @@
+[B]Version 1.0.5[/B]
+- Added streamcloud
+- Added zooupload
+- Fixed divxstage - handle url with .net
+- Fixed flashx.tv - new pattern and embed code
+- Fixed vidstream - new url
+- Fixed ecostream - new embed url pattern
+- Reverted putlocker code, added option for higher vid quality
+
 [B]Version 1.0.4[/B]
 - Updated putlocker and vidxden resolvers
 - Updated real-debrid
diff --git a/script.module.urlresolver/lib/urlresolver/plugins/divxstage.py 
b/script.module.urlresolver/lib/urlresolver/plugins/divxstage.py
index a2a9449..f53c611 100644
--- a/script.module.urlresolver/lib/urlresolver/plugins/divxstage.py
+++ b/script.module.urlresolver/lib/urlresolver/plugins/divxstage.py
@@ -86,5 +86,5 @@ class DivxstageResolver(Plugin, UrlResolver, PluginSettings):
 
 
     def valid_url(self, url, host):
-        return re.match('http://(www.)?divxstage.eu/' +
+        return re.match('http://(www.)?divxstage.(?:eu|net)/' +
                         'video/[0-9A-Za-z]+', url) or 'divxstage' in host
\ No newline at end of file
diff --git a/script.module.urlresolver/lib/urlresolver/plugins/ecostream.py 
b/script.module.urlresolver/lib/urlresolver/plugins/ecostream.py
index 02210ad..6f1f776 100644
--- a/script.module.urlresolver/lib/urlresolver/plugins/ecostream.py
+++ b/script.module.urlresolver/lib/urlresolver/plugins/ecostream.py
@@ -44,7 +44,7 @@ class EcostreamResolver(Plugin, UrlResolver, PluginSettings):
         web_url = self.get_url(host, media_id) + "?ss=1"
 
         try:
-            html = self.net.http_GET(web_url).content
+            html = self.net.http_POST(web_url,{'ss':'1'}).content
         except urllib2.URLError, e:
             common.addon.log_error(self.name + ': got http error %d fetching 
%s' %
                                     (e.code, web_url))
@@ -59,12 +59,24 @@ class EcostreamResolver(Plugin, UrlResolver, 
PluginSettings):
                 sK = str(aEntry[1])
                 sT = str(aEntry[2])
                 sKey = str(aEntry[3])
-
+                # get name of php file
+                try:
+                    html = 
self.net.http_GET('http://www.ecostream.tv/assets/js/common.js').content
+                except urllib2.URLError, e:
+                    common.addon.log_error(self.name + ': got http error %d 
fetching %s' %
+                                    (e.code, web_url))
+                    return False
+                sPattern = "url: '([^=]+)="
+                r = re.search(sPattern, html)
+                if r is None :
+                    common.addon.log_error(self.name + ': name of php file not 
found')
+                    return False
                 # send vars and retrieve stream url
-                sNextUrl = 
'http://www.ecostream.tv/object.php?s='+sS+'&k='+sK+'&t='+sT+'&key='+sKey
-
+                sNextUrl = r.group(1)+'='+sS+'&k='+sK+'&t='+sT+'&key='+sKey
+                postParams = ({'s':sS,'k':sK,'t':sT,'key':sKey})
+                postHeader = ({'Referer':'http://www.ecostream.tv', 
'X-Requested-With':'XMLHttpRequest'})
                 try:
-                    html = self.net.http_GET(sNextUrl).content
+                    html = self.net.http_POST(sNextUrl, postParams,headers = 
postHeader).content
                 except urllib2.URLError, e:
                     common.addon.log_error(self.name + ': got http error %d 
fetching %s' %
                                             (e.code, sNextUrl))
@@ -73,7 +85,7 @@ class EcostreamResolver(Plugin, UrlResolver, PluginSettings):
                 sPattern = '<param name="flashvars" value="file=(.*?)&'
                 r = re.search(sPattern, html)
                 if r:
-                    sLinkToFile = r.group(1)
+                    sLinkToFile = 'http://www.ecostream.tv'+r.group(1)
                     return sLinkToFile
 
 
diff --git a/script.module.urlresolver/lib/urlresolver/plugins/flashx.py 
b/script.module.urlresolver/lib/urlresolver/plugins/flashx.py
index ebb3a28..e9350d7 100644
--- a/script.module.urlresolver/lib/urlresolver/plugins/flashx.py
+++ b/script.module.urlresolver/lib/urlresolver/plugins/flashx.py
@@ -36,24 +36,35 @@ class FlashxResolver(Plugin, UrlResolver, PluginSettings):
         self.priority = int(p)
         self.net = Net()
         #e.g. 
http://flashx.tv/player/embed_player.php?vid=1503&width=600&height=370&autoplay=no
-        self.pattern = 
'http://((?:www.)?flashx.tv)/(?:player/embed_player.php\?vid=|video/)([0-9A-Z]+)'
+        self.pattern = 
'http://((?:www.|play.)?flashx.tv)/(?:player/embed_player.php\?vid=|player/embed.php\?vid=|video/)([0-9A-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
-
         #grab stream url
         sPatternHQ = "var hq_video_file\s*=\s*'([^']+)'"        # .mp4
-        sPatternLQ = "var normal_video_file\s*=\s*'([^']+)'"    # .flv
+        #sPatternLQ = "var normal_video_file\s*=\s*'([^']+)'"    # .flv old
+        sPatternLQ = "\?hash=([^'|&]+)"
         r = re.search(sPatternLQ, html)
         if r:
+            print r.group(1)
+            media_id = r.group(1)
+            #return r.group(1)
+        try:
+            html = 
self.net.http_GET("http://play.flashx.tv/nuevo/player/cst.php?hash="+media_id).content
+        except urllib2.URLError, e:
+            common.addon.log_error(self.name + ': got http error %d fetching 
%s' %
+                                    (e.code, web_url))
+            return False
+        pattern = "<file>(.*?)</file>"
+        r = re.search(pattern, html)
+        if r:
             return r.group(1)
 
         return False
@@ -70,4 +81,5 @@ class FlashxResolver(Plugin, UrlResolver, PluginSettings):
 
 
     def valid_url(self, url, host):
+        print re.match(self.pattern, url) or self.name in host
         return re.match(self.pattern, url) or self.name in host
diff --git a/script.module.urlresolver/lib/urlresolver/plugins/putlocker.py 
b/script.module.urlresolver/lib/urlresolver/plugins/putlocker.py
index 15b858e..238008d 100644
--- a/script.module.urlresolver/lib/urlresolver/plugins/putlocker.py
+++ b/script.module.urlresolver/lib/urlresolver/plugins/putlocker.py
@@ -17,32 +17,51 @@
 """
 
 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):
+        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))
+            common.addon.log_error('putlocker: got http error %d fetching %s' 
% (e.code, web_url))
             return False
+        
+        #Shortcut for logged in users
+        pattern = '<a href="(/.+?)" class="download_file_link" 
style="margin:0px 0px;">Download File</a>'
+        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)
@@ -53,50 +72,150 @@ class PutlockerResolver(Plugin, UrlResolver, 
PluginSettings):
         #post session_hash
         try:
             html = self.net.http_POST(web_url, form_data={'hash': 
session_hash, 
-                                   'confirm': 'Continue as Free User'}).content
+                                                           '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))
+            common.addon.log_error('putlocker: got http error %d posting %s' 
%(e.code, web_url))
             return False
         
-        #find playlist code
+        #find playlist code  
         r = re.search('\?stream=(.+?)\'', html)
         if r:
-            code = r.group(1)
+            playlist_code = r.group(1)
         else:
-            common.addon.log_error('putlocker: playlist code not found')
-            return False
+            r = re.search('key=(.+?)&',html)
+            playlist_code = r.group(1)
         
-        #download & return link.
-        if r and 'putlocker' in host:
-            Avi = "http://putlocker.com/get_file.php?stream=%s&original=1"%code
-            html = self.net.http_GET(Avi).content
-            final=re.compile('url="(.+?)"').findall(html)[0]
-            return 
"%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0')
+        #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('&amp;','&')
+                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('&amp;','&')
+                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:
-            Avi = "http://sockshare.com/get_file.php?stream=%s&original=1"%code
-            html = self.net.http_GET(Avi).content
-            final=re.compile('url="(.+?)"').findall(html)[0]
-            return 
"%s|User-Agent=%s"%(final,'Mozilla%2F5.0%20(Windows%20NT%206.1%3B%20rv%3A11.0)%20Gecko%2F20100101%20Firefox%2F11.0')
+            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('&amp;','&'),'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'
-        else:
-            host = 'www.sockshare.com'
-        return 'http://%s/file/%s' % (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
-        
+            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)
-                 
+            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('(?:<span class=pro_user>\( Pro \)</span>|<span 
class="free_user">\( Free \)</span>)', 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('<td>CAPTCHA</td>.+?<td><img src="(.+?)" 
/><br>', source, re.DOTALL).group(1)
+            captcha_img = 'http://www.putlocker.com%s' 
%re.sub('&amp;','&',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 += '<setting label="Highest Quality" id="%s_quality" ' % 
self.__class__.__name__
+        xml += 'type="enum" values="FLV|Maximum" default="0" />\n'
+        xml += '<setting id="%s_login" ' % self.__class__.__name__
+        xml += 'type="bool" label="login" default="false"/>\n'
+        xml += '<setting id="%s_username" enable="eq(-1,true)" ' % 
self.__class__.__name__
+        xml += 'type="text" label="username" default=""/>\n'
+        xml += '<setting id="%s_password" enable="eq(-2,true)" ' % 
self.__class__.__name__
+        xml += 'type="text" label="password" option="hidden" default=""/>\n'
+        xml += '<setting id="%s_notify" ' % self.__class__.__name__
+        xml += 'type="bool" label="Notify on login" default="false"/>\n'
+        return xml
+
+class InputWindow(xbmcgui.WindowDialog):
+    def __init__(self, *args, **kwargs):
+        self.cptloc = kwargs.get('captcha')
+        self.img = xbmcgui.ControlImage(335,30,624,60,self.cptloc)
+        self.addControl(self.img)
+        self.kbd = xbmc.Keyboard()
 
+    def get(self):
+        self.show()
+        self.kbd.doModal()
+        if (self.kbd.isConfirmed()):
+            text = self.kbd.getText()
+            self.close()
+            return text
+        self.close()
+        return False
diff --git a/script.module.urlresolver/lib/urlresolver/plugins/vidstream.py 
b/script.module.urlresolver/lib/urlresolver/plugins/vidstream.py
index 78e8f2c..2924a70 100644
--- a/script.module.urlresolver/lib/urlresolver/plugins/vidstream.py
+++ b/script.module.urlresolver/lib/urlresolver/plugins/vidstream.py
@@ -35,42 +35,41 @@ class VidstreamResolver(Plugin, UrlResolver, 
PluginSettings):
         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/(.*)'
+        #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:
-            html = self.net.http_GET(web_url).content
+            resp = self.net.http_GET(web_url)
         except urllib2.URLError, e:
             common.addon.log_error(self.name + ': got http error %d fetching 
%s' %
                                     (e.code, web_url))
             return False
+        html = resp.content
+        post_url = resp.get_url()
 
-        # get settings file
-        sPattern = 'settingsFile:\s*"([^"]+)"'
-        r = re.search(sPattern, html)
+        # get post vars
+        form_values = {}
+        for i in re.finditer('<input.*?name="(.*?)".*?value="(.*?)">', html):
+            form_values[i.group(1)] = i.group(2)
+        try:
+            html = self.net.http_POST(post_url, form_data=form_values).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
+        pattern = 'file:\s*"([^"]+)",'
+        r = re.search(pattern, 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 r.group(1)
 
         return False
 
     def get_url(self, host, media_id):
-            return 'http://vidstream.us/video/%s' % (media_id)
+            return 'http://vidstream.in/%s' % (media_id)
 
     def get_host_and_id(self, url):
         r = re.search(self.pattern, url)

-----------------------------------------------------------------------

Summary of changes:
 script.module.urlresolver/addon.xml                |    4 +-
 script.module.urlresolver/changelog.txt            |    9 +
 .../lib/urlresolver/plugins/divxstage.py           |    2 +-
 .../lib/urlresolver/plugins/ecostream.py           |   24 ++-
 .../lib/urlresolver/plugins/flashx.py              |   20 ++-
 .../lib/urlresolver/plugins/putlocker.py           |  193 ++++++++++++++++----
 .../plugins/{hostingcup.py => streamcloud.py}      |   75 ++++----
 .../lib/urlresolver/plugins/vidstream.py           |   41 ++--
 .../plugins/{hostingcup.py => zooupload.py}        |   69 ++++----
 9 files changed, 294 insertions(+), 143 deletions(-)
 copy script.module.urlresolver/lib/urlresolver/plugins/{hostingcup.py => 
streamcloud.py} (51%)
 copy script.module.urlresolver/lib/urlresolver/plugins/{hostingcup.py => 
zooupload.py} (52%)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to