Optional clientId: stringclient id, add your own here: https://anidb.net/software/add
Optional options: { cache?: AnidbCacheImplType; debug?: true; incomming_port?: number; logger?: false | AnidbLoggerType; ping_interval?: number }Optional cache?: AnidbCacheImplTypepass cache implementation:
by default (undefined) it will use internal cache, that saves to {cwd}/.cache
if set to false cache won't be used
if instance of AnidbCacheImplType it will use that instead *
Optional debug?: trueenable/disable debug logging
Optional incomming_the port to listen to for response (leave undefined if you are not sure)
Optional logger?: false | AnidbLoggerTypeLogger: default is using console.log, if false logging will be disabled, or pass a function
Optional ping_define the interval in miliseconds at which anidb is pinged to keep the connection active, defaults to 5minutes
Private #pingPrivate cachePrivate clientPrivate incomming_Private lastPrivate pingPrivate requestStatic Private #episodeStatic Private #mylist_Static Private vote_Static Readonly EVENTSvalid events to listen to
on disconnect from udp connection
Start the connection to anidb. It will automatically log in if user and password is provided. This client will try to keep the session alive indefenetly, so make sure to call disconnect when you stop using. For long running services try to be clever and disconnect when there is no activity for a while.
const anidb = new AnidbUDPClient('myclientid')
await anidb.connect("my-user","my-password")
await anidb.disconnect()
Optional user: stringanidb user
Optional password: stringanidb password
Optional udp_api_key: stringUDP API Key (defined in the users profile), pass to enable encryption, must be set and match the one in the user account
Optional encoding: "ISO8859_1" | "ISO8859_2" | "ISO8859_4" | "ISO8859_5" | "ISO8859_7" | "ISO8859_9" | "ISO8859_13" | "ISO8859_15" | "KOI8_R" | "ASCII" | "UTF8" | "UnicodeBigUnmarked" | "UnicodeLittleUnmarked" | "Cp1250" | "Cp1251" | "Cp1252" | "Cp1253" | "Cp1254" | "Cp1257" | "UnicodeBig" | "UnicodeLittle" | "UTF16"set the encoding (only applies if user and password was passed)
Change the encoding for future responses (reset on disconnect). Prefrably use the enc param of login instead.
Optional encoding: "ISO8859_1" | "ISO8859_2" | "ISO8859_4" | "ISO8859_5" | "ISO8859_7" | "ISO8859_9" | "ISO8859_13" | "ISO8859_15" | "KOI8_R" | "ASCII" | "UTF8" | "UnicodeBigUnmarked" | "UnicodeLittleUnmarked" | "Cp1250" | "Cp1251" | "Cp1252" | "Cp1253" | "Cp1254" | "Cp1257" | "UnicodeBig" | "UnicodeLittle" | "UTF16"Optional priority: numberlog into Anidb
Optional encoding: "ISO8859_1" | "ISO8859_2" | "ISO8859_4" | "ISO8859_5" | "ISO8859_7" | "ISO8859_9" | "ISO8859_13" | "ISO8859_15" | "KOI8_R" | "ASCII" | "UTF8" | "UnicodeBigUnmarked" | "UnicodeLittleUnmarked" | "Cp1250" | "Cp1251" | "Cp1252" | "Cp1253" | "Cp1254" | "Cp1257" | "UnicodeBig" | "UnicodeLittle" | "UTF16"Return anime by title or aid
const { romanji_name, episodes, aid } = await anidb.anime(3211,["romanji_name", "episodes"])
Anime title (any synonim) or anime id (aid)
Optional fields: T[]List of fields to to return.
get character by character id
get creator by creator id
get episode by episode id
get episode by anime and episode number
anime title or anime id (aid)
episode number
Retrieve File Data by file id
list of fields to return
Retrieve File Data by anime, group and episode number
AnidbError with code RESPONSE_CODE.MULTIPLE_FILES_FOUND if more than one file is found. List of file ids will be in error.payload
anime name or id
group name or id
episode number
fields to return
Retrieve File Data by ed2k and size
file ed2k hash
size of file in bytes
list of fields to return
Retrieve Group Data
group id or name
Returns a list of group names and ranges of episodes released by the group for a given anime.
anime id
Optional state: "ongoing" | "stalled" | "complete" | "dropped" | "finished" | "specials_only"Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change). Either age is specified or time not both.
Get user id
Get a random anime
Queues a MyList Export by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected. Only one export can be in the queue at a time.
Add MyList entry by anime. Can be used to update and exiting entry by passing options.edit=true
AnidbError see codes at Add_file_to_MyList
anime name or id
Optional epno?: numberEpisode number, epno=0 means all episodes (default), negative numbers means upto. (-12 -> upto 12)
Optional group?: string | numbergroup name or id. Optional: if not defined generic file will be added to mylist
Optional options: { edit?: boolean; other?: string; source?: string; state?: "unknown" | "internal_storage" | "external_storage" | "deleted" | "remote_storage"; storage?: string; viewdate?: number; viewed?: boolean }My list entry options
Optional edit?: booleantrue to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are not replaced with default or empty values. Only values supplied are updated.
Optional other?: stringother remarks/notes (<br/> can be used to split into multiple lines)
Optional source?: string(i.e. ed2k, dc, ftp, irc, ...)
Optional state?: "unknown" | "internal_storage" | "external_storage" | "deleted" | "remote_storage"Optional storage?: stringlabel of the storage
Optional viewdate?: numberOptional viewed?: booleanAdd MyList entry by file. Either by file id, ed2k+size, mylist id. Can be used to update and exiting entry by passing options.edit=true
AnidbError with code RESPONSE_CODE.FILE_ALREADY_IN_MYLIST if not edit=true. Mylist entry (same result as mylist_by_file_id result) will be in error.payload
file to add to mylist, pass { fid } (file id) or { ed2k, size } (ed2k hash and size in bytes) or { lid } (mylist id) to edit
Optional options: { edit?: boolean; other?: string; source?: string; state?: "unknown" | "internal_storage" | "external_storage" | "deleted" | "remote_storage"; storage?: string; viewdate?: number; viewed?: boolean }My list entry options
Optional edit?: booleantrue to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are not replaced with default or empty values. Only values supplied are updated. When lid is passed is automattically set to true and option ignored
Optional other?: stringother remarks/notes (<br/> can be used to split into multiple lines)
Optional source?: string(i.e. ed2k, dc, ftp, irc, ...)
Optional state?: "unknown" | "internal_storage" | "external_storage" | "deleted" | "remote_storage"Optional storage?: stringlabel of the storage
Optional viewdate?: numberOptional viewed?: booleanRetrieve MyList entry by anime. Can return either a single result { single: ... } or muliple result { multi: ... }. See type definition.
anime name or id
Optional group: string | numbergroup name or id
Optional epno: numberepisode number
Retrieve MyList entry by file ed2khash and size
hash
in bytes
Retrieve MyList entry by file id
file id
Retrieve MyList Data
anime name or id
Episode number (negative numbers and 0 do not work), and epno is required
Optional group?: string | numbergroup name or id. Optional
Removes MyList entry by file. Either by file id, ed2k+size, mylist id.
AnidbError with code RESPONSE_CODE.FILE_ALREADY_IN_MYLIST if not edit=true. Mylist entry (same result as mylist_by_file_id result) will be in error.payload
AnidbError see codes at Add_file_to_MyList
file to add to mylist, pass { fid } (file id) or { ed2k, size } (ed2k hash and size in bytes) or { lid } (mylist id) to edit
Retrieve MyList stats
Vote for specified anime/episode/group
AnidbError with code RESPONSE_CODE.NO_SUCH_VOTE, PERMVOTE_NOT_ALLOWED, ALREADY_PERMVOTED with payload same as the normal response
AnidbError see codes at Vote_for_specified_anime/episode/group
type of vote: anime vote, anime temporary vote, vote for a group, vote for episode
identifier to vote for, can be a name or the id (of the type provided)
Must be 'get' or 'revoke' or a number between 100 and 1000
Private _autoPrivate _callOptional params: Record<string | number, string | number>Optional expected_responses: (string | number)[]Optional priority: numberGenerated using TypeDoc
Example