scraping_games_acb_old {BAwiR} | R Documentation |
Old ACB player game finder data
Description
This function allowed us to get all the player game finder data for
all the desired ACB seasons available from:
https://www.acb.com. It was an old version that worked before the
internal structure of the ACB website changed. The updated function is
now scraping_games_acb
.
Usage
scraping_games_acb_old(type_league, nums, year, verbose = TRUE,
accents = FALSE, r_user = "guillermo.vinue@uv.es")
Arguments
type_league |
String. If |
nums |
Numbers corresponding to the website to scrape. |
year |
Season, e.g. 2017-2018. |
verbose |
Should R report information on progress? Default TRUE. |
accents |
Should we keep the Spanish accents? The recommended option is to remove them, so default FALSE. |
r_user |
Email to identify the user when doing web scraping. This is a polite way to do web scraping and to certify that the user is working as transparently as possible with a research purpose. |
Details
The official website of the Spanish basketball league ACB used to present the statistics of each game in a php website, such as: https://www.acb.com/fichas/LACB62090.php.
In some cases, https://www.acb.com/fichas/LACB60315.php
didn't exist, so for these cases is where we can use the
httr
package.
Value
A data frame with the player game finder data.
Note
In addition to use the email address to stay identifiable, the function also contains two headers regarding the R platform and version used.
Furthermore, even though in the robots.txt file at
https://www.acb.com/robots.txt, there is no information about scraping
limitations and all robots are allowed to have complete access,
the function also includes the command Sys.sleep(2)
to pause between requests for 2 seconds. In this way, we don't bother the server
with multiple requests and we do carry out a friendly scraping.
Author(s)
Guillermo Vinue
See Also
Examples
## Not run:
# Not needed to scrape every time the package is checked, built and installed.
df1 <- scraping_games_acb_old(type_league = "ACB", nums = 62001:62002, year = "2017-2018",
verbose = TRUE, accents = FALSE,
r_user = "guillermo.vinue@uv.es")
## End(Not run)