changeset 118:e5f2961a6145

urllog: Improve rasiatube URL de-mangling.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 13 Oct 2011 20:14:13 +0300
parents d40a0f3af7ab
children 939d2338c842
files urllog.tcl
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/urllog.tcl	Thu Oct 13 20:13:31 2011 +0300
+++ b/urllog.tcl	Thu Oct 13 20:14:13 2011 +0300
@@ -547,16 +547,12 @@
     # Rasiatube hack
     if {[string match "*/rasiatube/view*" $urlStr]} {
       set rasia 0
-      set umatches [regexp -nocase -inline -- "<link rel=\"video_src\"\.\*\?file=(http://\[^&\]+)&" $udata]
-      if {[llength $umatches] > 0} {
-        set urlStr [lindex $umatches 1]
-        regsub -all "\/v\/" $urlStr "\/watch\?v=" urlStr
+      if {[regexp -nocase -- "<link rel=\"video_src\"\.\*\?file=(http://\[^&\]+)&" $udata umatches utmp]} {
+        regsub -all "\/v\/" $utmp "\/watch\?v=" urlStr
         set rasia 1
       } else {
-        set umatches [regexp -nocase -inline -- "SWFObject.\"(\[^\"\]+)\", *\"flashvideo" $udata]
-        if {[llength $umatches] > 0} {
-          set urlStr [lindex $umatches 1]
-          regsub "http:\/\/www.dailymotion.com\/swf\/" $urlStr "http:\/\/www.dailymotion.com\/video\/" urlStr
+        if {[regexp -nocase -- "SWFObject.\"(\[^\"\]+)\", *\"flashvideo" $udata umatches utmp]} {
+          regsub "http:\/\/www.dailymotion.com\/swf\/" $utmp "http:\/\/www.dailymotion.com\/video\/" urlStr
           set rasia 1
         }
       }