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

Exploring a Page

The important first step in scraping information from a web page is to explore the page, figuring out how to extract information from it, understanding its structure and how to translate our idea of what we want (“the title of the latest post,” “the price of the most expensive product”) into that structure.

It doesn’t make sense to leap straight into writing a script at this point—we’re just exploring, after all. There are two different ways to do this exploration without writing a script, and both are useful. The first is to look at the page in a web browser, using the browser’s inspection tools to explore the structure of the document. The second uses Nokogiri, but from the command line, to bridge the divide between exploring ...

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