I am trying to scrape a player stats table for NBA stats using requests
and BeautifulSoup
, but the response I am getting is not same as what I see using "Inspect Element"
The div
containing this table is has class attribute: class="nba-stat-table__overflow
. However, whenever I run the following code I get an empty list:
table = soup.find_all('div',attrs={'class="nba-stat-table__overflow'})
Here is my full code:
import os
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup
import requests
url = 'https://stats.nba.com/players/boxscores/?Season=2018-19&SeasonType=Regular%20Season'
response = requests.get(url)
soup = BeautifulSoup(response.content,'html.parser')
table = soup.find_all('div',attrs={'class="nba-stat-table__overflow'})