Last active
December 12, 2021 18:54
-
-
Save shatteringlass/0ad991318e0caf59c453ca17d8efd94e to your computer and use it in GitHub Desktop.
zero.eu restaurants
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 | |
import json | |
cookies = { | |
# 'PHPSESSID': 'h660q1l9m57slcifjgpnulhtde', | |
} | |
headers = { | |
'Accept': 'application/json, text/javascript, */*; q=0.01', | |
'Accept-Language': 'en-GB,en;q=0.9', | |
'Host': 'zero.eu', | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15', | |
# 'Referer': 'https://zero.eu/en/roma/luoghi/ristoranti/?cuisine[]=brunch&cuisine[]=creativo&cuisine[]=tradizionale-regionale&cuisine[]=vegetariano-vegano&popularSearch[]=pranzo&price[]=caro&price[]=medio', | |
'Accept-Encoding': 'gzip, deflate, br', | |
# 'Connection': 'keep-alive', | |
# 'X-Requested-With': 'XMLHttpRequest', | |
# 'X-WP-Nonce': 'c27e7c78ce', | |
} | |
params = ( | |
('categoria_luogo', 'ristoranti'), | |
('southWest[lat]', '41.80623584786463'), | |
('southWest[lng]', '12.28641961267284'), | |
('northEast[lat]', '41.973049912642544'), | |
('northEast[lng]', '12.730056983736073'), | |
('ricerche_frequenti_luogo', 'pranzo'), | |
('cucina_luogo', 'brunch,creativo,tradizionale-regionale,vegetariano-vegano'), | |
('prezzo_luogo', 'caro,medio'), | |
('lang', 'en'), | |
('remove', 'false'), | |
) | |
response = requests.get('https://zero.eu/api/v2/locations/markers', headers=headers, params=params, cookies=cookies) | |
print(json.dumps(response.json())) | |
#NB. Original query string below. It seems impossible to parse and | |
#reproduce query strings 100% accurately so the one below is given | |
#in case the reproduced version is not "correct". | |
# response = requests.get('https://zero.eu/api/v2/locations/markers?categoria_luogo=ristoranti&southWest%5Blat%5D=41.80623584786463&southWest%5Blng%5D=12.28641961267284&northEast%5Blat%5D=41.973049912642544&northEast%5Blng%5D=12.730056983736073&ricerche_frequenti_luogo=pranzo&cucina_luogo=brunch%2Ccreativo%2Ctradizionale-regionale%2Cvegetariano-vegano&prezzo_luogo=caro%2Cmedio&lang=en&remove=false', headers=headers, cookies=cookies) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment