문제

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?

도움이 되었습니까?

해결책

Try this:

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top