Created
September 15, 2014 21:15
-
-
Save tom-henderson/3d127af3e7ff7bf94823 to your computer and use it in GitHub Desktop.
Scrape a list of new world supermarket locations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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