<?xml version="1.0" encoding="windows-1252"?>
<node id="1014404" title="Re: get data from xpath" created="2013-01-21 02:43:34" updated="2013-01-21 02:43:34">
<type id="11">
note</type>
<author id="965102">
Kenosis</author>
<data>
<field name="doctext">
&lt;p&gt;Perhaps using [http://search.cpan.org/~jesse/WWW-Mechanize-1.72/lib/WWW/Mechanize.pm|WWW::Mechanize] would be helpful in this case:&lt;/p&gt;
&lt;c&gt;
use strict;
use warnings;
use WWW::Mechanize;

my $mech = WWW::Mechanize-&gt;new();
my $url  = 'http://www.youtube.com/results?search_query=run+flo+rida';

$mech-&gt;get($url);

my $firstVideo = $mech-&gt;find_link( url_regex =&gt; qr!/watch\?v=! );

if ( defined $firstVideo ) {
	print 'http://www.youtube.com' . $firstVideo-&gt;url;
}
else {
	print "Unable to find link.\n";
}
&lt;/c&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;c&gt;
http://www.youtube.com/watch?v=JP68g3SYObU
&lt;/c&gt;</field>
<field name="root_node">
1014379</field>
<field name="parent_node">
1014379</field>
</data>
</node>
