sk0r/readme.md

74 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2021-04-05 03:00:24 +00:00
# sk0r
![sk0r logo](its-a-js-project-so-it-has-to-have-a-shitty-logo.png)
a script to get live scores from hltv.org
## requirements
2021-04-05 23:10:04 +00:00
- node.js
- npm
- `http` node package
2021-04-05 03:00:24 +00:00
- nightmare
- electron
- libgtk-2-0
- libgconf-2-4
- xvfb (if you're running it headless)
2021-04-05 23:10:04 +00:00
## setup
- `sudo apt install libgtk2.0-0 libgconf-2-4` (if you're on debian, other
distros idk)
- `sudo apt install xvfb` (again, on debian)
- `git clone https://tildegit.org/sose/sk0r`
- `cd sk0r`
- `npm install nightmare`
- `npm install http`
- `sudo npm install -g electron --unsafe-perm=true`
2021-04-05 03:00:24 +00:00
- `node sk0r.js`
- or `xvfb-run node sk0r.js` for headless
2021-04-05 23:10:04 +00:00
- the server will serve live game data in JSON format on localhost port 8000
- not too sure about node's http server security, you might want to
use a reverse proxy if you're exposing it to the web
2021-04-06 19:08:58 +00:00
- if you don't want to manually refresh the browser page there is the
`refresh.sh` script in this repo that will do it for you
- scores are automatically updated, but this is necessary to get new
matches
2021-04-05 23:10:04 +00:00
## using
- use you favourite http client or web browser and point it to
'http://localhost:8000'
- JSON will be served
- scores will update each time you access the page
- to refresh the electron browser page, access 'http://localhost:8000?reload'
- this will fetch the newest matches, but is generally only necessary if
they havent been refreshed in a while
- it also sends a request to hltv's servers, so use it sparingly
## config
- if you want to change the host or port you can change the variables at the
top of the script
- to modify rate limiting behavior, you can also modify those variables at the
top of the script as well
2021-04-06 19:08:58 +00:00
- the rate limit is for the script, and prevents too much refreshing of the
browser page
2021-04-05 23:10:04 +00:00
## why?
- its really hard to scrape hltv live scores any other way
2021-04-05 03:00:24 +00:00
## notes
- its electron, don't run it on your 340e
2021-04-05 23:10:04 +00:00
- the rate limit functionality is not intuitive, but it was easy to write
2021-04-05 03:00:24 +00:00
- it's named after [this kid](https://www.hltv.org/player/18638/sk0r) (hes good)
## additional notes
- i hate javascript
- i dont know how to write javascript
- i dont know how to use nightmare
## more notes
- hltv doesn't like you scraping them, they'll probably break this and/or send
me a c&d soon
2021-04-05 23:10:04 +00:00
- in keeping with the theme of naming projects after counter-strike players,
the next project i release will be a mobile phone operating system named
"ANDROID"
2021-04-05 03:00:24 +00:00
(c) oneseveneight/sose