Created
August 2, 2013 06:39
-
-
Save havenwood/6137914 to your computer and use it in GitHub Desktop.
Lobsters! Open every https://lobste.rs frontpage link in its own tab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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