from bs4 import BeautifulSoup
import requests
def parse():
URL = '
HEADERS = {
'User_agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
}
pass
response = requests.get(URL,HEADERS)
soup = BeautifulSoup(response.content, 'html.parser')
items = soup.findall('div', class_ = 'offer-wrapper' )
comps = []
for item in items:
comps.append({
'title': item.find('a', class_ = 'marginright5 link linkWithHash detailsLink linkWithHashPromoted').get_text(strip = True)
})
pass
for comp in comps:
print (comp['title'])
pass
parse()
Вот такой Traceback выдает -
Traceback (most recent call last):
File "C:\Users\просто\Desktop\Программирование\Работы\Прочее\БОТ\Parser1.py", line 30, in <module>
parse()
File "C:\Users\просто\Desktop\Программирование\Работы\Прочее\БОТ\Parser1.py", line 15, in parse
items = soup.findall('div', class_ = 'offer-wrapper' )
TypeError: 'NoneType' object is not callable