G
G
GNation2020-09-12 23:48:59
Python
GNation, 2020-09-12 23:48:59

How to write a parser for the site https://cristalix.ru/?

In general, I am a beginner "programmer".

A friend asked me to create a parsing for the site https://cristalix.ru/

But I don't really understand how to work with requests and BS4.

I need to get how many players are playing from the site.

My not working code:

#Импорт
import requests
from bs4 import BeautifulSoup as BS

#бла бла
r = requests.get('https://cristalix.ru/')
html = BS(r.content, 'html.parser')

#бла бла
for el in html.select('.text-center'):
  title = el.select('.text-title > h4')
  print( title.text)


Help plz(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alfss, 2020-09-13
@alfss

select('.home_sidebar') -> select('h4.text-center')

R
radioegor146, 2020-09-25
@radioegor146

You can use https://cristalix.ru/data/technical/mcinfo to get online information in a convenient form (JSON, yay!).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question