gistlib
main.pyimport requests from bs4 import BeautifulSoup url = 'https://www.avito.ru/moskva?q=iphone' response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') items = soup.find_all('div', class_='item_table') for item in items: title = item.find('h3', class_='title').text.strip() price = item.find('span', class_='price').text.strip() print(f'Title: {title}\nPrice: {price}\n') 412 chars16 lines
import requests from bs4 import BeautifulSoup url = 'https://www.avito.ru/moskva?q=iphone' response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') items = soup.find_all('div', class_='item_table') for item in items: title = item.find('h3', class_='title').text.strip() price = item.find('span', class_='price').text.strip() print(f'Title: {title}\nPrice: {price}\n')
gistlibby LogSnag