boxrec
boxrec copied to clipboard
Retrieve information from BoxRec and return it in JSON format
BoxRec
This project allows you to query information from BoxRec and return it in JSON format. The purpose of this project is to act as an unofficial API for BoxRec. This project is not affiliated with BoxRec.
:warning: Notice before using this package :warning:
BoxRec has put in some work that will throw captchas if making too many quick requests and IP block you if you trip their firewall. For the sole purpose of blocking packages like this, which is understandable. But at the cost of making it a worse UX for actual people. If you use this project you put yourself at risk of being IP banned by BoxRec for some time, not by user but by IP. This is automatic from their firewall and not something they do manually. There are ways to get by this but nothing to discuss about at this time. Use this package for learning purposes at this time.
:warning: Maintenance :warning:
A few years ago a lot of time was spent on this project, but not so much at the time of this update. With the changes that go into BoxRec, it is always a game of cat and mouse when it comes to keeping things working. Do not expect this package to continuously work.
If you do find issues, please raise an issue so others are aware and so they can be triaged.
Thanks
Installation
This project is written in Node. Currently this project supports Node 8+.
npm install boxrec --save
yarn add boxrec
Quick Start
const boxrec = require("boxrec").Boxrec;
or
import {Boxrec as boxrec} from "boxrec";
Use credentials to log into BoxRec and then use any of the methods below. Pass the cookie into all methods.
example:
try {
const cookies = await boxrec.login(BOXREC_USERNAME, BOXREC_PASSWORD);
// successfully logged in
} catch (e) {
// error occurred logging in
}
Methods
Please read the documentation on how to use these methods
getBoutById
getBoxerPDF
getBoxerPrint
getChampions
getDate
getEventById
getEventsByLocation
getPeopleByLocation
getPeopleByName
getPersonById
getRatings
getResults
getSchedule
getTitleById
getTitles
getVenueById
getWatched
login
search
unwatch
watch
The return values are a class instance that can parse the data. To return the entire JSON object, use the output
accessor.
const boxer = await boxrec.getPersonById(352);
const {output} = boxer;
How to contribute
Details on how to help can be found here
Additional Documentation
This link shows all the methods, the parameters and the expected response
Security Requirements
Questions
What and where is the BoxRec global ID?
The BoxRec global ID or ID is the unique ID of the person, event, bout, etc. It can be found in the URL bar. For people it can also be found on their page.
examples:
(Person) Vasiliy Lomachenko - http://boxrec.com/en/boxer/659771. The BoxRec global ID is 659771
.
(Bout) Terence Crawford vs. Amir Khan - http://boxrec.com/en/event/778793/2299385. The BoxRec bout ID is 778793/2299385
(Event) Golden Boy May 4th 2019 Event - http://boxrec.com/en/event/781894. The BoxRec event ID is 781894
Why is there global ID and ID?
I took the safe approach and assumed that there may be some difference between the two.
Is using this software legal?
When this software was initially written, the Terms and Conditions on BoxRec did not include anything about web scraping.
BoxRec had updated their Terms and Conditions sometime in the middle of 2018 to include that you may not use software to extract data from BoxRec.
Web scraping on wikipedia states under legal issues "The legality of web scraping varies across the world. In general, web scraping may be against the terms of use of some websites, but the enforceability of these terms is unclear".
Conclusion: It is unclear. What you do with this package though could very well be illegal.