Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://krasnoeibeloe.ru/catalog/konyak_armanyak_brendi/
- import datetime
- import requests
- from bs4 import BeautifulSoup
- import pandas as pd
- import datetime
- import lxml
- time = datetime.datetime.now()
- print(time)
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36'}
- # хост страница для парсинга таблицы Клубов Премьер Лиги
- host ='https://krasnoeibeloe.ru/catalog/konyak_armanyak_brendi/'
- # хвостовая часть страницы для парсинга таблицы
- tail = '?PAGEN_1='
- u = host + tail + str('1')
- response = requests.get(u, headers=headers)
- # в объект soup складываем спарсенный html код каждой страницы
- soup = BeautifulSoup(response.text, 'lxml')
- s = soup.find('div', {'class': 'catalog_container catalog_container_view_pl'}) # находим тег с таблицей c названиями товаров
- rows = s.find_all('div', {'class':'catalog_cont_row clearfix'}) # строки из каталога
- cell = rows[0].contents[0].find('div',{'class': 'i_price'}).next_element
- print(cell)
Advertisement
Add Comment
Please, Sign In to add comment