Ankur wrote: > > I am trying to develop an app for my website for which i need to get > the name of the Shows from http://tv.yahoo.com/listings. > > If you go over the code you can see that some of the rows have the > shows with hyperlink and others without. How do i get the Hyperlink > and the show's name from the hyperlink identified by <a > class="showTitle".... > > I have been trying for a long time now with the reg ex > =~ /\">.*<\/a>/i but I was not able to get the names of the shows > which are without a hyperlink in the href part. > > Anyone with Ideas please help...
The program below should help you. But please be certain that Yahoo are happy with the way you are using information from their site. HTH, Rob use strict; use warnings; use LWP::RobotUA; use HTML::TreeBuilder; my $ua = LWP::RobotUA->new( agent => q/Ankur's Bot/, from => '[EMAIL PROTECTED]', delay => 5/60, ); my $resp = $ua->get('http://tv.yahoo.com/listings'); my $tree = HTML::TreeBuilder->new_from_content($resp->content); my @shows = $tree->look_down(_tag => 'a', class => 'showTitle', href => qr/./); foreach (@shows) { print $_->as_trimmed_text, "\n"; print $_->attr('href'), "\n"; print "\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/