Parser Example

 avatar
unknown
python
a year ago
481 B
7
Indexable
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)
Editor is loading...
Leave a Comment