• Пишу парсер. Как найти все ссылки и названия вопросов?

    @Vlad242 Автор вопроса
    import requests
    from bs4 import BeautifulSoup
    def trade_spiders (max_page):
        page = 1
        while page <= max_page:
            url = 'https://toster.ru/questions/latest?page=' + str(page)
            source_code = requests.get(url)
            soup = BeautifulSoup(source_code.text, 'html.parser')
            main_title = soup.find_all('a', {"class": "question__title-link"})
            for title in main_title:
                print(title.text.strip(), title.get('href')) # Первый элемент - название, второй - ссылка.
            page+=1
    
    trade_spiders(1)
    Ответ написан
    Комментировать