Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #7 from MattPlays/nightly
Browse files Browse the repository at this point in the history
2.0.3
  • Loading branch information
Artrix9095 authored Mar 10, 2022
2 parents e05a4f4 + 186eaa0 commit d4bbb31
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ Maintained by: @Artrix9095 @MattPlays
npm i @mattplays/aniapi
```

# Usage

To get your JWT login to ANIAPI [here](https://aniapi.com/login)

```javascript
const ANIAPI = require('@mattplays/aniapi');
const API = new ANIAPI.API('DUMMY_JWT');
```
# Documentation
WIP

# License

Expand Down
6 changes: 6 additions & 0 deletions src/API/handlers/Episode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class Episode implements EpisodeType {
* The episode's streaming url.
*/
video: string;
/**
* The headers required to retrieve the video
*/
video_headers: { [key: string]: string };
/**
* The episode's website related locale.
*/
Expand All @@ -40,4 +44,6 @@ export class Episode implements EpisodeType {
constructor(data: EpisodeType) {
Object.assign(this, data);
}


}
1 change: 1 addition & 0 deletions src/API/types/Episode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface Episode {
number: number;
title: string;
video: string;
video_headers: { [key: string]: string };
source: string;
locale: string;
quality: number;
Expand Down
6 changes: 5 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ export const API_URL = 'https://api.aniapi.com';

export const API_VERSION = 1;

export const DEFAULT_HEADERS = (jwt: string) => ({
export const DEFAULT_HEADERS = (
jwt: string,
headers: { [key: string]: string } = {}
) => ({
Authorization: `Bearer ${jwt}`,
'Content-Type': 'application/json',
Accept: 'application/json',
...headers,
});

0 comments on commit d4bbb31

Please sign in to comment.