Skip to content

Instantly share code, notes, and snippets.

Usman Asif usmanasif

Block or report user

Report or block usmanasif

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@usmanasif
usmanasif / edmunds_scraper.rb
Created Apr 9, 2019
Scraper for Edmunds Site
View edmunds_scraper.rb
require "selenium-webdriver"
require 'write_xlsx'
namespace :scraping do
desc "Fetch all the data"
task fetch: :environment do
workbook, worksheet, worksheet2 = create_worksheet
options = Selenium::WebDriver::Chrome::Options.new(args: ['headless', '--blink-settings=imagesEnabled=false'])
driver = Selenium::WebDriver.for :chrome, options: options
driver.navigate.to "https://www.edmunds.com/car-maintenance/guide-page.html"
View gist:4a9e1a295faba0d2ef597158d11856d2
def flatten(array)
puts array.inspect
result = []
array.each_with_object([]) do |a, result|
result.push *((a.is_a?(Array) ? flatten(a) : a))
end
end
You can’t perform that action at this time.