Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: get data from xpath

by Kenosis (Priest)
on Jan 21, 2013 at 07:43 UTC ( #1014404=note: print w/ replies, xml ) Need Help??


in reply to get data from xpath

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


Comment on Re: get data from xpath
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014404]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2014-12-29 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (193 votes), past polls