Hello There, Today I will discuss how to scrape a website using gem
mechanize. Here is an example:
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.
gem install mechanizeor write
gem 'mechanize'into your gemfile and run
Fetching data from the websites:
- Create a ruby file and write the following set of code in that file: