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