L
L
levykkn2021-10-03 19:32:45
Python
levykkn, 2021-10-03 19:32:45

Why is the data not being parsed?

import requests
from bs4 import BeautifulSoup as BS 

r = requests.get("https://poizdato.net/rozklad-poizdiv/vyshneve--kyiv-pas/03.10.2021/")
html = BS(r.content, 'html.parser')

for el in html.select(" .table_shadow> tbody"):
    title = el.select('td > a ')
    print( title[0].text )


I want to parse the schedule on the specified page. Nothing is parsed. What could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-03
@levykkn

<tbody>lies inside the tag <table>, and the child combinator only receives tags that lie at the first level inside the tag on the left.
In general:
.table_shadow>table>tbody
Either just find it by tbody, it's the only one. Same with td.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question