Move chains to their own directory
This commit is contained in:
parent
f3f7a21645
commit
c74edcb8c0
21 changed files with 50 additions and 40 deletions
43
layers/chains/milwaukee-burger-company/get_data.py
Executable file
43
layers/chains/milwaukee-burger-company/get_data.py
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import json
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
print("Searching for Milwaukee Burger Company locations")
|
||||
|
||||
# Stolen from my machine, appears to work; sufficient and necessary to get
|
||||
# around their firewall apparently?
|
||||
UA={
|
||||
"User-Agent": 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0'
|
||||
}
|
||||
|
||||
response = requests.get('https://milwaukeeburgercompany.com/', headers=UA)
|
||||
|
||||
soup = BeautifulSoup(response.text, 'html.parser')
|
||||
location_lis = soup.select('section#locations ul.location-list > li')
|
||||
|
||||
locations = []
|
||||
for location_li in location_lis:
|
||||
lon = location_li
|
||||
locations.append({
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [float(location_li['data-lng']), float(location_li['data-lat'])], # yes, [lon, lat] since it's [x, y]
|
||||
},
|
||||
"properties": {
|
||||
'address': location_li.find('dd', class_="street").text,
|
||||
'city': location_li.find('dd', class_="city-state-zip").text.split(',')[0],
|
||||
'state': location_li.find('dd', class_="city-state-zip").text.split(', ')[1].split(' ')[0],
|
||||
'zip': location_li.find('dd', class_="city-state-zip").text.split(' ')[-1],
|
||||
},
|
||||
})
|
||||
|
||||
geojson = {
|
||||
"type": "FeatureCollection",
|
||||
"features": locations,
|
||||
}
|
||||
|
||||
with open("milwaukee-burger-company-data.geojson", "w") as f:
|
||||
f.write(json.dumps(geojson))
|
||||
Loading…
Add table
Add a link
Reference in a new issue