def parse():
URL = 'https://www.olx.ua/list/'
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
}
response = requests.get(URL,
headers = HEADERS)
soup = BeautifulSoup(response.content, 'html.parser')
items = soup.findAll('div', class_ = 'offer-wrapper cc_cursor')
comps = []
for item in items:
comps.append({
'title': item.find('a', class_ = 'marginright5 link linkWithHash detailsLink').get_text(strip = True)
})
for comp in comps:
print(comp['title'])