JamesQuintero / Sports-Odds-Algorithms

System that calculates and uses algorithms to predict the outcome of NBA, NHL, and MLB sports games.
87 stars 31 forks source link

404 on request for jsonp #1

Closed brucepucci closed 7 years ago

brucepucci commented 7 years ago

I am trying to scrape mlb data ,getting a response from this url http://fb.oddsportal.com/ajax-sport-country-tournament-archive/3/67blnzDc/X0/1/0/1/ of globals.jsonpCallback('/ajax-sport-country-tournament-archive/3/67blnzDc/X0/1/0/1/', {'e':'404'});.

I did a little digging and could not figure it out. It seems as though the url at the source has changed to http://fb.oddsportal.com/ajax-sport-country-tournament-archive/6/67blnzDc/X0/1/0/1/ but that did not fix my issue. The source also appends a query string parameter named _ with the milliseconds since the UNIX epoch. This works in the browser for an arbitrary amount of time after the specified time in the parameter.

Am I missing something?

JamesQuintero commented 7 years ago

Hi, thanks for letting me know. I got the same thing as you, and I have a solution. Oddsportal now requires a Referer HTTP header field, so I added that to oddsportal_scraper.py and universal_functions.py. It should work, now.

It seems like that new query string parameter and slightly different url don't change the data, so those are fine.

brucepucci commented 7 years ago

Thanks!