Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created August 2, 2013 06:39
Show Gist options
  • Save havenwood/6137914 to your computer and use it in GitHub Desktop.
Save havenwood/6137914 to your computer and use it in GitHub Desktop.
Lobsters! Open every https://lobste.rs frontpage link in its own tab.
require 'httpclient'
require 'nokogiri'
response = HTTPClient.get 'https://lobste.rs'
lobsters = Nokogiri::HTML response.body
links = lobsters.xpath %[//*[@id[starts-with(.,'story')]]/div[2]/span[1]/a]
links.each do |link|
`open #{link.attributes['href'].value}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment