I'm trying to scrape the table from this webpage: https://fantasy.premierleague.com/statistics .
When I inspect the webpage, I can see that the structure resembles something like this:
<table>
<tbody>
<tr>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
I'm having trouble finding the table, or any of the contents with BS4. When I use the following code, the output is simply just 'None'.
from bs4 import BeautifulSoup
import requests
url = 'https://fantasy.premierleague.com/statistics'
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
print(soup.find('table'))
print(soup.find('tbody'))
print(soup.find('tr'))
print(soup.find('td'))
Can anyone help me / give advice on how to solve this problem? Thank you a lot!!!
That page makes a xhr request to https://fantasy.premierleague.com/api/bootstrap-static/ and gets the information you see in the table as json.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.