A platform for community discussion. Free, open, simple.
Make Google Groups scraper work with latest chromedriver
Gerhard Schlager453ba2da7bd9
diff --git a/script/import_scripts/google_groups.rb b/script/import_scripts/google_groups.rbindex 208042faee9..dcfbdb1ce16 100755--- a/script/import_scripts/google_groups.rb+++ b/script/import_scripts/google_groups.rb@@ -7,13 +7,13 @@ gemfile(true) dogem "net-http-persistent"gem "nokogiri"- gem "selenium-webdriver"+ gem "webdrivers"endrequire "fileutils"require "nokogiri"require "optparse"-require "selenium-webdriver"+require "webdrivers"require 'selenium/webdriver/remote/http/persistent'require "set"require "yaml"@@ -23,7 +23,7 @@ DEFAULT_OUTPUT_PATH = "/shared/import/data"def driver@driver ||= beginchrome_args = ["headless", "disable-gpu"]- chrome_args << "no-sandbox" << "disable-dev-shm-usage" if inside_container?+ chrome_args << "no-sandbox" if inside_container?options = Selenium::WebDriver::Chrome::Options.new(args: chrome_args)http_client = Selenium::WebDriver::Remote::Http::Persistent.newSelenium::WebDriver.for(:chrome, options: options, http_client: http_client)@@ -203,9 +203,8 @@ rescue Selenium::WebDriver::Error::TimeOutErrornilend-def exit_with_error(message)- puts driver.current_url- STDERR.puts message+def exit_with_error(*messages)+ STDERR.puts messagesexit 1end@@ -248,16 +247,14 @@ def parse_argumentsbeginparser.parse!rescue OptionParser::ParseError => e- STDERR.puts e.message, "", parser- exit 1+ exit_with_error(e.message, "", parser)endmandatory = [:email, :password, :groupname]missing = mandatory.select { |name| instance_variable_get("@#{name}").nil? }if missing.any?- STDERR.puts "Missing arguments: #{missing.join(', ')}", "", parser- exit 1+ exit_with_error("Missing arguments: #{missing.join(', ')}", "", parser)end@path = File.join(DEFAULT_OUTPUT_PATH, @groupname) if @path.nil?