I'm trying to learn more about web scraping, but I stumbled upon a problem while trying to scrape data from the following URL:
https://www.encuentra24.com/guatemala-es/ajax/bienes-raices-venta-de-propiedades-casas?&page=2&list=category
If instead of an AJAX the URL contained the information in a JSON, I could easily scrape the information with the following code:
# Assign URL to variable: url
url = 'https://www.encuentra24.com/guatemala-es/ajax/bienes-raices-venta-de-propiedades-casas?&page=2&list=category'
# Package the request, send the request and catch the response: r
r = requests.get(url)
# Decode the JSON data into a dictionary: json_data
json_data = r.json()
# Extract data from the Json file
json_data_2 = json_data['listing']
#normalize json data into a dataframe
df = json_normalize(json_data_2)
df.head()
But, since it seems to be AJAX, I'm completely lost.
Any comments or help will be highly appreciated.
Thank you!
question from:
https://stackoverflow.com/questions/65836815/scrape-data-from-ajax-url-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…