sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[livejournal] r19396: LJSUP-8992: vkontakte.ru & vk.com videos...

Committer: vtroitsky
LJSUP-8992: vkontakte.ru & vk.com videos parameters added into lj-embed tag
U   trunk/cgi-bin/LJ/EmbedModule.pm
Modified: trunk/cgi-bin/LJ/EmbedModule.pm
===================================================================
--- trunk/cgi-bin/LJ/EmbedModule.pm	2011-06-29 07:43:17 UTC (rev 19395)
+++ trunk/cgi-bin/LJ/EmbedModule.pm	2011-06-29 07:54:50 UTC (rev 19396)
@@ -131,8 +131,8 @@
         my $out=  '<lj-embed id="'. $attrs{id} .'" ';
 
         # LJSUP-8992
-        if ($code =~ m!src=["']?http://www\.youtube\.com/(v|embed)/([\w\d\_\-]+)['"]?!) {
-            $out .= 'vid="'.$2.'" source="youtube" ';
+        if ($code =~ m!src=["']?http://www\.youtube\.com/(?:v|embed)/([\w\d\_\-]+)['"]?!) {
+            $out .= 'vid="'.$1.'" source="youtube" ';
         } elsif ($code =~ m!src=["']?http://player\.vimeo\.com/video/(\d+)[?'"]?! || 
                  $code =~ m!=["']?http://vimeo\.com/moogaloop\.swf\?[\d\w\_\-\&\;\=]*clip_id=(\d+)[&'"]?! ) {
             $out .= 'vid="'.$1.'" source="vimeo" ';
@@ -142,8 +142,12 @@
             $out .= 'vid="'.$1.'" source="yandex" '; 
         } elsif ($code =~ m!http://img\.mail\.ru.+movieSrc=([\w\d\/\_\-\.]+)["']?!) {
             $out .= 'vid="'.$1.'" source="mail.ru" ';
+        } elsif ($code =~ m!http://(vkontakte\.ru|vk\.com)/video_ext!) {
+            $out .= 'source="'.$1.'" ';
+            my %fields = ($code =~ /(oid|id|hash)=([\dabcdef]+)/gm);
+            $fields{vid} =  delete $fields{id};
+            $out .= $_.'="'.$fields{$_}.'" ' foreach (keys %fields);    
         }
-
         $out .= '/>';
 
         return $out;

Tags: livejournal, pm, sunnyman
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments