From 7dac6bdb2103513c48e32d19443102ea9eb90f44 Mon Sep 17 00:00:00 2001 From: Dronminator Date: Sat, 25 Feb 2023 20:11:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BC=D0=B0=D1=88=D0=BD=D0=B5?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5:=20=D0=9F?= =?UTF-8?q?=D0=B0=D1=80=D1=81=D0=B8=D0=BD=D0=B3=20=D0=A1=D0=B0=D0=B9=D1=82?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- Задания/task1/Lahin/parsing.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d56657a..a971a2c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/Задания/task1/Lahin/parsing.py b/Задания/task1/Lahin/parsing.py index 42c83eb..31c95f4 100644 --- a/Задания/task1/Lahin/parsing.py +++ b/Задания/task1/Lahin/parsing.py @@ -1,14 +1,14 @@ + from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.service import Service -from time import sleep s = Service("С:\DATA\ChromeDriver\chromedriver.exe") browser = webdriver.Chrome(service=s) -browser.get("https://www.kinopoisk.ru/lists/movies/top250/") -sleep(15) +browser.get("https://online.metro-cc.ru/category/sladosti-chipsy-sneki/shokolad-batonchiki?from=under_search&is_action=1") html_text = browser.page_source soup = BeautifulSoup(html_text, 'lxml') -films = soup.find_all('div', class_="desktop-list-main-info_secondaryTitleSlot__mc0mI") -for film in films: - print(film.text) - print("--------") +products = soup.find_all('a', class_="product-card-name reset-link catalog-2-level-product-card__name style--catalog-2-level-product-card") +prices = soup.find_all('span', class_="product-card-prices__actual color-red") +for product,price in zip(products, prices): + print(f"Продукт: {product.text[3:]}Цена: {price.text}") + print("-"*100) \ No newline at end of file