Hello There, Today I will discuss how to scrape a website using gem mechanize
. Here is an example:
Introduction
Mechanize is a ruby gem to scrape the websites. It uses Nokogiri to parse the html data. You can find more details about it on Link.
Install gem
- Run
gem install mechanize
or writegem 'mechanize'
into your gemfile and runbundle install
Fetching data from the websites:
- Create a ruby file and write the following set of code in that file:
Thanks!!