Web-Scraping для сайта
Делаю Web-Scraping для сайта, нужно вывести:
- 'location of the property'
- 'the link of the announcement'
- 'date and time published'
- 'the price of the property'
Моя попытка:
import requests
from bs4 import BeautifulSoup
import pandas as pd
url = 'https://bina.az/'
response = requests.get(url)
trainings_soup = BeautifulSoup(response.text, 'html.parser')
all_locations, all_links, all_date_time, all_price = [], [], [], []
for product in trainings_soup.find_all('div', class_='residences_list'):
print(product.find('a').get('href'))
link = 'https://bina.az/' + product.find('a').get('href')
location = product.find('div', class_='location').text
date_time = product.find('div', class_='city_when').text
price = product.find_all('span', class_='price-val').text
all_locations.append(location)
all_links.append(link)
all_date_time.append(date_time)
all_price.append(price)
data_list = list(zip(all_locations,all_links, all_date_time, all_price))
column_names = ['Locations','Links', 'Date_time','Price']
bina = pd.DataFrame(data_list,columns=column_names)
Вроде бы тэги поставил верно, но всякий раз выходит пустой list. Что я делаю нерпавильно?