Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: get data from xpath

by tmharish (Friar)
on Jan 21, 2013 at 08:01 UTC ( #1014408=note: print w/replies, xml ) Need Help??


in reply to get data from xpath

HTML::Miner will work too:

use strict ; use warnings ; use HTML::Miner ; use Data::Dump qw(dump) ; my $mine = new HTML::Miner( CURRENT_URL => 'http://www.youtube.com/results?search_query=run+fl +o+rida', ); my @links = @{ $mine->get_links() } ; my @result_links; foreach my $link ( @links ) { if( $link->{ DOMAIN } =~ 'www.youtube.com' ) { if( $link->{ ANCHOR } =~ /video-time/ ) { if( $link->{ ABS_URL } =~ /http:\/\/www\.youtube\.com(\/watch\ +?v=.*?)$/ ) { push @result_links, $1 ; } } } } dump( \@result_links ) ;

Disclaimer: I maintain that module.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014408]
help
Chatterbox?
[Corion]: jthebarg: There is the switch keyword if you want that, but maybe a dispatch table is closer.
[Corion]: If by "case" you meant "case-insensitive ", see fc, uc and lc and perlop on the /i flag ;)
Corion waves to virtualsue
[virtualsue]: I have made a post for the first time in ... years
[marto]: hey virtualsue!
Eily thought about Neko Case first, something might be wrong with my brain's wiring
[virtualsue]: I recommended dbic-migration even though I am having trouble with it this week. It might be my fault.
[ambrus]: wow! I haven't seen you here for a long time, virtualsue
virtualsue waves back
[Eily]: it would have been 2 years in 2 weeks actually. And welcome back virtualsue :)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (14)
As of 2017-09-26 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (295 votes). Check out past polls.

    Notices?