#!/usr/bin/perl use CGI qw(:standard); use STRICT; print header(); # src='http://www.bolt.com/video/flv_player_branded.swf?contentId=1952754&contentType=2' # src from bolt code my $text = qq([video](title)- BOLT CODE - (/title)
Get video codes at Bolt[/video] [video](title)- YOUTUBE CODE - (/title)[/video] [video](title)- YAHOO CODE - (/title)[/video]); while ($text =~ s{\[video\](.+?)\[\/video\]} { ($src,$fvars,$type,$width,$height) = (); $vdata = $1; $vdata =~ m!\(title\)(.+?)\(\/title\)!is; $title = $1; $vdata =~ s!("|'|#)!!isg; $vdata =~ m!\|\/\>)!is; $video_data = $1; $video_data =~ s!("|'|#)!!isg; #clean it up if ($video_data =~ m|type=application\/x\-shockwave\-flash|i) { $type = "ok"; $video_data =~ s|type=application\/x\-shockwave\-flash||ig; # remove the Type } $video_data =~ m!width\s*=\s*([^ ]+)!i; $width = "$1"; $video_data =~ m|height\s*=\s*([^ ]+)|i; $height = "$1"; $video_data =~ m|src\s*=\s*([^ ]+)|ig; $src = "$1"; print "this is width of $title - $width\n"; print "this is height of $title - $height\n"; print "this is src of $title - $src\n"; if ($type&&$src&&$width&&$height) { $video_data =~ s/^\s+//; #remove leading spaces $video_data =~ s/\s+$//; #remove trailing spaces $video_data =~ s/\s+/ /g; #remove excess white spaces if ($video_data =~ m|flashvars\s*=\s*([^ ]+)|ig) { #match and save $fvars = "$1"; $video_data =~ s|flashvars\s*=\s*([^ ]+)||ig; #delete flashvars from string } @values = split(' ',$video_data); $querystring = join('&', @values); if ($fvars) { $querystring .= "&" . $fvars; } qq|QUERTSTRING,TITLE,WIDTH and HEIGHT - ($title) $querystring($title)(width - $width)(height - $height)(type - $type)(src - $src)<--videocode-->|; } else { qq|PROBLEM WITH VIDEO CODE TITLED - $title<--videocode-->|; } }eisg) {} print "This is the text output - $text";