Perhaps using WWW::Mechanize would be helpful in this case:
use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $url = 'http://www.youtube.com/results?search_query=run+flo+rida'; $mech->get($url); my $firstVideo = $mech->find_link( url_regex => qr!/watch\?v=! ); if ( defined $firstVideo ) { print 'http://www.youtube.com' . $firstVideo->url; } else { print "Unable to find link.\n"; }
Output:
http://www.youtube.com/watch?v=JP68g3SYObU
In reply to Re: get data from xpath
by Kenosis
in thread get data from xpath
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |