Skip to content

Instantly share code, notes, and snippets.

@milesgrimshaw
Created March 16, 2015 23:06
Show Gist options
  • Save milesgrimshaw/9f703429ada775cd8fe1 to your computer and use it in GitHub Desktop.
Save milesgrimshaw/9f703429ada775cd8fe1 to your computer and use it in GitHub Desktop.
Script to scrape the clients feed behind the map on MindBody's website
require 'nokogiri'
require 'pp'
require 'mechanize'
require 'open-uri'
require 'csv'
page = Nokogiri::XML(open('https://www.mindbodyonline.com/clients/feed/all.xml'))
items = page.css('marker')
CSV.open("mind_new.csv", "wb") do |csv|
csv << ['Name', 'Industry', 'Country', 'City', 'Lon', 'Lat']
for i in 0..items.length()-1
name = items[i]['name']
industry = items[i]['industry']
country = items[i]['country']
city = items[i]['city']
lat = items[i]['lat']
lon = items[i]['lng']
csv << [name, industry, country, city, lat, lon]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment