Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(streamwish): update searchParams to &i=0.4 to fix 403 error feat(movies): add fetchSpotlight to some providers #620

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/extractors/streamwish.js

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

1 change: 1 addition & 0 deletions dist/providers/movies/dramacool.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare class DramaCool extends MovieParser {
fetchPopular: (page?: number) => Promise<ISearch<IMovieResult>>;
fetchRecentTvShows: (page?: number) => Promise<ISearch<IMovieResult>>;
fetchRecentMovies: (page?: number) => Promise<ISearch<IMovieResult>>;
fetchSpotlight: () => Promise<ISearch<IMovieResult>>;
private fetchData;
private downloadLink;
private removeContainsFromString;
Expand Down
24 changes: 23 additions & 1 deletion 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 dist/providers/movies/flixhq.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ declare class FlixHQ extends MovieParser {
fetchTrendingTvShows: () => Promise<IMovieResult[]>;
fetchByCountry: (country: string, page?: number) => Promise<ISearch<IMovieResult>>;
fetchByGenre: (genre: string, page?: number) => Promise<ISearch<IMovieResult>>;
fetchSpotlight: () => Promise<ISearch<IMovieResult>>;
}
export default FlixHQ;
33 changes: 31 additions & 2 deletions dist/providers/movies/flixhq.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/flixhq.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/providers/movies/sflix.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ declare class SFlix extends MovieParser {
fetchTrendingTvShows: () => Promise<IMovieResult[]>;
fetchByCountry: (country: string, page?: number) => Promise<ISearch<IMovieResult>>;
fetchByGenre: (genre: string, page?: number) => Promise<ISearch<IMovieResult>>;
fetchSpotlight: () => Promise<ISearch<IMovieResult>>;
}
export default SFlix;
32 changes: 32 additions & 0 deletions dist/providers/movies/sflix.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/sflix.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/utils/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export declare const ANIFY_URL = "https://anify.eltik.cc";
export declare const splitAuthor: (authors: string) => string[];
export declare const floorID: (id: string) => number;
export declare const formatTitle: (title: string) => string;
export declare const genElement: (s: string, e: string) => import("cheerio").Cheerio<import("domhandler").AnyNode> | undefined;
export declare const genElement: (s: string, e: string) => import("cheerio").Cheerio<import("cheerio").AnyNode> | undefined;
export declare const range: ({ from, to, step, length }: {
from?: number | undefined;
to?: number | undefined;
Expand Down
31 changes: 31 additions & 0 deletions docs/providers/dramacool.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const dramacool = new MOVIES.DramaCool();
- [fetchPopular](#fetchpopular)
- [fetchRecentMovies](#fetchrecentmovies)
- [fetchRecentTvShows](#fetchrecenttvshows)
- [fetchSpotlight](#fetchspotlight)

### 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.
Expand Down Expand Up @@ -286,4 +287,34 @@ output:
{...}
]
}
```

### fetchSpotlight

```ts
dramacool.fetchSpotlight().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

{
results: [
{
id: 'drama-detail/the-judge-from-hell',
title: 'The Judge from Hell',
url: 'https://asianc.co/drama-detail/the-judge-from-hell',
cover: 'https://asianc.co/plugins/slideshow/slides/new/dramacool-the-judge-from-hell.png'
},
{
id: 'drama-detail/mom-s-friend-s-son',
title: 'Love Next Door',
url: 'https://asianc.co/drama-detail/mom-s-friend-s-son',
cover: 'https://asianc.co/plugins/slideshow/slides/new/dramacool-mom-s-friend-s-son.png'
},
{...}
]
```
42 changes: 42 additions & 0 deletions docs/providers/flixhq.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const flixhq = new MOVIES.FlixHQ();
- [fetchTrendingTvShows](#fetchtrendingtvshows)
- [fetchByCountry](#fetchbycountry)
- [fetchByGenre](#fetchbygenre)
- [fetchSpotlight](#fetchspotlight)

### 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.
Expand Down Expand Up @@ -456,3 +457,44 @@ output:
]
}
```

### fetchSpotlight

```ts
flixhq.fetchSpotlight().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

{
results: [
{
id: 'movie/watch-saturday-night-114820',
title: 'Saturday Night',
url: 'https://flixhq.to/movie/watch-saturday-night-114820',
cover: 'https://f.woowoowoowoo.net/resize/1200x600/2f/1d/2f1d04e79daf8d69ab1eb4ab1574f91f/2f1d04e79daf8d69ab1eb4ab1574f91f.jpg',
duration: '109min',
rating: '7.2',
genres: [Array],
description: 'At 11:30pm on October 11, 1975, a ferocious troupe of young comedians and writers changed television forever. This is the story of what happened behind the...',
type: 'Movie'
},
{
id: 'movie/watch-megalopolis-114703',
title: 'Megalopolis',
url: 'https://flixhq.to/movie/watch-megalopolis-114703',
cover: 'https://f.woowoowoowoo.net/resize/1200x600/fd/d7/fdd70eab48552734313737a7e38810b5/fdd70eab48552734313737a7e38810b5.jpg',
duration: '138min',
rating: '5',
genres: [Array],
description: 'Genius artist Cesar Catilina seeks to leap the City of New Rome into a utopian, idealistic future, while his opposition, Mayor Franklyn Cicero, remains...',
type: 'Movie'
},
{...}
]
}
```
39 changes: 39 additions & 0 deletions docs/providers/sflix.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const sflix = new MOVIES.SFlix();
- [fetchTrendingTvShows](#fetchtrendingtvshows)
- [fetchByCountry](#fetchbycountry)
- [fetchByGenre](#fetchbygenre)
- [fetchSpotlight](#fetchspotlight)


### 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.
Expand Down Expand Up @@ -423,3 +425,40 @@ output:
]
}
```

### fetchSpotlight

```ts
sflix.fetchSpotlight().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

{
results: [
{
id: 'movie/free-saturday-night-hd-114820',
title: 'Saturday Night',
url: 'https://sflix.to/movie/free-saturday-night-hd-114820',
cover: 'https://f.woowoowoowoo.net/resize/1200x600/2f/1d/2f1d04e79daf8d69ab1eb4ab1574f91f/2f1d04e79daf8d69ab1eb4ab1574f91f.jpg',
rating: '7.2',
description: 'At 11:30pm on October 11, 1975, a ferocious troupe of young comedians and writers changed television forever. This is the story of what happened behind the ...',
type: 'Movie'
},
{
id: 'movie/free-megalopolis-hd-114703',
title: 'Megalopolis',
url: 'https://sflix.to/movie/free-megalopolis-hd-114703',
cover: 'https://f.woowoowoowoo.net/resize/1200x600/fd/d7/fdd70eab48552734313737a7e38810b5/fdd70eab48552734313737a7e38810b5.jpg',
rating: '5',
description: 'Genius artist Cesar Catilina seeks to leap the City of New Rome into a utopian, idealistic future, while his opposition, Mayor Franklyn Cicero,...',
type: 'Movie'
},
{...}
]
}
```
2 changes: 1 addition & 1 deletion src/extractors/streamwish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class StreamWish extends VideoExtractor {
link = link.replace('file:"', '').replace(new RegExp('"', 'g'), '');
}
const linkParser = new URL(link);
linkParser.searchParams.set('i', '0.0');
linkParser.searchParams.set('i', '0.4');
this.sources.push({
quality: lastLink! ? 'backup' : 'default',
url: linkParser.href,
Expand Down
26 changes: 25 additions & 1 deletion src/providers/movies/dramacool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,29 @@
return this.fetchData(`${this.baseUrl}/recently-added-movie?page=${page}`, page, false, true);
};

fetchSpotlight = async (): Promise<ISearch<IMovieResult>> => {
try {
const results: ISearch<IMovieResult> = { results: [] };
const { data } = await this.client.get(`${this.baseUrl}`);

const $ = load(data);

$('div.ls-slide').each((i, el) => {
results.results.push({
id: $(el).find('a').attr('href')?.slice(1)!,
title: $(el).find('img').attr('title')!,
url: `${this.baseUrl}${$(el).find('a').attr('href')}`,
cover: $(el).find('img').attr('src'),
});
});

return results;
} catch (err) {
console.error(err);
throw new Error((err as Error).message);
}
};

private async fetchData(
url: string,
page: number,
Expand All @@ -283,7 +306,7 @@
.find('li')
.each((i, el) => {
const result: IMovieResult = {
id: $(el).find('a').attr('href')?.slice(1)!,

Check warning on line 309 in src/providers/movies/dramacool.ts

View check run for this annotation

codefactor.io / CodeFactor

src/providers/movies/dramacool.ts#L309

Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong. (@typescript-eslint/no-non-null-asserted-optional-chain)
title: $(el).find('h3.title').text().trim(),
url: `${this.baseUrl}${$(el).find('a').attr('href')}`,
image: $(el).find('img').attr('data-original'),
Expand Down Expand Up @@ -338,7 +361,8 @@
//testing fetchPopular via iife
// (async () => {
// const dramaCool = new DramaCool();
// await dramaCool.fetchRecentTvShows();
// const l=await dramaCool.fetchSpotlight();
// console.log(l);
// })();

export default DramaCool;
Loading
Loading