Answer the question
In order to leave comments, you need to log in
bs4 not working?
when running the code nothing is output
import requests
from bs4 import BeautifulSoup as bs
r=requests.get("https://stopgame.ru/review/new/stopchoice")
html = bs(r.content,"html.parser")
for el in html.select(".lent-block"):
title=el.select(".lent-title < a")
print(title)
Answer the question
In order to leave comments, you need to log in
You need to ask where you copied the code. This question has been asked more than once, including on ru and eng stackoverflow.
To the point - there is no 'lent-block' on the page
import requests
from bs4 import BeautifulSoup
response = requests.get("https://stopgame.ru/review/new/stopchoice")
soup = BeautifulSoup(response.text,'lxml')
items = soup.find('div',class_='tiles tiles-details tiles-duo').find_all('div',class_='item article-summary article-summary-card')
for item in items:
title = item.find('div',class_='caption caption-bold').a.text
url = item.find('div',class_='caption caption-bold').a.get('href')
print(f'{title} - https://stopgame.ru{url}')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question