totem r5785 - in branches/gnome-2-24: . src/plugins/youtube



Author: pwithnall
Date: Sat Oct 25 14:52:57 2008
New Revision: 5785
URL: http://svn.gnome.org/viewvc/totem?rev=5785&view=rev

Log:
2008-10-25  Philip Withnall  <philip tecnocode co uk>

	* src/plugins/youtube/youtube.py: Patch from Matthew Adams
	<roguestar191 comcast net> to use read() instead of readline() 
when
	searching for the t-param in YouTube searches, in order to 
reduce the
	number of regexp searches.



Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/plugins/youtube/youtube.py

Modified: branches/gnome-2-24/src/plugins/youtube/youtube.py
==============================================================================
--- branches/gnome-2-24/src/plugins/youtube/youtube.py	(original)
+++ branches/gnome-2-24/src/plugins/youtube/youtube.py	Sat Oct 25 14:52:57 2008
@@ -207,21 +207,19 @@
 		regexp1 = re.compile ("swfArgs.*\"t\": \"([^\"]+)\"")
 		regexp2 = re.compile ("</head>")
 
-		line = stream.readline ()
-		while (line != ""):
+		contents = stream.read ()
+		if contents != "":
 			"""Check for the t parameter, which is now in a JavaScript array on the video page"""
-			matches = regexp1.search (line)
+			matches = regexp1.search (contents)
 			if (matches != None):
 				stream.close ()
 				return matches.group (1)
 
 			"""Check to see if we've come to the end of the <head> tag; in which case, we should give up"""
-			if (regexp2.search (line) != None):
+			if (regexp2.search (contents) != None):
 				stream.close ()
 				return ""
 
-			line = stream.readline ()
-
 		stream.close ()
 		return ""
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]