react-native-consumet 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/generated/java/com/consumet/NativeConsumetSpec.java +8 -0
- package/android/generated/jni/RNConsumetSpec-generated.cpp +12 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +18 -0
- package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +18 -0
- package/android/src/main/java/com/consumet/ConsumetModule.kt +12 -1
- package/android/src/main/java/com/consumet/DdosGuardModule.kt +1 -132
- package/android/src/main/java/com/consumet/HttpRequestModule.kt +417 -0
- package/ios/generated/RNConsumetSpec/RNConsumetSpec-generated.mm +14 -0
- package/ios/generated/RNConsumetSpec/RNConsumetSpec.h +10 -0
- package/ios/generated/RNConsumetSpecJSI-generated.cpp +18 -0
- package/ios/generated/RNConsumetSpecJSI.h +18 -0
- package/lib/commonjs/NativeConsumet.ts +22 -0
- package/lib/commonjs/extension-registry.json +46 -2
- package/lib/commonjs/extractors/index.js +4 -4
- package/lib/commonjs/extractors/index.js.map +1 -1
- package/lib/commonjs/extractors/megaup.js +14 -5
- package/lib/commonjs/extractors/megaup.js.map +1 -1
- package/lib/commonjs/extractors/{StreamP2P.js → streamp2p.js} +1 -1
- package/lib/commonjs/extractors/{StreamP2P.js.map → streamp2p.js.map} +1 -1
- package/lib/commonjs/extractors/streamwish.js +31 -25
- package/lib/commonjs/extractors/streamwish.js.map +1 -1
- package/lib/commonjs/extractors/vidhide.js +35 -20
- package/lib/commonjs/extractors/vidhide.js.map +1 -1
- package/lib/commonjs/providers/anime/animekai/animekai.js +6 -12
- package/lib/commonjs/providers/anime/animekai/animekai.js.map +1 -1
- package/lib/commonjs/providers/anime/animekai/create-animekai.js +1 -9
- package/lib/commonjs/providers/anime/animekai/create-animekai.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/animepahe.js +6 -13
- package/lib/commonjs/providers/anime/animepahe/animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +1 -10
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/providers/anime/zoro/create-zoro.js +1 -10
- package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +1 -1
- package/lib/commonjs/providers/anime/zoro/zoro.js +6 -13
- package/lib/commonjs/providers/anime/zoro/zoro.js.map +1 -1
- package/lib/commonjs/providers/movies/dramacool.js +395 -331
- package/lib/commonjs/providers/movies/dramacool.js.map +1 -1
- package/lib/commonjs/providers/movies/himovies/create-himovies.js +1 -12
- package/lib/commonjs/providers/movies/himovies/create-himovies.js.map +1 -1
- package/lib/commonjs/providers/movies/himovies/himovies.js +6 -16
- package/lib/commonjs/providers/movies/himovies/himovies.js.map +1 -1
- package/lib/commonjs/providers/movies/index.js +10 -4
- package/lib/commonjs/providers/movies/index.js.map +1 -1
- package/lib/{module/providers/movies/multimovies.js → commonjs/providers/movies/multimovies/create-multimovies.js} +183 -149
- package/lib/commonjs/providers/movies/multimovies/create-multimovies.js.map +1 -0
- package/lib/commonjs/providers/movies/multimovies/multimovies.js +46 -0
- package/lib/commonjs/providers/movies/multimovies/multimovies.js.map +1 -0
- package/lib/commonjs/providers/movies/multistream/index.js +16 -16
- package/lib/commonjs/providers/movies/netflixmirror.js +14 -14
- package/lib/commonjs/providers/movies/yflix/create-yflix.js +418 -0
- package/lib/commonjs/providers/movies/yflix/create-yflix.js.map +1 -0
- package/lib/commonjs/providers/movies/yflix/yflix.js +59 -0
- package/lib/commonjs/providers/movies/yflix/yflix.js.map +1 -0
- package/lib/commonjs/providers/movies/yflix.js +561 -0
- package/lib/commonjs/providers/movies/yflix.js.map +1 -0
- package/lib/commonjs/utils/create-extractor-context.js +2 -0
- package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
- package/lib/commonjs/utils/create-provider-context.js +2 -0
- package/lib/commonjs/utils/create-provider-context.js.map +1 -1
- package/lib/commonjs/utils/extension-utils.js +4 -2
- package/lib/commonjs/utils/extension-utils.js.map +1 -1
- package/lib/commonjs/utils/provider-maps.js +4 -1
- package/lib/commonjs/utils/provider-maps.js.map +1 -1
- package/lib/module/NativeConsumet.ts +22 -0
- package/lib/module/extension-registry.json +46 -2
- package/lib/module/extractors/index.js +2 -2
- package/lib/module/extractors/index.js.map +1 -1
- package/lib/module/extractors/megaup.js +14 -5
- package/lib/module/extractors/megaup.js.map +1 -1
- package/lib/module/extractors/{StreamP2P.js → streamp2p.js} +1 -1
- package/lib/module/extractors/{StreamP2P.js.map → streamp2p.js.map} +1 -1
- package/lib/module/extractors/streamwish.js +28 -21
- package/lib/module/extractors/streamwish.js.map +1 -1
- package/lib/module/extractors/vidhide.js +33 -17
- package/lib/module/extractors/vidhide.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/providers/anime/animekai/animekai.js +6 -12
- package/lib/module/providers/anime/animekai/animekai.js.map +1 -1
- package/lib/module/providers/anime/animekai/create-animekai.js +1 -9
- package/lib/module/providers/anime/animekai/create-animekai.js.map +1 -1
- package/lib/module/providers/anime/animepahe/animepahe.js +6 -13
- package/lib/module/providers/anime/animepahe/animepahe.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +1 -10
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/providers/anime/zoro/create-zoro.js +1 -10
- package/lib/module/providers/anime/zoro/create-zoro.js.map +1 -1
- package/lib/module/providers/anime/zoro/zoro.js +6 -13
- package/lib/module/providers/anime/zoro/zoro.js.map +1 -1
- package/lib/module/providers/movies/dramacool.js +395 -327
- package/lib/module/providers/movies/dramacool.js.map +1 -1
- package/lib/module/providers/movies/himovies/create-himovies.js +1 -11
- package/lib/module/providers/movies/himovies/create-himovies.js.map +1 -1
- package/lib/module/providers/movies/himovies/himovies.js +6 -16
- package/lib/module/providers/movies/himovies/himovies.js.map +1 -1
- package/lib/module/providers/movies/index.js +10 -4
- package/lib/module/providers/movies/index.js.map +1 -1
- package/lib/{commonjs/providers/movies/multimovies.js → module/providers/movies/multimovies/create-multimovies.js} +187 -161
- package/lib/module/providers/movies/multimovies/create-multimovies.js.map +1 -0
- package/lib/module/providers/movies/multimovies/multimovies.js +43 -0
- package/lib/module/providers/movies/multimovies/multimovies.js.map +1 -0
- package/lib/module/providers/movies/multistream/index.js +16 -16
- package/lib/module/providers/movies/netflixmirror.js +14 -14
- package/lib/module/providers/movies/yflix/create-yflix.js +414 -0
- package/lib/module/providers/movies/yflix/create-yflix.js.map +1 -0
- package/lib/module/providers/movies/yflix/yflix.js +55 -0
- package/lib/module/providers/movies/yflix/yflix.js.map +1 -0
- package/lib/module/providers/movies/yflix.js +561 -0
- package/lib/module/providers/movies/yflix.js.map +1 -0
- package/lib/module/utils/create-extractor-context.js +3 -1
- package/lib/module/utils/create-extractor-context.js.map +1 -1
- package/lib/module/utils/create-provider-context.js +3 -1
- package/lib/module/utils/create-provider-context.js.map +1 -1
- package/lib/module/utils/extension-utils.js +5 -3
- package/lib/module/utils/extension-utils.js.map +1 -1
- package/lib/module/utils/provider-maps.js +4 -1
- package/lib/module/utils/provider-maps.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts +36 -0
- package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/extractors/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megaup.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/{StreamP2P.d.ts → streamp2p.d.ts} +1 -1
- package/lib/typescript/commonjs/src/extractors/{StreamP2P.d.ts.map → streamp2p.d.ts.map} +1 -1
- package/lib/typescript/commonjs/src/extractors/streamwish.d.ts +7 -11
- package/lib/typescript/commonjs/src/extractors/streamwish.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/vidhide.d.ts +7 -7
- package/lib/typescript/commonjs/src/extractors/vidhide.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +2 -2
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts +3 -1
- package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/provider-context.d.ts +7 -5
- package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animekai/animekai.d.ts +6 -4
- package/lib/typescript/commonjs/src/providers/anime/animekai/animekai.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animekai/create-animekai.d.ts +8 -4
- package/lib/typescript/commonjs/src/providers/anime/animekai/create-animekai.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts +6 -4
- package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts +8 -4
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +8 -4
- package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts +6 -4
- package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/dramacool.d.ts +0 -21
- package/lib/typescript/commonjs/src/providers/movies/dramacool.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts +8 -5
- package/lib/typescript/commonjs/src/providers/movies/himovies/create-himovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts +6 -5
- package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts +7 -3
- package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts +20 -0
- package/lib/typescript/commonjs/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/movies/multimovies/multimovies.d.ts +21 -0
- package/lib/typescript/commonjs/src/providers/movies/multimovies/multimovies.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/movies/yflix/create-yflix.d.ts +25 -0
- package/lib/typescript/commonjs/src/providers/movies/yflix/create-yflix.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/movies/yflix/yflix.d.ts +44 -0
- package/lib/typescript/commonjs/src/providers/movies/yflix/yflix.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/providers/movies/yflix.d.ts +1 -0
- package/lib/typescript/commonjs/src/providers/movies/yflix.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +4 -4
- package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/provider-maps.d.ts +1 -0
- package/lib/typescript/commonjs/src/utils/provider-maps.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeConsumet.d.ts +36 -0
- package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/index.d.ts +2 -2
- package/lib/typescript/module/src/extractors/index.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megaup.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/{StreamP2P.d.ts → streamp2p.d.ts} +1 -1
- package/lib/typescript/module/src/extractors/{StreamP2P.d.ts.map → streamp2p.d.ts.map} +1 -1
- package/lib/typescript/module/src/extractors/streamwish.d.ts +7 -11
- package/lib/typescript/module/src/extractors/streamwish.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/vidhide.d.ts +7 -7
- package/lib/typescript/module/src/extractors/vidhide.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +2 -2
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extractor-context.d.ts +3 -1
- package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/models/provider-context.d.ts +7 -5
- package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animekai/animekai.d.ts +6 -4
- package/lib/typescript/module/src/providers/anime/animekai/animekai.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animekai/create-animekai.d.ts +8 -4
- package/lib/typescript/module/src/providers/anime/animekai/create-animekai.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts +6 -4
- package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts +8 -4
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +8 -4
- package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts +6 -4
- package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/dramacool.d.ts +0 -21
- package/lib/typescript/module/src/providers/movies/dramacool.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts +8 -5
- package/lib/typescript/module/src/providers/movies/himovies/create-himovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts +6 -5
- package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/index.d.ts +7 -3
- package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts +20 -0
- package/lib/typescript/module/src/providers/movies/multimovies/create-multimovies.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/movies/multimovies/multimovies.d.ts +21 -0
- package/lib/typescript/module/src/providers/movies/multimovies/multimovies.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/movies/yflix/create-yflix.d.ts +25 -0
- package/lib/typescript/module/src/providers/movies/yflix/create-yflix.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/movies/yflix/yflix.d.ts +44 -0
- package/lib/typescript/module/src/providers/movies/yflix/yflix.d.ts.map +1 -0
- package/lib/typescript/module/src/providers/movies/yflix.d.ts +1 -0
- package/lib/typescript/module/src/providers/movies/yflix.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/extension-utils.d.ts +4 -4
- package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/provider-maps.d.ts +1 -0
- package/lib/typescript/module/src/utils/provider-maps.d.ts.map +1 -1
- package/package.json +15 -5
- package/src/NativeConsumet.ts +22 -0
- package/src/extension-registry.json +46 -2
- package/src/extractors/index.ts +2 -2
- package/src/extractors/megaup.ts +27 -10
- package/src/extractors/streamwish.ts +36 -27
- package/src/extractors/vidhide.ts +42 -23
- package/src/index.tsx +2 -2
- package/src/models/extractor-context.ts +4 -0
- package/src/models/provider-context.ts +8 -10
- package/src/providers/anime/animekai/animekai.ts +14 -14
- package/src/providers/anime/animekai/create-animekai.ts +1 -10
- package/src/providers/anime/animepahe/animepahe.ts +14 -14
- package/src/providers/anime/animepahe/create-animepahe.ts +1 -11
- package/src/providers/anime/zoro/create-zoro.ts +1 -11
- package/src/providers/anime/zoro/zoro.ts +14 -14
- package/src/providers/movies/dramacool.ts +395 -394
- package/src/providers/movies/himovies/create-himovies.ts +1 -12
- package/src/providers/movies/himovies/himovies.ts +14 -17
- package/src/providers/movies/index.ts +9 -3
- package/src/providers/movies/{multimovies.ts → multimovies/create-multimovies.ts} +181 -156
- package/src/providers/movies/multimovies/multimovies.ts +57 -0
- package/src/providers/movies/multistream/index.ts +232 -232
- package/src/providers/movies/netflixmirror.ts +288 -288
- package/src/providers/movies/yflix/create-yflix.ts +496 -0
- package/src/providers/movies/yflix/yflix.ts +82 -0
- package/src/providers/movies/yflix.ts +559 -0
- package/src/utils/create-extractor-context.ts +4 -0
- package/src/utils/create-provider-context.ts +4 -0
- package/src/utils/extension-utils.ts +6 -2
- package/src/utils/provider-maps.ts +4 -1
- package/lib/commonjs/providers/movies/multimovies.js.map +0 -1
- package/lib/module/providers/movies/multimovies.js.map +0 -1
- package/lib/typescript/commonjs/src/providers/movies/multimovies.d.ts +0 -40
- package/lib/typescript/commonjs/src/providers/movies/multimovies.d.ts.map +0 -1
- package/lib/typescript/module/src/providers/movies/multimovies.d.ts +0 -40
- package/lib/typescript/module/src/providers/movies/multimovies.d.ts.map +0 -1
- /package/src/extractors/{StreamP2P.ts → streamp2p.ts} +0 -0
|
@@ -1,329 +1,397 @@
|
|
|
1
|
-
|
|
1
|
+
// import axios from 'axios';
|
|
2
|
+
// import { load } from 'cheerio';
|
|
3
|
+
|
|
4
|
+
// import { AsianLoad, MixDrop, StreamSB, StreamTape, StreamWish, VidHide } from '../../extractors';
|
|
5
|
+
// import {
|
|
6
|
+
// type IEpisodeServer,
|
|
7
|
+
// type IMovieInfo,
|
|
8
|
+
// type IMovieResult,
|
|
9
|
+
// type ISearch,
|
|
10
|
+
// type ISource,
|
|
11
|
+
// MediaStatus,
|
|
12
|
+
// MovieParser,
|
|
13
|
+
// StreamingServers,
|
|
14
|
+
// TvType,
|
|
15
|
+
// } from '../../models';
|
|
16
|
+
// import { PolyURL } from '../../utils';
|
|
17
|
+
|
|
18
|
+
// class DramaCool extends MovieParser {
|
|
19
|
+
// override readonly name = 'DramaCool';
|
|
20
|
+
// protected override baseUrl = 'https://dramacool.bg';
|
|
21
|
+
// protected override logo =
|
|
22
|
+
// 'https://play-lh.googleusercontent.com/IaCb2JXII0OV611MQ-wSA8v_SAs9XF6E3TMDiuxGGXo4wp9bI60GtDASIqdERSTO5XU';
|
|
23
|
+
// protected override classPath = 'MOVIES.DramaCool';
|
|
24
|
+
// override supportedTypes = new Set([TvType.MOVIE, TvType.TVSERIES]);
|
|
25
|
+
|
|
26
|
+
// override search = async (query: string, page: number = 1): Promise<ISearch<IMovieResult>> => {
|
|
27
|
+
// try {
|
|
28
|
+
// const searchResult: ISearch<IMovieResult> = {
|
|
29
|
+
// currentPage: page,
|
|
30
|
+
// totalPages: page,
|
|
31
|
+
// hasNextPage: false,
|
|
32
|
+
// results: [],
|
|
33
|
+
// };
|
|
34
|
+
|
|
35
|
+
// const { data } = await axios.get(
|
|
36
|
+
// `${this.baseUrl}/search?type=drama&keyword=${query.replace(/[\W_]+/g, '+')}&page=${page}`
|
|
37
|
+
// );
|
|
38
|
+
|
|
39
|
+
// const $ = load(data);
|
|
40
|
+
|
|
41
|
+
// const navSelector = 'ul.pagination';
|
|
42
|
+
|
|
43
|
+
// searchResult.hasNextPage =
|
|
44
|
+
// $(navSelector).length > 0 ? !$(navSelector).children().last().hasClass('selected') : false;
|
|
45
|
+
|
|
46
|
+
// const lastPage = $(navSelector).children().last().find('a').attr('href');
|
|
47
|
+
// if (lastPage !== undefined && lastPage !== '' && lastPage.includes('page=')) {
|
|
48
|
+
// const maxPage = new URLSearchParams(lastPage).get('page');
|
|
49
|
+
// if (maxPage !== null && !isNaN(parseInt(maxPage))) searchResult.totalPages = parseInt(maxPage);
|
|
50
|
+
// else if (searchResult.hasNextPage) searchResult.totalPages = page + 1;
|
|
51
|
+
// } else if (searchResult.hasNextPage) searchResult.totalPages = page + 1;
|
|
52
|
+
|
|
53
|
+
// $('div.block > div.tab-content > ul.list-episode-item > li').each((i, el) => {
|
|
54
|
+
// searchResult.results.push({
|
|
55
|
+
// id: $(el).find('a').attr('href')?.split(`${this.baseUrl}/`)[1]!,
|
|
56
|
+
// title: $(el).find('a > h3').text(),
|
|
57
|
+
// url: `${$(el).find('a').attr('href')}`,
|
|
58
|
+
// image: $(el).find('a > img').attr('data-original'),
|
|
59
|
+
// });
|
|
60
|
+
// });
|
|
61
|
+
// return searchResult;
|
|
62
|
+
// } catch (err) {
|
|
63
|
+
// throw new Error((err as Error).message);
|
|
64
|
+
// }
|
|
65
|
+
// };
|
|
66
|
+
|
|
67
|
+
// override fetchMediaInfo = async (mediaId: string): Promise<IMovieInfo> => {
|
|
68
|
+
// try {
|
|
69
|
+
// const realMediaId = mediaId;
|
|
70
|
+
// if (!mediaId.startsWith(this.baseUrl)) mediaId = `${this.baseUrl}/${mediaId}`;
|
|
71
|
+
|
|
72
|
+
// const mediaInfo: IMovieInfo = {
|
|
73
|
+
// id: '',
|
|
74
|
+
// title: '',
|
|
75
|
+
// };
|
|
76
|
+
|
|
77
|
+
// const { data } = await axios.get(mediaId);
|
|
78
|
+
// const $ = load(data);
|
|
79
|
+
|
|
80
|
+
// mediaInfo.id = realMediaId;
|
|
81
|
+
|
|
82
|
+
// const duration = $('div.details div.info p:contains("Duration:")').first().text().trim();
|
|
83
|
+
// if (duration !== '') mediaInfo.duration = duration.replace('Duration:', '').trim();
|
|
84
|
+
// const status = $('div.details div.info p:contains("Status:")').find('a').first().text().trim();
|
|
85
|
+
// switch (status) {
|
|
86
|
+
// case 'Ongoing':
|
|
87
|
+
// mediaInfo.status = MediaStatus.ONGOING;
|
|
88
|
+
// break;
|
|
89
|
+
// case 'Completed':
|
|
90
|
+
// mediaInfo.status = MediaStatus.COMPLETED;
|
|
91
|
+
// break;
|
|
92
|
+
// default:
|
|
93
|
+
// mediaInfo.status = MediaStatus.UNKNOWN;
|
|
94
|
+
// break;
|
|
95
|
+
// }
|
|
96
|
+
// mediaInfo.genres = [];
|
|
97
|
+
// const genres = $('div.details div.info p:contains("Genre:")');
|
|
98
|
+
// genres.each((_index, element) => {
|
|
99
|
+
// $(element)
|
|
100
|
+
// .find('a')
|
|
101
|
+
// .each((_, anchorElement) => {
|
|
102
|
+
// mediaInfo.genres?.push($(anchorElement).text());
|
|
103
|
+
// });
|
|
104
|
+
// });
|
|
105
|
+
|
|
106
|
+
// mediaInfo.title = $('.info > h1:nth-child(1)').text();
|
|
107
|
+
// mediaInfo.otherNames = $('.other_name > a')
|
|
108
|
+
// .map((i, el) => $(el).text().trim())
|
|
109
|
+
// .get();
|
|
110
|
+
// mediaInfo.image = $('div.details > div.img > img').attr('src');
|
|
111
|
+
// mediaInfo.description = $('div.details div.info p:not(:has(*))')
|
|
112
|
+
// .map((i, el) => $(el).text().trim())
|
|
113
|
+
// .get()
|
|
114
|
+
// .join('\n\n')
|
|
115
|
+
// .trim();
|
|
116
|
+
// mediaInfo.releaseDate = this.removeContainsFromString(
|
|
117
|
+
// $('div.details div.info p:contains("Released:")').text(),
|
|
118
|
+
// 'Released'
|
|
119
|
+
// );
|
|
120
|
+
// mediaInfo.contentRating = this.removeContainsFromString(
|
|
121
|
+
// $('div.details div.info p:contains("Content Rating:")').text(),
|
|
122
|
+
// 'Content Rating'
|
|
123
|
+
// );
|
|
124
|
+
// mediaInfo.airsOn = this.removeContainsFromString(
|
|
125
|
+
// $('div.details div.info p:contains("Airs On:")').text(),
|
|
126
|
+
// 'Airs On'
|
|
127
|
+
// );
|
|
128
|
+
// mediaInfo.director = this.removeContainsFromString(
|
|
129
|
+
// $('div.details div.info p:contains("Director:")').text(),
|
|
130
|
+
// 'Director'
|
|
131
|
+
// );
|
|
132
|
+
// mediaInfo.originalNetwork = this.cleanUpText(
|
|
133
|
+
// this.removeContainsFromString(
|
|
134
|
+
// $('div.details div.info p:contains("Original Network:")').text().trim(),
|
|
135
|
+
// 'Original Network'
|
|
136
|
+
// )
|
|
137
|
+
// );
|
|
138
|
+
|
|
139
|
+
// const trailerIframe = $('div.trailer').find('iframe').attr('src');
|
|
140
|
+
// mediaInfo.trailer = {
|
|
141
|
+
// id: trailerIframe?.split('embed/')[1]?.split('?')[0]!,
|
|
142
|
+
// url: trailerIframe,
|
|
143
|
+
// };
|
|
144
|
+
// mediaInfo.characters = [];
|
|
145
|
+
// $('div.slider-star > div.item').each((i, el) => {
|
|
146
|
+
// const url = `${this.baseUrl}${$(el).find('a.img').attr('href')}`;
|
|
147
|
+
// const image = $(el).find('img').attr('src');
|
|
148
|
+
// const name = $(el).find('h3.title').text().trim();
|
|
149
|
+
|
|
150
|
+
// (mediaInfo.characters as any[]).push({
|
|
151
|
+
// url,
|
|
152
|
+
// image,
|
|
153
|
+
// name,
|
|
154
|
+
// });
|
|
155
|
+
// });
|
|
156
|
+
|
|
157
|
+
// mediaInfo.episodes = [];
|
|
158
|
+
// $('div.content-left > div.block-tab > div > div > ul > li').each((i, el) => {
|
|
159
|
+
// mediaInfo.episodes?.push({
|
|
160
|
+
// id: $(el).find('a').attr('href')?.split(`${this.baseUrl}/`)[1]!,
|
|
161
|
+
// title: $(el).find('h3').text().replace(mediaInfo.title.toString(), '').trim(),
|
|
162
|
+
// episode: parseFloat($(el).find('a').attr('href')?.split('-episode-')[1]!),
|
|
163
|
+
// subType: $(el).find('span.type').text(),
|
|
164
|
+
// releaseDate: $(el).find('span.time').text(),
|
|
165
|
+
// url: `${$(el).find('a').attr('href')}`,
|
|
166
|
+
// });
|
|
167
|
+
// });
|
|
168
|
+
// mediaInfo.episodes.reverse();
|
|
169
|
+
|
|
170
|
+
// return mediaInfo;
|
|
171
|
+
// } catch (err) {
|
|
172
|
+
// throw new Error((err as Error).message);
|
|
173
|
+
// }
|
|
174
|
+
// };
|
|
175
|
+
|
|
176
|
+
// override async fetchEpisodeServers(episodeId: string, ...args: any): Promise<IEpisodeServer[]> {
|
|
177
|
+
// try {
|
|
178
|
+
// const episodeServers: IEpisodeServer[] = [];
|
|
179
|
+
|
|
180
|
+
// episodeId = `${this.baseUrl}/${episodeId}`;
|
|
181
|
+
|
|
182
|
+
// const { data } = await axios.get(episodeId);
|
|
183
|
+
// const $ = load(data);
|
|
2
184
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
throw new Error('Server not supported');
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
try {
|
|
219
|
-
// episodeId = `${this.baseUrl}/${episodeId}`;
|
|
220
|
-
|
|
221
|
-
const servers = await this.fetchEpisodeServers(episodeId);
|
|
222
|
-
const i = servers.findIndex(s => s.name.toLowerCase() === server.toLowerCase());
|
|
223
|
-
if (i === -1) {
|
|
224
|
-
throw new Error(`Server ${server} not found`);
|
|
225
|
-
}
|
|
226
|
-
const serverUrl = new URL(servers.filter(s => s.name.toLowerCase() === server.toLowerCase())[0].url);
|
|
227
|
-
return await this.fetchEpisodeSources(serverUrl.href, server);
|
|
228
|
-
} catch (err) {
|
|
229
|
-
throw new Error(err.message);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
fetchPopular = async (page = 1) => {
|
|
233
|
-
return this.fetchData(`${this.baseUrl}/all-most-popular-drama?page=${page}`, page);
|
|
234
|
-
};
|
|
235
|
-
fetchRecentTvShows = async (page = 1) => {
|
|
236
|
-
return this.fetchData(`${this.baseUrl}/all-recently-added/drama?page=${page}`, page, true);
|
|
237
|
-
};
|
|
238
|
-
fetchRecentMovies = async (page = 1) => {
|
|
239
|
-
return this.fetchData(`${this.baseUrl}/all-recently-added/movie?page=${page}`, page, false, true);
|
|
240
|
-
};
|
|
241
|
-
fetchSpotlight = async () => {
|
|
242
|
-
try {
|
|
243
|
-
const results = {
|
|
244
|
-
results: []
|
|
245
|
-
};
|
|
246
|
-
const {
|
|
247
|
-
data
|
|
248
|
-
} = await axios.get(`${this.baseUrl}`);
|
|
249
|
-
const $ = load(data);
|
|
250
|
-
$('div.ls-slide').each((i, el) => {
|
|
251
|
-
results.results.push({
|
|
252
|
-
id: $(el).find('a').attr('href')?.slice(1),
|
|
253
|
-
title: $(el).find('img').attr('title'),
|
|
254
|
-
url: `${this.baseUrl}${$(el).find('a').attr('href')}`,
|
|
255
|
-
cover: $(el).find('img').attr('src')
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
return results;
|
|
259
|
-
} catch (err) {
|
|
260
|
-
console.error(err);
|
|
261
|
-
throw new Error(err.message);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
async fetchData(url, page, isTvShow = false, isMovies = false) {
|
|
265
|
-
try {
|
|
266
|
-
const {
|
|
267
|
-
data
|
|
268
|
-
} = await axios.get(url);
|
|
269
|
-
const $ = load(data);
|
|
270
|
-
const results = {
|
|
271
|
-
currentPage: page,
|
|
272
|
-
totalPages: page,
|
|
273
|
-
hasNextPage: false,
|
|
274
|
-
results: []
|
|
275
|
-
};
|
|
276
|
-
$('ul.switch-block.list-episode-item').find('li').each((i, el) => {
|
|
277
|
-
const result = {
|
|
278
|
-
id: $(el).find('a').attr('href')?.split(`${this.baseUrl}/`)[1],
|
|
279
|
-
title: $(el).find('h3.title').text().trim(),
|
|
280
|
-
url: `${$(el).find('a').attr('href')}`,
|
|
281
|
-
image: $(el).find('img').attr('data-original')
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
// keeping the old code for future reference
|
|
285
|
-
// if (isTvShow || isMovies) {
|
|
286
|
-
// result.id = result.image
|
|
287
|
-
// ? result.image.replace(/^https:\/\/[^\/]+\/[^\/]+\/(.+?)-\d+\.\w+$/, 'drama-detail/$1')!
|
|
288
|
-
// : '';
|
|
289
|
-
// }
|
|
290
|
-
|
|
291
|
-
if (isTvShow) {
|
|
292
|
-
result.episodeNumber = parseFloat($(el).find('span.ep').text().trim().split(' ')[1]);
|
|
293
|
-
}
|
|
294
|
-
results.results.push(result);
|
|
295
|
-
});
|
|
296
|
-
const navSelector = 'ul.pagination';
|
|
297
|
-
results.hasNextPage = $(navSelector).length > 0 ? !$(navSelector).children().last().hasClass('selected') : false;
|
|
298
|
-
const lastPage = $(navSelector).children().last().find('a').attr('href');
|
|
299
|
-
if (lastPage !== undefined && lastPage !== '' && lastPage.includes('page=')) {
|
|
300
|
-
const maxPage = new URLSearchParams(lastPage).get('page');
|
|
301
|
-
if (maxPage !== null && !isNaN(parseInt(maxPage))) results.totalPages = parseInt(maxPage);else if (results.hasNextPage) results.totalPages = page + 1;
|
|
302
|
-
} else if (results.hasNextPage) results.totalPages = page + 1;
|
|
303
|
-
return results;
|
|
304
|
-
} catch (err) {
|
|
305
|
-
throw new Error(err.message);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
downloadLink = url => {
|
|
309
|
-
return url.replace(/^(https:\/\/[^\/]+)\/[^?]+(\?.+)$/, '$1/download$2');
|
|
310
|
-
};
|
|
311
|
-
removeContainsFromString = (str, contains) => {
|
|
312
|
-
contains = contains.toLowerCase();
|
|
313
|
-
return str.toLowerCase().replace(/\n/g, '').replace(`${contains}:`, '').trim();
|
|
314
|
-
};
|
|
315
|
-
cleanUpText = str => {
|
|
316
|
-
return str.split(';').map(part => part.trim()).filter(part => part.length > 0).join('; ');
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
// (async () => {
|
|
320
|
-
// const dramaCool = new DramaCool();
|
|
321
|
-
// // const l=await dramaCool.search('squid game');
|
|
322
|
-
// const m = await dramaCool.fetchEpisodeServers('video-watch/squid-games-2021-episode-9-as-jao');
|
|
323
|
-
// const l = await dramaCool.fetchEpisodeSources('video-watch/squid-games-2021-episode-9-as-jao');
|
|
324
|
-
// // const l = await dramaCool.fetchMediaInfo('drama-detail/squid-games-2021-hd');
|
|
325
|
-
// console.log(m,l);
|
|
326
|
-
// })();
|
|
327
|
-
|
|
328
|
-
export default DramaCool;
|
|
185
|
+
// // keeping the old code future reference
|
|
186
|
+
// // $('div.anime_muti_link > ul > li').map(async (i, ele) => {
|
|
187
|
+
// // const url = $(ele).attr('data-video')!;
|
|
188
|
+
// // let name = $(ele).attr('class')!.replace('selected', '').trim();
|
|
189
|
+
// // if (name.includes('standard')) {
|
|
190
|
+
// // name = StreamingServers.AsianLoad;
|
|
191
|
+
// // }
|
|
192
|
+
// // episodeServers.push({
|
|
193
|
+
// // name: name,
|
|
194
|
+
// // url: url.startsWith('//') ? url?.replace('//', 'https://') : url,
|
|
195
|
+
// // });
|
|
196
|
+
// // });
|
|
197
|
+
|
|
198
|
+
// const standardServer = $('div.anime_muti_link > ul > li.standard').attr('data-video')!;
|
|
199
|
+
// const url = standardServer.startsWith('//') ? standardServer?.replace('//', 'https://') : standardServer;
|
|
200
|
+
// const { data: servers } = await axios.get(url);
|
|
201
|
+
// const $$ = load(servers);
|
|
202
|
+
// $$('div#list-server-more > ul > li').each((i, el) => {
|
|
203
|
+
// let name = $$(el).attr('data-provider')!;
|
|
204
|
+
// const server = $$(el).attr('data-video')!;
|
|
205
|
+
// if (name.includes('serverwithtoken')) {
|
|
206
|
+
// name = StreamingServers.AsianLoad;
|
|
207
|
+
// }
|
|
208
|
+
// if (server) {
|
|
209
|
+
// episodeServers.push({
|
|
210
|
+
// name: name,
|
|
211
|
+
// url: server.startsWith('//') ? server?.replace('//', 'https://') : server,
|
|
212
|
+
// });
|
|
213
|
+
// }
|
|
214
|
+
// });
|
|
215
|
+
// return episodeServers;
|
|
216
|
+
// } catch (err) {
|
|
217
|
+
// throw new Error((err as Error).message);
|
|
218
|
+
// }
|
|
219
|
+
// }
|
|
220
|
+
|
|
221
|
+
// override fetchEpisodeSources = async (
|
|
222
|
+
// episodeId: string,
|
|
223
|
+
// server: StreamingServers = StreamingServers.AsianLoad
|
|
224
|
+
// ): Promise<ISource> => {
|
|
225
|
+
// if (episodeId.startsWith('http')) {
|
|
226
|
+
// const serverUrl = new PolyURL(episodeId);
|
|
227
|
+
// switch (server) {
|
|
228
|
+
// case StreamingServers.AsianLoad:
|
|
229
|
+
// return {
|
|
230
|
+
// headers: { Referer: serverUrl.origin },
|
|
231
|
+
// ...(await new AsianLoad().extract(serverUrl)),
|
|
232
|
+
// download: this.downloadLink(episodeId),
|
|
233
|
+
// };
|
|
234
|
+
// case StreamingServers.MixDrop:
|
|
235
|
+
// return {
|
|
236
|
+
// headers: { Referer: serverUrl.origin },
|
|
237
|
+
// sources: await new MixDrop().extract(serverUrl),
|
|
238
|
+
// };
|
|
239
|
+
// case StreamingServers.StreamTape:
|
|
240
|
+
// return {
|
|
241
|
+
// headers: { Referer: serverUrl.origin },
|
|
242
|
+
// sources: await new StreamTape().extract(serverUrl),
|
|
243
|
+
// };
|
|
244
|
+
// case StreamingServers.StreamSB:
|
|
245
|
+
// return {
|
|
246
|
+
// headers: { Referer: serverUrl.origin },
|
|
247
|
+
// sources: await new StreamSB().extract(serverUrl),
|
|
248
|
+
// };
|
|
249
|
+
// case StreamingServers.StreamWish:
|
|
250
|
+
// return {
|
|
251
|
+
// headers: { Referer: serverUrl.origin },
|
|
252
|
+
// ...(await new StreamWish().extract(serverUrl)),
|
|
253
|
+
// };
|
|
254
|
+
// case StreamingServers.VidHide:
|
|
255
|
+
// return {
|
|
256
|
+
// headers: { Referer: serverUrl.href },
|
|
257
|
+
// sources: await new VidHide().extract(serverUrl),
|
|
258
|
+
// };
|
|
259
|
+
// default:
|
|
260
|
+
// throw new Error('Server not supported');
|
|
261
|
+
// }
|
|
262
|
+
// }
|
|
263
|
+
// try {
|
|
264
|
+
// // episodeId = `${this.baseUrl}/${episodeId}`;
|
|
265
|
+
|
|
266
|
+
// const servers = await this.fetchEpisodeServers(episodeId);
|
|
267
|
+
// const i = servers.findIndex((s) => s.name.toLowerCase() === server.toLowerCase());
|
|
268
|
+
// if (i === -1) {
|
|
269
|
+
// throw new Error(`Server ${server} not found`);
|
|
270
|
+
// }
|
|
271
|
+
// const serverUrl: URL = new URL(servers.filter((s) => s.name.toLowerCase() === server.toLowerCase())[0]!.url);
|
|
272
|
+
|
|
273
|
+
// return await this.fetchEpisodeSources(serverUrl.href, server);
|
|
274
|
+
// } catch (err) {
|
|
275
|
+
// throw new Error((err as Error).message);
|
|
276
|
+
// }
|
|
277
|
+
// };
|
|
278
|
+
|
|
279
|
+
// fetchPopular = async (page: number = 1): Promise<ISearch<IMovieResult>> => {
|
|
280
|
+
// return this.fetchData(`${this.baseUrl}/all-most-popular-drama?page=${page}`, page);
|
|
281
|
+
// };
|
|
282
|
+
|
|
283
|
+
// fetchRecentTvShows = async (page: number = 1): Promise<ISearch<IMovieResult>> => {
|
|
284
|
+
// return this.fetchData(`${this.baseUrl}/all-recently-added/drama?page=${page}`, page, true);
|
|
285
|
+
// };
|
|
286
|
+
|
|
287
|
+
// fetchRecentMovies = async (page: number = 1): Promise<ISearch<IMovieResult>> => {
|
|
288
|
+
// return this.fetchData(`${this.baseUrl}/all-recently-added/movie?page=${page}`, page, false, true);
|
|
289
|
+
// };
|
|
290
|
+
|
|
291
|
+
// fetchSpotlight = async (): Promise<ISearch<IMovieResult>> => {
|
|
292
|
+
// try {
|
|
293
|
+
// const results: ISearch<IMovieResult> = { results: [] };
|
|
294
|
+
// const { data } = await axios.get(`${this.baseUrl}`);
|
|
295
|
+
|
|
296
|
+
// const $ = load(data);
|
|
297
|
+
|
|
298
|
+
// $('div.ls-slide').each((i, el) => {
|
|
299
|
+
// results.results.push({
|
|
300
|
+
// id: $(el).find('a').attr('href')?.slice(1)!,
|
|
301
|
+
// title: $(el).find('img').attr('title')!,
|
|
302
|
+
// url: `${this.baseUrl}${$(el).find('a').attr('href')}`,
|
|
303
|
+
// cover: $(el).find('img').attr('src'),
|
|
304
|
+
// });
|
|
305
|
+
// });
|
|
306
|
+
|
|
307
|
+
// return results;
|
|
308
|
+
// } catch (err) {
|
|
309
|
+
// console.error(err);
|
|
310
|
+
// throw new Error((err as Error).message);
|
|
311
|
+
// }
|
|
312
|
+
// };
|
|
313
|
+
|
|
314
|
+
// private async fetchData(
|
|
315
|
+
// url: string,
|
|
316
|
+
// page: number,
|
|
317
|
+
// isTvShow: boolean = false,
|
|
318
|
+
// isMovies: boolean = false
|
|
319
|
+
// ): Promise<ISearch<IMovieResult>> {
|
|
320
|
+
// try {
|
|
321
|
+
// const { data } = await axios.get(url);
|
|
322
|
+
// const $ = load(data);
|
|
323
|
+
// const results: ISearch<IMovieResult> = {
|
|
324
|
+
// currentPage: page,
|
|
325
|
+
// totalPages: page,
|
|
326
|
+
// hasNextPage: false,
|
|
327
|
+
// results: [],
|
|
328
|
+
// };
|
|
329
|
+
|
|
330
|
+
// $('ul.switch-block.list-episode-item')
|
|
331
|
+
// .find('li')
|
|
332
|
+
// .each((i, el) => {
|
|
333
|
+
// const result: IMovieResult = {
|
|
334
|
+
// id: $(el).find('a').attr('href')?.split(`${this.baseUrl}/`)[1]!,
|
|
335
|
+
// title: $(el).find('h3.title').text().trim(),
|
|
336
|
+
// url: `${$(el).find('a').attr('href')}`,
|
|
337
|
+
// image: $(el).find('img').attr('data-original'),
|
|
338
|
+
// };
|
|
339
|
+
|
|
340
|
+
// // keeping the old code for future reference
|
|
341
|
+
// // if (isTvShow || isMovies) {
|
|
342
|
+
// // result.id = result.image
|
|
343
|
+
// // ? result.image.replace(/^https:\/\/[^\/]+\/[^\/]+\/(.+?)-\d+\.\w+$/, 'drama-detail/$1')!
|
|
344
|
+
// // : '';
|
|
345
|
+
// // }
|
|
346
|
+
|
|
347
|
+
// if (isTvShow) {
|
|
348
|
+
// result.episodeNumber = parseFloat($(el).find('span.ep').text().trim().split(' ')[1]!);
|
|
349
|
+
// }
|
|
350
|
+
|
|
351
|
+
// results.results.push(result);
|
|
352
|
+
// });
|
|
353
|
+
|
|
354
|
+
// const navSelector = 'ul.pagination';
|
|
355
|
+
// results.hasNextPage = $(navSelector).length > 0 ? !$(navSelector).children().last().hasClass('selected') : false;
|
|
356
|
+
|
|
357
|
+
// const lastPage = $(navSelector).children().last().find('a').attr('href');
|
|
358
|
+
// if (lastPage !== undefined && lastPage !== '' && lastPage.includes('page=')) {
|
|
359
|
+
// const maxPage = new URLSearchParams(lastPage).get('page');
|
|
360
|
+
// if (maxPage !== null && !isNaN(parseInt(maxPage))) results.totalPages = parseInt(maxPage);
|
|
361
|
+
// else if (results.hasNextPage) results.totalPages = page + 1;
|
|
362
|
+
// } else if (results.hasNextPage) results.totalPages = page + 1;
|
|
363
|
+
|
|
364
|
+
// return results;
|
|
365
|
+
// } catch (err) {
|
|
366
|
+
// throw new Error((err as Error).message);
|
|
367
|
+
// }
|
|
368
|
+
// }
|
|
369
|
+
|
|
370
|
+
// private downloadLink = (url: string) => {
|
|
371
|
+
// return url.replace(/^(https:\/\/[^\/]+)\/[^?]+(\?.+)$/, '$1/download$2');
|
|
372
|
+
// };
|
|
373
|
+
|
|
374
|
+
// private removeContainsFromString = (str: string, contains: string) => {
|
|
375
|
+
// contains = contains.toLowerCase();
|
|
376
|
+
// return str.toLowerCase().replace(/\n/g, '').replace(`${contains}:`, '').trim();
|
|
377
|
+
// };
|
|
378
|
+
// private cleanUpText = (str: string) => {
|
|
379
|
+
// return str
|
|
380
|
+
// .split(';')
|
|
381
|
+
// .map((part) => part.trim())
|
|
382
|
+
// .filter((part) => part.length > 0)
|
|
383
|
+
// .join('; ');
|
|
384
|
+
// };
|
|
385
|
+
// }
|
|
386
|
+
// // (async () => {
|
|
387
|
+
// // const dramaCool = new DramaCool();
|
|
388
|
+
// // // const l=await dramaCool.search('squid game');
|
|
389
|
+
// // const m = await dramaCool.fetchEpisodeServers('video-watch/squid-games-2021-episode-9-as-jao');
|
|
390
|
+
// // const l = await dramaCool.fetchEpisodeSources('video-watch/squid-games-2021-episode-9-as-jao');
|
|
391
|
+
// // // const l = await dramaCool.fetchMediaInfo('drama-detail/squid-games-2021-hd');
|
|
392
|
+
// // console.log(m,l);
|
|
393
|
+
// // })();
|
|
394
|
+
|
|
395
|
+
// export default DramaCool;
|
|
396
|
+
"use strict";
|
|
329
397
|
//# sourceMappingURL=dramacool.js.map
|