I'm trying to fetch data from stats.nba.com the JSON I currently need is form the url https://stats.nba.com/stats/teamyearbyyearstats?TeamID=1610612746&LeagueID=00&PerMode=Totals&SeasonType=Regular%20Season
and I'm trying to fetch it in a c# console app. This is my code:
try
{
using (var webClient = new System.Net.WebClient())
{
var json = webClient.DownloadString("https://stats.nba.com/stats/teamyearbyyearstats?TeamID=1610612746&LeagueID=00&PerMode=Totals&SeasonType=Regular%20Season");
Console.WriteLine(json);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
With this, it comes out with an error of connection timed out and unable to read data from the transport connection. so I searched it up and found a solution of
ServicePointManager.Expect100Continue = false;
I put this before the using statement and it still doesn't work. Sorry I'm new to this online things, so I'm sorry if it's a noob error. Thanks