Домашнее задание 1 (Парсинг)

This commit is contained in:
nikitin712
2023-03-04 14:39:05 +03:00
parent 1d8f525017
commit 87476b7d2a
+5 -8
View File
@@ -1,15 +1,12 @@
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from selenium import webdriver from selenium import webdriver
from selenium.webdriver import Chrome
from selenium import webdriver
from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.service import Service
s = Service('D:\Games\data\chromedriver.exe') s = Service('D:\Games\data\chromedriver.exe')
browser = webdriver.Chrome(service=s) browser = webdriver.Chrome(service=s)
browser.get('https://www.kinopoisk.ru/list/movies/top250/') browser.get('https://www.volkswagen.ru/polo/')
html_text = browser.page_source html_text = browser.page_source
soup = BeautifulSoup(html_text, 'lxml') soup = BeautifulSoup(html_text, 'lxml')
films=soup.find_all('div', class_='base-movie-main-info_mainInfo__Zl_u3') car_names = soup.find_all('div', class_='avn001-2_name')
prices = soup.find_all('div', class_='avn001-2_price-container')
for film in films: for car_name, price in zip(car_names, prices):
print(film.text) print(f"Название машины:{car_name.text} | Цена: {price.text} рублей")