Hello:
Thanks for that example. It gave me something to thing about.
The first thing I noticed is that you are using:
-> querySelectorAll('table#game_info tr') # get all rows from
+game_info table
to find the game table.
Not all website provide an id on the table
please consider the following webpage:
http://www.databasefootball.com/boxscores/scheduleyear.htm?yr=1985&lg=nfl
What I am want to extract from here is the basic game info week by week.
When I look at the source for the page I do not see an id.
Anyway I wrote this bit of code:
use strict;
use warnings;
use HTML::HTML5::Parser;
use XML::LibXML::QuerySelector;
use XML::LibXML;
use Data::Dumper;
my $url = "http://www.databasefootball.com/boxscores/scheduleyear.htm?
+yr=1985&lg=nfl";
my $parser = HTML::HTML5::Parser->new;
my $doc = $parser->parse_file($url);
print Dumper $doc;
print $doc->toString;
just to see what HTML::HTML5::Parser would do with the databasefootbal.com season page.
I expected the webpage would get parse into some sort of XML structure I could query.
But I do not see that.
Hope I am not testing your patience, but how would I get at the tables of scores by week in the above webpage.
Many thanks
KD
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.