Git Product home page Git Product logo

anilist-notifications's Introduction

anilist-notifications

Documentation Maintenance License: GPL-3.0-ONLY

A push notification server for Anilist. Fetches data from the anilist API, parses it and delivers push notifications to your device using ntfy.

๐Ÿ  Repository

Dependencies

  • NodeJS 18.x
    • node-fetch

โ„น๏ธ To recieve push notifications, you need to install ntfy and subscribe to them. More info avaliable here.

Installation

Download or clone the latest release.

Enter the directory and run:

npm install

Setup/configuration

Go to the anilist website and navigate to Settings -> Apps -> Developer. Press on "Create New Client. Pick whatever you want as the Name and enter https://anilist.co/api/v2/oauth/pin as the Redirect URL. After the app is created, click on it and copy the number under the ID field. Ignore all other fields (Secret, Name, Redirect URL). The config-template folder in the root directory of the project contains the template for the configuration file. Create a folder called config (or just rename config-template to config), copy the config template into it and rename it to config.json (from config.json.template). Fill in the configuration file (this is where you paste the previously copied Api Client ID) and run the bot.

Quick explanation of the config.json file:

{
    "ntfy": {
        "address": STRING,
        "port": INT,
        "topic": STRING,
        "authType": STRING,
        "username": STRING,
        "password": STRING 
    },
    "id": STRING,
    "refresh": INT
}
  • ntfy contains settings regarding the ntfy server you are connecting to:
    • address is just the address of the server and nothing else (e.g. ntfy.sh).
    • port is the port where the ntfy server is hosted.
    • topic is the topic to which this server will send notifications to. Quoting the ntfy docs: "Topics are created on the fly by subscribing or publishing to them. Because there is no sign-up, the topic is essentially a password, so pick something that's not easily guessable."
    • authType is the auth type for the ntfy server. This is only useful if using a selfhosted ntfy server where you use credentials to log in. If you are using such a server you can also ignore the quote on topic names from the previous config entry. Possible auth types are header and param. Header sends the auth username+password as a header and param as a URL parameter. If the key is left empty, something random is typed in or the key is deleted, no authentication will be used
    • username ntfy username used in auth
    • password ntfy password used in auth
  • id is the Api Client ID you copied before. Make sure to enter it in the config as a string not an integer.
  • refresh is the delay between checking for notifications with the Anilist API (in miliseconds). The default is 60000 (that is 60 seconds, just divide by 1000) and the minimum is 15000 (15 seconds). If you try to go lower the delay will be increased to 15000 automatically to not spam the Anilist API.

When starting the bot up for the first time after finishing the config file, you will be prompted to follow a URL and authorize the application you made earlier to access your account. You will then recieve a token you will need to paste into the console. This token grants the server 1 year of access to your account's API. You will recieve a notification via the same ntfy topic you use for Anilist notifications when the token gets close to expiry. The same topic will be used for notifications of any Anilist errors that may occur. Should something go wrong or your token is revoked and the app does not request you re-create the token, simply delete the token.json file in the root of the project to make the server forget the previous token and prompt you to set it up again.

Usage

Run this command in the root directory of the cloned repository:

node .

Author

๐Ÿ‘ค Emmaexe

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a โญ๏ธ if this project helped you!

๐Ÿ“ License

This project is GPL-3.0-only licensed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.