# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
URL = 'https://www.asos.com/ru/another-influence/futbolka-s-dlinnym-rukavom-i-vysokim-vorotom-another-influence/prd/12367685?clr=svetlo-korichnevyj&colourWayId=16470924&SearchQuery=&cid=28235'
HEADERS = {
'user-agent' : 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
'accept' : '*/*'
}
def get_html(url, params = None):
r = requests.get(url, headers = HEADERS, params = params)
return r
def get_content(html):
soup = BeautifulSoup(html, 'html.parser')
items = soup.find_all('div', class_ = 'layout-aside')
clothes = []
for item in items:
clothes.append({
#'title' : item.find('div', class_ = '_3J74XsK').get_text(),
#'last_price' : item.find('span', class_ = 'Dy5fJQR _25fnYaV').get_text(),
#'now_price' : item.find('span', class_ = '_3VjzNxC').get_text()
'title' : item.find('div', class_ = 'product-hero').get_text()
})
print(clothes)
def parse():
html = get_html(URL)
if html.status_code == 200:
get_content(html.text)
else:
print('Ошибка!')
parse()
Cтраница парсинга =
https://www.asos.com/ru/another-influence/futbolka...
При выводе никакой ошибки, но минyс в том что вместо желанного вывода Футболка с длинным рукавом и высоким воротом Another Influence я полyчаю это
[{'title': "\nФутболка с длинным рукавом и высоким воротом Another Influence\nwindow.asos.performance.markAndMeasure('pdp:title_displayed');\n\n\n\n\n\n\n\n\n\n"}]
Помогите с решением проблемы, заранее спасибо за ответы)