Skip to content

Instantly share code, notes, and snippets.

@nhoag
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhoag/30e47e6a04c254f84410 to your computer and use it in GitHub Desktop.
Save nhoag/30e47e6a04c254f84410 to your computer and use it in GitHub Desktop.
Scrape Acquia's list of incompatible modules
require 'rubygems'
require 'mechanize'
require 'logger'
require 'nokogiri'
# Create a new mechanize object
mech = Mechanize.new
# Uncomment for verbose output
# mech.log = Logger.new $stderr
# mech.agent.http.debug_output = $stderr
# Load the Accounts site
page = mech.get('https://accounts.acquia.com/')
form = page.forms[0]
username_field = form.field_with(:id => 'edit-name')
username_field.value = 'your-email' # <- Add your email here
password_field = form.field_with(:id => 'edit-pass')
password_field.value = 'your-password' # <- Add your password here
form.submit form.buttons.first
incompatible = mech.get('https://docs.acquia.com/articles/module-incompatibilities-acquia-cloud');
doc = Nokogiri::HTML(incompatible.body, "UTF-8")
doc.xpath('//tr').each do |item|
if !item.xpath('./td/a')[0].nil?
item.xpath('./td/a')[0].each do |x|
puts x[1].split('/')[-1]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment