0

How do I get page descriptions with Mechanize?

The Pismo gem has this functionality, but it's worse than the Mechanize gem. Mechanize finds image tags, for example.

I didn't find in the Mechanize documentation how to get the description.

Does anyone know a better plugin or how I can do that?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Luccas
  • 4,078
  • 6
  • 42
  • 72

1 Answers1

2

Try this:

node = page.at("head meta[name='description']")
description = node["content"]

(node is an Nokogiri::XML::Node.)

Tyson
  • 6,214
  • 3
  • 32
  • 37