[Laszlo-checkins] r13417 - openlaszlo/trunk/demos/youtube

bargull@openlaszlo.org bargull at openlaszlo.org
Sun Mar 22 13:54:38 PDT 2009


Author: bargull
Date: 2009-03-22 13:54:36 -0700 (Sun, 22 Mar 2009)
New Revision: 13417

Modified:
   openlaszlo/trunk/demos/youtube/youtube.jsp
Log:
Change 20090322-bargull-pJt by bargull at dell--p4--2-53 on 2009-03-22 17:26:01
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix youtube demo (again)

New Features:

Bugs Fixed: LPP-5070 (Videos not playing in YouTube demo)

Technical Reviewer: sallen
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
Changed regular expression to match the whole (url-decoded) token field.
And updated youtube's "get_video" address.
    

Tests:
youtube works again



Modified: openlaszlo/trunk/demos/youtube/youtube.jsp
===================================================================
--- openlaszlo/trunk/demos/youtube/youtube.jsp	2009-03-22 20:23:22 UTC (rev 13416)
+++ openlaszlo/trunk/demos/youtube/youtube.jsp	2009-03-22 20:54:36 UTC (rev 13417)
@@ -11,7 +11,7 @@
 <%!
 
 /* X_LZ_COPYRIGHT_BEGIN ****************************************************
- * Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights Reserved.         *
+ * Copyright 2007-2009 Laszlo Systems, Inc.  All Rights Reserved.          *
  * Use is subject to license terms.                                        *
  * X_LZ_COPYRIGHT_END ******************************************************/
 
@@ -222,16 +222,21 @@
 
         String tId = "";
         // Extract the token field
-        Pattern tpat = Pattern.compile("token=([\\w\\d\\-]+)");
+        Pattern tpat = Pattern.compile("token=([^&]*)&");
         Matcher tmatcher = tpat.matcher(vidInfo);
         if (tmatcher.find()) {
-            tId = vidInfo.substring(tmatcher.start(1), tmatcher.end(1));
+            try {
+                tId = URLDecoder.decode(tmatcher.group(1), "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                reportError("cannot url-decode token argument: " + vidInfo, result);
+                return;
+            }
         } else {
             reportError("token argument not found in video-info: " + vidInfo, result);
             return;
         }
 
-        String url = "http://youtube.com/get_video.php?video_id=" + id + "&t=" + tId;
+        String url = "http://www.youtube.com/get_video?video_id=" + id + "&t=" + tId;
         if (HIRES) {
             url += "&fmt=6";
         } else if (MP4) {



More information about the Laszlo-checkins mailing list