Skip to content

Instantly share code, notes, and snippets.

@halan
Created September 25, 2012 23:37
Show Gist options
  • Select an option

  • Save halan/3785110 to your computer and use it in GitHub Desktop.

Select an option

Save halan/3785110 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'mechanize'
require 'haml'
get '/' do
nickname = 'cogumm'
board = 'nerd'
url = "http://pinterest.com/#{nickname}/#{board}"
pin_class = 'PinImageImg'
@links = Mechanize.new.get(url).search("img.#{pin_class}").map {|i| i.attr('src') }
haml :index
end
__END__
@@ layout
!!!
%html
%body
%h1 Nerd Board
=yield
@@ index
-@links.each do |link|
%img{:src => link}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment