Skip to content

Instantly share code, notes, and snippets.

@tom-henderson
Created September 15, 2014 21:15
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 tom-henderson/3d127af3e7ff7bf94823 to your computer and use it in GitHub Desktop.
Save tom-henderson/3d127af3e7ff7bf94823 to your computer and use it in GitHub Desktop.
Scrape a list of new world supermarket locations
import requests
from bs4 import BeautifulSoup
from pprint import pprint
url = "http://www.newworld.co.nz/store-map"
html = requests.get(url).text
soup = BeautifulSoup(html)
content = soup.find("div", class_="content")
store_links = content.find_all("a", class_="popup-store-details")
stores = [(store.get("data-store-geo"), store.get_text())
for store in store_links]
pprint(stores)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment