Skip to content
lukes edited this page May 4, 2011 · 3 revisions

Use check :website to watch an HTML source. You'll always need to specify a source in a :from => "url" parameter,

Herald.watch do
  check :website, :from => "example.com/.rss"
  _for "keywords"
end

Multiple sources

Give :from an array value to watch more than one HTML source

Herald.watch do
  check :website, :from => ["example.com/1", "example.com/2"]
  _for "keywords"
end

Tag filtering with CSS selectors

By default Herald will search for keywords within the entire <body> of the document.

Include a :tag or :tags parameter to narrow the search down. You can make use of regular CSS selectors

Herald.watch do
  check :website, :from => "example.com", :tag => "#latest"
  _for "keywords"
end

Or use an array

Herald.watch do
  check :website, :from => "example.com", :tags => ["div.sidebar", "#item-1", "article"]
  _for "keywords"
end

Short method

Alternatively, use the watch_website short method

Herald.watch_website :from => "example.com/.rss" do
  _for "keywords"
end

See also