Skip to content

Unofficial exporter to convert some of the data from the AniList API to Prometheus metrics

Notifications You must be signed in to change notification settings

NathanPERIER/anilist-prometheus-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AniList Prometheus Exporter

Get the tokens

First, you need to create an OAuth client for the exporter. Use https://anilist.co/api/v2/oauth/pin as the redirect URL. Once this is done, you can get the client id and client secret in your developer page. Set the ALPE_ANILIST_CLIENT_ID and ALPE_ANILIST_CLIENT_SECRET environment variables accordingly.

Then, you want to visit the following URL in a web browser (replace YOUR_CLIENT_ID by the value obtained previously) :

https://anilist.co/api/v2/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2Fanilist%2Eco%2Fapi%2Fv2%2Foauth%2Fpin&client_id=YOUR_CLIENT_ID

Click "Authorize" and copy the text that is provided to you. This is a token that will enable the exporter to access your account. On the first run, you will need to set this value in the ALPE_ANILIST_AUTH_CODE environment variable.

Run with Docker (recommended)

First, we need a file to save the tokens :

touch tokens.json
chmod 600 tokens.json

Then, we need to build the container :

docker build . -t alpe

And finally we run the image :

docker run --name anilist_exporter \
    -p 8080:8080 \
    -e 'ALPE_ANILIST_CLIENT_ID=...' \
    -e 'ALPE_ANILIST_CLIENT_SECRET=...' \
    -e 'ALPE_ANILIST_AUTH_CODE=...' \
    -e 'ALPE_TOKENS_FILE=/etc/alpe/tokens.json' \
    -v './tokens.json:/etc/alpe/tokens.json' \
    alpe:latest 

Run with NodeJS (dev)

Note: so far, this has only be tested with node 18

First, we install the dependencies :

npm install

Then, we create the file for the tokens and we set the variables :

touch tokens.json
chmod 600 tokens.json
export ALPE_ANILIST_CLIENT_ID='...'
export ALPE_ANILIST_CLIENT_SECRET='...'
export ALPE_ANILIST_AUTH_CODE='...'

And then we can run :

npm run dev

About

Unofficial exporter to convert some of the data from the AniList API to Prometheus metrics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published