Simple scrapping with ruby

Simple scrapping using Nokogiri

require 'open-uri'  
require 'nokogiri'  
doc = Nokogiri::HTML(open("https://www.google.com"))  

Nokogiri + RestClient helps you out if you want to handle redirects

require 'restclient'  
require 'nokogiri'

page = Nokogiri::HTML(RestClient.get("http://www.google.com"))  

Using Mechanize

first of all, install mechanize

gem install mechanize  
require 'mechanize'

mechanize = Mechanize.new

page = mechanize.get('https://google.com/')

puts page.title  

More: In progress

Victor Velazquez

Coder, Musician, Startups, Passionate Dancer & Life Lover. Software Engineer at MagmaLabs, Co-founder of Web Dev Talks, Co-founder of Voltaire, Co-founder of Paqkit, Ex-co-founder of Zaznova.

Subscribe to The zazvick's blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!