Skip to content

Commit

Permalink
feat [skip ci]: added flixhq test & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
riimuru committed Jul 3, 2022
1 parent df3cd7a commit abdd46a
Show file tree
Hide file tree
Showing 11 changed files with 292 additions and 7 deletions.
10 changes: 9 additions & 1 deletion docs/guides/anime.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

<h2>ANIME</h2>

`ANIME` is a category provider, which provides a list of anime providers. Each anime provider is a subclass of the [`AnimeParser`](https://github.com/consumet/extensions/blob/master/src/models/anime-parser.ts) class.
`ANIME` is a category provider, which provides a list of anime providers. Each anime provider must be a subclass of the [`AnimeParser`](https://github.com/consumet/extensions/blob/master/src/models/anime-parser.ts) class.

By using `ANIME` category you can interact with the anime providers. And have access to the anime providers methods.

```ts
// ESM
import { ANIME } from '@consumet/extensions';

// <providerName> is the name of the provider you want to use. list of the proivders is below.
const animeProvider = ANIME.<providerName>();
```

## Anime Providers List
This list is in alphabetical order. (except the sub bullet points)

Expand Down
10 changes: 9 additions & 1 deletion docs/guides/books.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

<h2>BOOKS</h2>

`BOOKS` is a category provider, which provides a list of anime providers. Each anime provider is a subclass of the [`BookParser`](https://github.com/consumet/extensions/blob/master/src/models/book-parsers.ts) class.
`BOOKS` is a category provider, which provides a list of anime providers. Each anime provider must be a subclass of the [`BookParser`](https://github.com/consumet/extensions/blob/master/src/models/book-parsers.ts) class.

By using `BOOKS` category you can interact with the book providers. And have access to the book providers methods.

```ts
// ESM
import { BOOKS } from '@consumet/extensions';

// <providerName> is the name of the provider you want to use. list of the proivders is below.
const bookProvider = BOOKS.<providerName>();
```

## Book Providers List
This list is in alphabetical order. (except the sub bullet points)

Expand Down
10 changes: 9 additions & 1 deletion docs/guides/comics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

<h2>COMICS</h2>

`COMICS` is a category provider, which provides a list of anime providers. Each anime provider is a subclass of the [`ComicParser`](https://github.com/consumet/extensions/blob/master/src/models/comic-parsers.ts) class.
`COMICS` is a category provider, which provides a list of anime providers. Each anime provider must be a subclass of the [`ComicParser`](https://github.com/consumet/extensions/blob/master/src/models/comic-parsers.ts) class.

By using `COMICS` category you can interact with the book providers. And have access to the comic providers methods.

```ts
// ESM
import { COMICS } from '@consumet/extensions';

// <providerName> is the name of the provider you want to use. list of the proivders is below.
const comicProvider = COMICS.<providerName>();
```

## Comic Providers List
This list is in alphabetical order. (except the sub bullet points)

Expand Down
11 changes: 10 additions & 1 deletion docs/guides/light-novels.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

<h2>LIGHT_NOVELS</h2>

`LIGHT_NOVELS` is a category provider, which provides a list of light novels providers. Each light novel provider is a subclass of the [`LightNovelParser`](https://github.com/consumet/extensions/blob/master/src/models/lightnovel-parser.ts) class.
`LIGHT_NOVELS` is a category provider, which provides a list of light novels providers. Each light novel provider must be a subclass of the [`LightNovelParser`](https://github.com/consumet/extensions/blob/master/src/models/lightnovel-parser.ts) class.

By using `LIGHT_NOVELS` category you can interact with the light novel providers. And have access to the light novel providers methods.

```ts
// ESM
import { LIGHT_NOVELS } from '@consumet/extensions';

// <providerName> is the name of the provider you want to use. list of the proivders is below.
const lightnovelProvider = LIGHT_NOVELS.<providerName>();
```


## Light Novels Providers List
This list is in alphabetical order. (except the sub bullet points)

Expand Down
10 changes: 9 additions & 1 deletion docs/guides/manga.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

<h2>MANGA</h2>

`MANGA` is a category provider, which provides a list of manga providers. Each manga provider is a subclass of the [`MangaParser`](https://github.com/consumet/extensions/blob/master/src/models/manga-parser.ts) class.
`MANGA` is a category provider, which provides a list of manga providers. Each manga provider must be a subclass of the [`MangaParser`](https://github.com/consumet/extensions/blob/master/src/models/manga-parser.ts) class.

By using `MANGA` category you can interact with the manga providers. And have access to the manga providers methods.

```ts
// ESM
import { MANGA } from '@consumet/extensions';

// <providerName> is the name of the provider you want to use. list of the proivders is below.
const mangaProvider = MANGA.<providerName>();
```

## Manga Providers List
This list is in alphabetical order. (except the sub bullet points)

Expand Down
26 changes: 26 additions & 0 deletions docs/guides/movies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<h1 align="center">Consumet Extensions</h1>

<h2>MOVIES</h2>

`MOVIES` is a category provider, which provides a list of movies/tv series providers. Each movie/tv series provider must be a subclass of the [`MovieParser`](https://github.com/consumet/extensions/blob/master/src/models/movie-parser.ts) class.

By using `MOVIES` category you can interact with the anime providers. And have access to the anime providers methods.

```ts
// ESM
import { MOVIES } from '@consumet/extensions';

// <providerName> is the name of the provider you want to use. list of the proivders is below.
const movieProvider = MOVIES.<providerName>();
```

## Movies Providers List
This list is in alphabetical order. (except the sub bullet points)

- [FlixHQ](../providers/flixhq.md)
- [search](../providers/flixhq.md#search)
- [fetchMediaInfo](../providers/flixhq.md#fetchmediainfo)
- [fetchEpisodeSources](../providers/flixhq.md#fetchepisodesources)
- [fetchEpisodeServers](../providers/flixhq.md#fetchepisodeservers)

<p align="end">(<a href="https://github.com/consumet/extensions/blob/master/docs">back to table of contents</a>)</p>
187 changes: 187 additions & 0 deletions docs/providers/flixhq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<h1>FlixHQ</h1>

```ts
const flixhq = new MOVIES.FlixHQ();
```

<h2>Methods</h2>

- [search](#search)
- [fetchMediaInfo](#fetchmediainfo)
- [fetchEpisodeSources](#fetchepisodesources)
- [fetchEpisodeServers](#fetchepisodeservers)

### search
> Note: This method is a subclass of the [`BaseParser`](https://github.com/consumet/extensions/blob/master/src/models/base-parser.ts) class. meaning it is available across most categories.

<h4>Parameters</h4>

| Parameter | Type | Description |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| query | `string` | query to search for. (*In this case, We're searching for `Vincenzo`*) P.S: `vincenzo` is a really good korean drama i highly recommend it. |
| page (optional) | `number` | page number (default: 1) |

```ts
flixhq.search("Vincenzo").then(data => {
console.log(data);
}
```
returns a promise which resolves into an array of movies/tv series. (*[`Promise<ISearch<IMovieResult[]>>`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L233-L241)*)
output:
```js
{
currentPage: 1, // current page
hasNextPage: false, // if there is a next page
results: [
{
id: 'tv/watch-vincenzo-67955', // media id
title: 'Vincenzo',
url: 'https://flixhq.to/tv/watch-vincenzo-67955', // media url
image: 'https://img.flixhq.to/xxrz/250x400/379/79/6b/796b32989cf1308b9e0619524af5b022/796b32989cf1308b9e0619524af5b022.jpg',
type: 'TV Series'
}
{...},
...
]
}
```
### fetchMediaInfo
<h4>Parameters</h4>
| Parameter | Type | Description |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| mediaId | `string` | takes media id or url as a parameter. (*media id or url can be found in the media search results as shown on the above method*) |
```ts
flixhq.fetchMediaInfo("tv/watch-vincenzo-67955").then(data => {
console.log(data);
}
```
returns a promise which resolves into an anime info object (including the episodes). (*[`Promise<IMovieInfo>`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L243-L254)*)
output:
```js
{
id: 'tv/watch-vincenzo-67955', // media id
title: 'Vincenzo',
url: 'https://flixhq.to/tv/watch-vincenzo-67955', // media url
image: 'https://img.flixhq.to/xxrz/250x400/379/79/6b/796b32989cf1308b9e0619524af5b022/796b32989cf1308b9e0619524af5b022.jpg',
description: '\n' +
' At age of 8, Park Joo-Hyung went to Italy after he was adopted. He is now an adult and has the name of Vincenzo Cassano. ...\n' +
' ',
type: 'TV Series',
releaseDate: '2021-02-20',
genres: [ 'Action', 'Adventure', '...' ],
casts: [
'Kwak Dong-yeon',
'Kim Yeo-jin',
...
],
tags: [
'Watch Vincenzo Online Free,',
'Vincenzo Online Free,',
...
],
production: 'Studio Dragon',
duration: '60 min',
rating: 8.4,
episodes: [
{
id: '1167571',
title: 'Eps 1: Episode #1.1',
number: 1,
season: 1, // the number of episodes resets to 1 every season
url: 'https://flixhq.to/ajax/v2/episode/servers/1167571'
},
{...},
...
]
}
```
### fetchEpisodeSources
<h4>Parameters</h4>
| Parameter | Type | Description |
| ----------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| episodeId | `string` | takes episode id as a parameter. (*episode id can be found in the media info object*) |
| mediaId | `string` | takes media id as a parameter. (*media id can be found in the media info object*) |
| server (optional) | [`StreamingServers`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L76-L82) | takes server enum as a parameter. *default: [`StreamingServers.VidCloud`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L76-L82)* |
```ts
flixhq.fetchEpisodeSources("1167571", "tv/watch-vincenzo-67955").then(data => {
console.log(data);
}
```
returns a promise which resolves into an array of episode sources and subtitles. (*[`Promise<ISource>`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L210-L214)*)
output:
```js
{
headers: { Referer: 'https://rabbitstream.net/embed-4/gBOHFKQ0sOxE?z=' },
sources: [
{
url: 'https://b-g-ca-5.feetcdn.com:2223/v2-hls-playback/01b3e0bf48e643923f849702a32bd97a5c4360797759b0838c8f34597271ed8bf541e616b85a255a1320417863fe198040e65edb91d55f65c2f187d38c159aac95365664aa55f6121e784c83e8719033f811224effd0aefb9b88c77caf71b2d8943454dee7f505d5e1aae5f70dea1472a541a7c283a37782ea8253b156aad0f83701ef208196d2a5b75a864b6d6e3a2d454e55ea1885f3d5df798053a843cc223d6e41ecb1af3f6d6a07fc72a41bce18/playlist.m3u8',
isM3U8: true
}
],
subtitles: [
{
url: 'https://cc.1clickcdn.ru/26/7f/267fbca84e18437aa7c7df80179b0751/ara-3.vtt',
lang: 'Arabic - Arabic'
},
{
url: 'https://cc.1clickcdn.ru/26/7f/267fbca84e18437aa7c7df80179b0751/chi-4.vtt',
lang: 'Chinese - Chinese Simplified'
},
{...}
...
]
}
```
### fetchEpisodeServers
<h4>Parameters</h4>
| Parameter | Type | Description |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| episodeId | `string` | take an episode id or url as a parameter. (*episode id or episode url can be found in the media info object*) |
| mediaId | `string` | takes media id as a parameter. (*media id can be found in the media info object*) |
```ts
flixhq.fetchEpisodeServers('1167571', 'tv/watch-vincenzo-67955').then(data => {
console.log(data);
}
```
returns a promise which resolves into an array of episode servers. (*[`Promise<IEpisodeServer[]>`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L54-L57)*)
output:
```js
[
{
name: 'upcloud',
url: 'https://flixhq.to/watch-tv/watch-vincenzo-67955.4829542'
},
{
name: 'vidcloud',
url: 'https://flixhq.to/watch-tv/watch-vincenzo-67955.4087001'
},
{
name: 'streamlare',
url: 'https://flixhq.to/watch-tv/watch-vincenzo-67955.7041439'
},
{
name: 'voe',
url: 'https://flixhq.to/watch-tv/watch-vincenzo-67955.7823107'
},
{...},
...
]
```
<p align="end">(<a href="https://github.com/consumet/extensions/blob/master/docs/guides/movies.md#">back to movie providers list</a>)</p>
2 changes: 1 addition & 1 deletion docs/providers/gogoanime.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ output:
| Parameter | Type | Description |
| ----------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| episodeId | `string` | takes episode id as a parameter. (*episode id can be found in the anime info object*) |
| server (optional) | [`StreamingServers`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L76-L81) | takes server enum as a parameter. *default: [`StreamingServers.GogoCDN`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L76-L81)* |
| server (optional) | [`StreamingServers`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L76-L82) | takes server enum as a parameter. *default: [`StreamingServers.GogoCDN`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L76-L82)* |
```ts
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"test:anime": "jest ./test/anime",
"test:books": "jest ./test/books",
"test:comics": "jest ./test/comics",
"test:movies": "jest ./test/movies",
"test:manga": "jest ./test/manga",
"test:lightnovels": "jest ./test/light-novels"
},
Expand Down
10 changes: 9 additions & 1 deletion src/providers/movies/flixhq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FlixHQ extends MovieParser {
protected override logo =
'https://img.flixhq.to/xxrz/400x400/100/ab/5f/ab5f0e1996cc5b71919e10e910ad593e/ab5f0e1996cc5b71919e10e910ad593e.png';
protected override classPath = 'MOVIES.FlixHQ';
protected override supportedTypes = new Set([TvType.MOVIE, TvType.TVSERIES, TvType.ANIME]);
protected override supportedTypes = new Set([TvType.MOVIE, TvType.TVSERIES]);

/**
*
Expand Down Expand Up @@ -261,4 +261,12 @@ class FlixHQ extends MovieParser {
};
}

(async () => {
const flixhq = new FlixHQ();

const search = await flixhq.fetchEpisodeServers('1167571', 'tv/watch-vincenzo-67955');

console.log(search);
})();

export default FlixHQ;
22 changes: 22 additions & 0 deletions test/movies/flixhq.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { MOVIES } from '../../src/providers';

jest.setTimeout(120000);

test('returns a filled array of movies/tv', async () => {
const flixhq = new MOVIES.FlixHQ();
const data = await flixhq.search('vincenzo');
expect(data.results).not.toEqual([]);
});

test('returns a filled object of movies/tv data', async () => {
const flixhq = new MOVIES.FlixHQ();
const data = await flixhq.fetchMediaInfo('tv/watch-vincenzo-67955');
expect(data.description).not.toEqual('');
expect(data.episodes).not.toEqual([]);
});

test('returns a filled object of streaming sources', async () => {
const flixhq = new MOVIES.FlixHQ();
const episodeSources = await flixhq.fetchEpisodeSources('1167571', 'tv/watch-vincenzo-67955');
expect(episodeSources.sources).not.toEqual([]);
});

0 comments on commit abdd46a

Please sign in to comment.