Евгений Самохин
Ученик
(103)
2 года назад
попробуй добавить в реквесты в headers свой юзер агент. У меня например когда поставил user agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36" у меня всё починилось
from bs4 import BeautifulSoup
soup = BeautifulSoup("lxml")
url = ' https://kartaslov.ru/значение-слова/рыба '
response = requests.get(url)
entry = soup.find("div", class_="v2-dict-entry")
page_ = soup.find("v2-dict-entry")
print(page_)
print(entry)
выводит такой ответ:
Warning (from warnings module):
File "C:\Users\User\Desktop\Питон\Test_Parsing.py", line 3
soup = BeautifulSoup("lxml")
GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 3 of the file C:\Users\User\Desktop\Питон\Test_Parsing.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.
None
None