importrequestsfrombs4importBeautifulSoupurl:str="https://new-science.ru/category/news/page/2/"response=requests.get(url)# /// Через BeautifulSoup решение
soup=BeautifulSoup(response.text,"html.parser")print(soup.title)# /// Альтернативное решение
title_start_index=response.text.find("<title>")title_end_index=response.text.find("</title>")print(f"Старт: {title_start_index}\nКонец: {title_end_index}")print(f"{response.text[title_start_index:title_end_index]}")withopen("site.html",mode="w",encoding="utf-8")asfile:file.write(response.text)
Обязательные cookie нужны для входа и настроек. Аналитику — Яндекс.Метрику без записи сеансов — включаем только с твоего согласия; отказ ничего не ломает, выбор можно изменить в подвале сайта.
Подробнее о cookieСогласие на аналитику