Parser Example

mail@pastecode.io avatar
unknown
python
a month ago
481 B
4
Indexable
Never
import requests
from bs4 import BeautifulSoup as BS

r = requests.get("https://stopgame.ru/review/izumitelno") 
html = BS(r.content, 'html.parser')

# The correct hierarchy of the elements is important
for el in html.select(".list-view > div > div > article > section"):
    # select 3rd section of el, cause there is more than one section
    section = el.select("section")[2]
    # in section select first link
    title = section.select("a")[0]
    print(title.text)
Leave a Comment