Pregunta

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?

¿Fue útil?

Solución

Try this:

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top