Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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