The branch, frodo has been updated
       via  eaef5915ce7a8fd3c5d1aaf77103d045081e8667 (commit)
      from  dff232cb5e3341394394233c4d878ae0ac64dd4a (commit)

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

commit eaef5915ce7a8fd3c5d1aaf77103d045081e8667
Author: Martijn Kaijser <[email protected]>
Date:   Sun Jul 27 12:50:05 2014 +0200

    [plugin.video.youtube] 4.4.10

diff --git a/plugin.video.youtube/YouTubePlayer.py 
b/plugin.video.youtube/YouTubePlayer.py
index 1cea249..a9fe669 100644
--- a/plugin.video.youtube/YouTubePlayer.py
+++ b/plugin.video.youtube/YouTubePlayer.py
@@ -386,8 +386,21 @@ class YouTubePlayer():
 
         return links
 
+    def _extractVarLocalFuns(self, match):
+        varName, objBody = match.groups()
+        output = ''
+        for func in objBody.split( '},' ):
+            output += re.sub(
+                r'^([^:]+):function\(([^)]*)\)',
+                r'function %s__\1(\2,*args)' % varName,
+                func
+            ) + '\n'
+        return output
+
     def _jsToPy(self, jsFunBody):
-        pythonFunBody = re.sub(r'function (\w*)\$(\w*)', r'function \1_S_\2', 
jsFunBody)
+        self.common.log(jsFunBody)
+        pythonFunBody = re.sub(r'var ([^=]+)={(.*?)}};', 
self._extractVarLocalFuns, jsFunBody)
+        pythonFunBody = re.sub(r'function (\w*)\$(\w*)', r'function \1_S_\2', 
pythonFunBody)
         pythonFunBody = pythonFunBody.replace('function', 'def').replace('{', 
':\n\t').replace('}', '').replace(';', '\n\t').replace('var ', '')
         pythonFunBody = pythonFunBody.replace('.reverse()', '[::-1]')
 
@@ -402,14 +415,24 @@ class YouTubePlayer():
             if match:
                 lines[i] = lines[i].replace( match.group(0), 'len(' + 
match.group(1)  + ')')
             # a.slice(3) -> a[3:]
-            match = re.search('(\w+?)\.slice\(([0-9]+?)\)', lines[i])
+            match = re.search('(\w+?)\.slice\((\w+?)\)', lines[i])
             if match:
                 lines[i] = lines[i].replace( match.group(0), match.group(1) + 
('[%s:]' % match.group(2)) )
+
             # a.join("") -> "".join(a)
             match = re.search('(\w+?)\.join\(("[^"]*?")\)', lines[i])
             if match:
                 lines[i] = lines[i].replace( match.group(0), match.group(2) + 
'.join(' + match.group(1) + ')' )
-        return "\n".join(lines)
+
+            # a.splice(b,c) -> del a[b:c]
+            match = re.search('(\w+?)\.splice\(([^,]+),([^)]+)\)', lines[i])
+            if match:
+                lines[i] = lines[i].replace( match.group(0), 'del ' + 
match.group(1) + '[' + match.group(2) + ':' + match.group(3) + ']' )
+
+        pythonFunBody = "\n".join(lines)
+        pythonFunBody = re.sub(r'(\w+)\.(\w+)\(', r'\1__\2(', pythonFunBody)
+        pythonFunBody = re.sub(r'([^=])(\w+)\[::-1\]', r'\1\2.reverse()', 
pythonFunBody)
+        return pythonFunBody
 
     def _getLocalFunBody(self, funName, playerData):
         # get function body
@@ -444,8 +467,8 @@ class YouTubePlayer():
                 return ''
 
             # get main function name
-            match = re.search("signature=(\w+?)\([^)]\)", playerData)
-            #match = re.search("signature=([$a-zA-Z]+)", playerData)
+            match = re.search("signature=([$a-zA-Z]+)\([^)]\)", playerData)
+
             if match:
                 mainFunName = match.group(1)
                 self.common.log('Main signature function name = "%s"' % 
mainFunName)
@@ -493,6 +516,7 @@ class YouTubePlayer():
             exec( algoCodeObj, vGlobals, vLocals )
         except:
             self.common.log('decryptSignature exec code EXCEPTION')
+            exec( algoCodeObj, vGlobals, vLocals )
             return ''
 
         self.common.log('Decrypted signature = [%s]' % vLocals['outSignature'])
@@ -503,8 +527,25 @@ class YouTubePlayer():
 
         return vLocals['outSignature']
 
+    def _extractLocalVarNames(self, mainFunBody ):
+        valid_funcs = ( 'reverse', 'split', 'splice', 'slice', 'join' )
+        match = re.compile( r'[; =(,](\w+)\.(\w+)\(' ).findall( mainFunBody )
+        local_vars = []
+        for name in match:
+            if name[1] not in valid_funcs:
+                local_vars.append( name[0] )
+        self.common.log('Found variable names: ' + str(local_vars))
+        return set( local_vars )
+
+    def _getLocalVarObjBody(self, varName, playerData):
+        match = re.search( r'var %s={.*?}};' % varName, playerData )
+        if match:
+            self.common.log('Found variable object: ' + match.group(0))
+            return match.group(0)
+        return ''
+
     # Note, this method is using a recursion
-    def _getfullAlgoCode( self, mainFunName, playerData, recDepth = 0, 
allLocalFunNamesTab=[] ):
+    def _getfullAlgoCode( self, mainFunName, playerData, recDepth = 0, 
allLocalFunNamesTab=[], allLocalVarNamesTab=[] ):
         # Max recursion of 5
         if 5 <= recDepth:
             self.common.log('_getfullAlgoCode: Maximum recursion depth 
exceeded')
@@ -522,6 +563,16 @@ class YouTubePlayer():
                         self.common.log("Add local function %s to known 
functions" % mainFunName)
                         funBody = self._getfullAlgoCode( funName, playerData, 
recDepth + 1, allLocalFunNamesTab ) + "\n" + funBody
 
+            varNames = self._extractLocalVarNames(funBody)
+            if len(varNames):
+                for varName in varNames:
+                    self.common.log("Found local var object: " + str(varName))
+                    self.common.log("Known vars: " + str(allLocalVarNamesTab))
+                    if varName not in allLocalVarNamesTab:
+                        self.common.log("Adding local var object %s to known 
objects" % varName)
+                        allLocalVarNamesTab.append(varName)
+                        funBody = self._getLocalVarObjBody( varName, 
playerData ) + "\n" + funBody
+
             # conver code from javascript to python
             funBody = self._jsToPy(funBody)
             return '\n' + funBody + '\n'
diff --git a/plugin.video.youtube/addon.xml b/plugin.video.youtube/addon.xml
index 8eab002..144f9cd 100644
--- a/plugin.video.youtube/addon.xml
+++ b/plugin.video.youtube/addon.xml
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
-<addon id="plugin.video.youtube" name="YouTube" provider-name="TheCollective" 
version="4.4.9">
+<addon id="plugin.video.youtube" name="YouTube" provider-name="TheCollective" 
version="4.4.10">
   <requires>
     <import addon="xbmc.python" version="2.1.0" />
     <import addon="script.module.simplejson" version="2.0.10" />
diff --git a/plugin.video.youtube/changelog.txt 
b/plugin.video.youtube/changelog.txt
index e7e7fc5..c2915e3 100644
--- a/plugin.video.youtube/changelog.txt
+++ b/plugin.video.youtube/changelog.txt
@@ -10,6 +10,9 @@
 - [RTMPDUMP] Doesn't support handshake type 10 which is required by youtube.
 - [YOUTUBE] Requesting suggestions/recommendations from youtube sometimes 
stalls.
 
+[B]Version 4.4.10[/B]
+- Fixed VEVO playback again.
+
 [B]Version 4.4.9[/B]
 - Fixed login issues for all five login methods.
 
diff --git a/plugin.video.youtube/default.py b/plugin.video.youtube/default.py
index 53adb2b..f28d4e6 100644
--- a/plugin.video.youtube/default.py
+++ b/plugin.video.youtube/default.py
@@ -30,7 +30,7 @@ except ImportError:
     import xbmcvfsdummy as xbmcvfs
 
 # plugin constants
-version = "4.4.9"
+version = "4.4.10"
 plugin = "YouTube-" + version
 author = "TheCollective"
 url = "www.xbmc.com"

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

Summary of changes:
 plugin.video.youtube/YouTubePlayer.py |   63 +++++++++++++++++++++++++++++---
 plugin.video.youtube/addon.xml        |    2 +-
 plugin.video.youtube/changelog.txt    |    3 ++
 plugin.video.youtube/default.py       |    2 +-
 4 files changed, 62 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to