Guest User

Untitled

a guest
May 17th, 2021
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. #  https://krasnoeibeloe.ru/catalog/konyak_armanyak_brendi/
  2. import datetime
  3. import requests
  4. from bs4 import BeautifulSoup
  5. import pandas as pd
  6. import datetime
  7. import lxml
  8. time = datetime.datetime.now()
  9. print(time)
  10. 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'}
  11. # хост страница для парсинга таблицы Клубов Премьер Лиги
  12. host ='https://krasnoeibeloe.ru/catalog/konyak_armanyak_brendi/'
  13. # хвостовая часть страницы для парсинга таблицы
  14. tail = '?PAGEN_1='
  15. u = host + tail + str('1')
  16. response = requests.get(u, headers=headers)
  17. # в объект soup складываем спарсенный html код каждой страницы
  18. soup = BeautifulSoup(response.text, 'lxml')
  19. s = soup.find('div', {'class': 'catalog_container catalog_container_view_pl'}) # находим тег с таблицей c названиями товаров
  20. rows = s.find_all('div', {'class':'catalog_cont_row clearfix'}) # строки из каталога
  21. cell = rows[0].contents[0].find('div',{'class': 'i_price'}).next_element
  22. print(cell)
Advertisement
Add Comment
Please, Sign In to add comment