Skip to content

Commit

Permalink
feat+docs(dramacool): Implemented fetchPopular and mediaInfo enhancem…
Browse files Browse the repository at this point in the history
…ents (#565)

* [CodeFactor] Apply fixes to commit fa3a31b

* refactor: Rename variable in DramaCool class fetchMediaInfo for clarity

* build: Update dist folder and rename imageUrl to image
  • Loading branch information
2004durgesh authored Jul 27, 2024
1 parent 879bdee commit 6e9e87f
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dist/providers/movies/dramacool.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ declare class DramaCool extends MovieParser {
fetchMediaInfo: (mediaId: string) => Promise<IMovieInfo>;
fetchEpisodeServers(episodeId: string, ...args: any): Promise<IEpisodeServer[]>;
fetchEpisodeSources: (episodeId: string, server?: StreamingServers) => Promise<ISource>;
fetchPopular: (page?: number) => Promise<ISearch<IMovieResult>>;
private removeContainsFromString;
private cleanUpText;
}
export default DramaCool;
73 changes: 73 additions & 0 deletions dist/providers/movies/dramacool.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/providers/movies/dramacool.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/guides/movies.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ This list is in alphabetical order. (except the sub bullet points)
- [MovieHdWatch](../providers/moviehdwatch.md)
- [FlixHQ](../providers/flixhq.md)
- [ViewAsian](../providers/viewAsian.md)
- [DramaCool](../providers/dramacool.md)

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

```ts
const dramacool = new MOVIES.DramaCool();
```

<h2>Methods</h2>

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

### 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`*)|
| page (optional) | `number` | page number (default: 1) |

```ts
dramacool.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 number
totalPages: 1,
hasNextPage: false, // boolean to indicate if there's a next page
results: [
{
id: 'drama-detail/vincenzo', // media id
title: 'Vincenzo (2021)',
url: 'https://dramacool.com.pa/drama-detail/vincenzo',
image: 'https://asianimg.pro/cover/vincenzo.png'
}
]
}
```

### 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
dramacool.fetchMediaInfo("drama-detail/vincenzo").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: 'drama-detail/vincenzo',
title: 'Vincenzo (2021)',
status: 'Completed',
genres: ['Comedy', 'Crime','Drama',...],
otherNames: [ '빈센조', 'Binsenjo' ],
image: 'https://asianimg.pro/cover/vincenzo.png',
description: 'At the age of 8, Park Ju Hyeong is adopted and sent off to Italy. Now an adult, he is known as Vincenzo Casano.',
releaseDate: '2021',
contentRating: '',
airsOn: '',
director: 'kim hee won [김희원]',
originalNetwork: 'netflix; tvn',
trailer: {
url: 'https://www.youtube.com/embed/vO8rFbTtJNI',
id: 'vO8rFbTtJNI'
},
characters: [
{
url: 'https://dramacool.com.pa/star/ok-taecyeon',
imageUrl: 'https://asianimg.pro/star/ok-taecyeon.png',
title: 'Ok Taecyeon (1988)'
},
{...},
...
],
episodes: [
{
id: 'vincenzo-2021-episode-1',
title: 'Episode 1',
episode: 1,
subType: 'SUB',
releaseDate: '2021-02-20 07:17:21',
url: 'https://dramacool.com.pa/vincenzo-2021-episode-1.html'
},
{...},
...
]
}
```

### 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*) |
| server (optional) | [`StreamingServers`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L144-L157) | takes server enum as a parameter. *default: [`StreamingServers.AsianLoad`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L150)* |


```ts
dramacool.fetchEpisodeSources("vincenzo-2021-episode-1").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#L300-L306)*)\
output:
```js
{
sources: [
{
url: 'https://hls017.vipdracdn.net/streamhls2024/db287e9dc37d8c5b67c2498e3ef07c5a/ep.1.v0.1678048676.m3u8',
isM3U8: true
},
{
url: 'https://hls017.drafastcdn.pro/newvideos/newhls/sfRdQu0XQEJlsVGMH1S5nA/1721846640/230926_202.179.72.206/db287e9dc37d8c5b67c2498e3ef07c5a/ep.1.v0.1678048676.m3u8',
isM3U8: true
}
],
subtitles: [
{
url: 'https://asiancdn.com/images/db287e9dc37d8c5b67c2498e3ef07c5a/1.vtt',
lang: 'Default (maybe)'
}
]
}
```

### 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*) |


```ts
dramacool.fetchEpisodeServers("vincenzo-2021-episode-1").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#L115-L118)*)\
output:
```js
[
{
name: 'asianload',
url: 'https://plcool1.com/pl454545?id=MjMwOTI2&title=Vincenzo+%282021%29+episode+1&typesub=SUB'
},
{
name: 'kvid',
url: 'https://plcool1.com/embedplus?id=MjMwOTI2&token=SGWtnrSwuIw3RsQGPe5tRg&expires=1721846948'
},
{ name: 'asianstream', url: '7YE2aUb7PNVD3bY8NDIYqg' },
{ name: 'streamwish', url: 'https://dwish.pro/e/dr1qk2hew1v8' },
{
name: 'streamtape',
url: 'https://streamtape.com/e/plglOyRJPaTrOGP/vincenzo-2021-episode-1.mp4'
},
{ name: 'doodstream', url: 'https://dood.wf/e/zh9uj55c901a' },
{ name: 'vidhide', url: 'https://dlions.pro/v/7thb1yedp816' }
]
```

<p align="end">(<a href="https://github.com/consumet/extensions/blob/master/docs/guides/movies.md#">back to movie providers list</a>)</p>

### fetchPopular

```ts
dramacool.fetchPopular.then(data => {
console.log(data);
})
```

returns a promise which resolves into an array of movies. (*[`Promise<ISearch<IMovieResult>>`](https://github.com/consumet/extensions/blob/master/src/models/types.ts#L328-L336)*)\
output:
```js
{
currentPage: 1,
totalPages: 741,
hasNextPage: true,
results: [
{
id: 'drama-detail/is-it-fate',
title: "Serendipity's Embrace (2024)",
url: 'https://dramacool.com.pa/drama-detail/is-it-fate',
image: 'https://asianimg.pro/cover/is-it-fate-1719896631.png'
},
{
id: 'drama-detail/open-murder-contract',
title: 'No Way Out: The Roulette (2024)',
url: 'https://dramacool.com.pa/drama-detail/open-murder-contract',
image: 'https://asianimg.pro/cover/open-murder-contract-1720405656.png'
},
{...}
]
}
```
Loading

0 comments on commit 6e9e87f

Please sign in to comment.