JaseZiv / worldfootballR

A wrapper for extracting world football (soccer) data from FBref, Transfermark, Understat
https://jaseziv.github.io/worldfootballR/
444 stars 60 forks source link

Error web-scraping Fbref #142

Closed Zakgas closed 2 years ago

Zakgas commented 2 years ago

Hi,

When trying to web-scrape player stats from Fbref, I get the following error:

'Error in open.connection(x, "rb") : HTTP error 429'

I raised this with ggshaker team as I want to produce some pizza charts from their library but it has nothing to do with them as they are a visualisation library.

So I was wondering if you could help me, please?

Thanks, Zakariah

JaseZiv commented 2 years ago

Hi, As defined in a google search,

The HTTP 429 Too Many Requests response status code indicates the user has sent too many requests in a given amount of time ("rate limiting")

It would appear you have been blocked from accessing their servers for being in violation of their terms (see here: https://www.sports-reference.com/bot-traffic.html).

I think if you give it some time, you'll be allowed to scrape again. Remember to be mindful and ensure your time_pause number is set sufficiently high in all FBref functions.

I will close this issue now as it's not related to the functioning of the library. Reach out if there's anything else though.

Zakgas commented 2 years ago

Oh I had no idea 😅

Guess I have been using it a bit too much. How do I set the time_pause function and how do I next time when I have used it too much? Is there a quota command that I use in R to check?

Thanks, Zakariah

JaseZiv commented 2 years ago

Inside the functions, the default is time_pause=3. Can always increase this to be safe. If you stick to that, you should be safe

RealBlueBoi commented 2 years ago

Hi,

I am also facing a similar issue, but it is only happening for some players. For example, when I try to get data for Mohamed-Ali Cho, I am able to do so, however I get the same error message when I try to get data for Nayef Aguerd.

Any idea what the issue might be here? Thanks!