import requests
from bs4 import BeautifulSoup as bs
def parser():
HOST = "https://www.avito.ru/"
max_pages = 9
for x in range(1, max_pages):
page = requests.get("https://www.avito.ru/moskovskaya_oblast_krasnogorsk/igry_pristavki_i_programmy?p=" + str( x ) )
soup = bs(page.content, "html.parser")
buys = []
items = soup.find_all("div", class_ = "snippet-horizontal")
for item in items:
buys.append({
"title": item.find("a", class_= "snippet-link").get_text(strip=True),
"link": HOST + item.find("a", class_="js-item-slider").get('href'),
})
for i in buys:
print(i["title"])
print(i["link"])
parser()