O'Reilly logo

Text Processing with Ruby by Rob Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example: Reading a League Table

Until now we’ve danced around the practicalities of scraping, discussing the theory, the tools we’ll be using, and how to approach things. Now let’s try to apply that knowledge and extract some information from a site.

For this example, I’m going to extract the names and point totals of the teams in the Premier League, the highest football (that’s soccer in the US) league in England. This information is available on a page on the BBC website.[9]

The league table, as visitors to the website see it (as of February 2015), looks like this:

images/src/premier-league-table-1.png

It’s presented in a pretty table, but that’s not much use to us in our scripts. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required