Last active
August 29, 2015 13:57
-
-
Save Sinceretear/9730777 to your computer and use it in GitHub Desktop.
mechanize practice
This file contains hidden or 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
class MainController < ApplicationController | |
require 'rubygems' | |
require 'mechanize' | |
require 'open-uri' | |
def home | |
end | |
def datapages | |
url = 'http://www.hotnewhiphop.com/archive/' | |
agent = Mechanize.new | |
page = agent.get(url) | |
@hnhh = page.links.each do |link| | |
puts link | |
end | |
end | |
end | |
#the code for the view minues a lot of irrelevant stuff | |
<div> | |
<%= @hnhh.first.href %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment