jiujiuliu.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /*
  2. * @File : jiujiuliu.js
  3. * @Author : jade
  4. * @Date : 2024/1/4 14:15
  5. * @Email : jadehh@1ive.com
  6. * @Software : Samples
  7. * @Desc : 996影视
  8. */
  9. import {Spider} from "./spider.js";
  10. import {_, Crypto, load} from "../lib/cat.js";
  11. import {VodDetail, VodShort} from "../lib/vod.js";
  12. import * as Utils from "../lib/utils.js";
  13. class JiuJiuLiuSpider extends Spider {
  14. constructor() {
  15. super();
  16. this.siteUrl = "https://www.ojig519d8se.icu"
  17. }
  18. getName() {
  19. return "🔞┃九九六影视┃🔞"
  20. }
  21. getAppName() {
  22. return "九九六影视"
  23. }
  24. getJSName() {
  25. return "jiujiuliu"
  26. }
  27. getType() {
  28. return 3
  29. }
  30. async parseVodShortListFromDoc($) {
  31. let vod_list = []
  32. let vodElements = $("[class=\"stui-vodlist clearfix\"]").find("li")
  33. for (const vodElement of vodElements) {
  34. let resource = $(vodElement).find("[class=\"stui-vodlist__thumb lazyload\"]")[0]
  35. let vodShort = new VodShort()
  36. vodShort.vod_id = resource.attribs["href"]
  37. vodShort.vod_name = resource.attribs["title"]
  38. vodShort.vod_pic = resource.attribs["data-original"]
  39. vodShort.vod_remarks = $($(resource).find("[class=\"pic-text text-right\"]")[0]).text()
  40. vod_list.push(vodShort)
  41. }
  42. return vod_list
  43. }
  44. async parseVodShortListFromDocBySearch($) {
  45. let vod_list = []
  46. let vodElements = $("[class=\"stui-pannel_bd\"]").find("li")
  47. for (const vodElement of vodElements) {
  48. let resource = $($(vodElement).find("[class=\"thumb\"]")[0]).find("a")[0]
  49. let vodShort = new VodShort()
  50. vodShort.vod_id = resource.attribs["href"]
  51. vodShort.vod_name = resource.attribs["title"]
  52. vodShort.vod_pic = resource.attribs["data-original"]
  53. vodShort.vod_remarks = Utils.getStrByRegex(/类型:(.*?)地区/, $($(vodElement).find("[class=\"hidden-mi\"]")[0]).text())
  54. vod_list.push(vodShort)
  55. }
  56. return vod_list
  57. }
  58. async parseVodDetailFromDoc($) {
  59. let vodDetail = new VodDetail()
  60. let vodElement = $("[class=\"col-pd clearfix\"]")[1]
  61. let vodShortElement = $(vodElement).find("[class=\"stui-content__thumb\"]")[0]
  62. let vodItems = []
  63. for (const playElement of $("[class=\"stui-content__playlist clearfix\"]").find("a")) {
  64. let episodeUrl = this.siteUrl + playElement.attribs["href"];
  65. let episodeName = $(playElement).text();
  66. vodItems.push(episodeName + "$" + episodeUrl);
  67. }
  68. vodDetail.vod_name = $(vodShortElement).find("[class=\"stui-vodlist__thumb picture v-thumb\"]")[0].attribs["title"]
  69. vodDetail.vod_pic = $(vodShortElement).find("img")[0].attribs["data-original"]
  70. vodDetail.vod_remarks = $($(vodShortElement).find("[class=\"pic-text text-right\"]")[0]).text()
  71. let data_str = $($(vodElement).find("[class=\"data\"]")).text().replaceAll(" ", " ")
  72. vodDetail.type_name = Utils.getStrByRegex(/类型:(.*?) /, data_str)
  73. vodDetail.vod_area = Utils.getStrByRegex(/地区:(.*?) /, data_str)
  74. vodDetail.vod_year = Utils.getStrByRegex(/年份:(.*?) /, data_str)
  75. vodDetail.vod_actor = Utils.getStrByRegex(/主演:(.*?) /, data_str)
  76. vodDetail.vod_director = Utils.getStrByRegex(/导演:(.*?) /, data_str)
  77. vodDetail.vod_content = $($("[class=\"stui-pannel_bd\"]").find("[class=\"col-pd\"]")).text()
  78. vodDetail.vod_play_from = ["996"].join("$$$")
  79. vodDetail.vod_play_url = [vodItems.join("#")].join("$$$")
  80. return vodDetail
  81. }
  82. async setClasses() {
  83. let html = await this.fetch(this.siteUrl, null, this.getHeader(),false,false,0,true)
  84. if (html !== null) {
  85. let $ = load(html)
  86. let menuElements = $("[class=\"stui-header__menu type-slide\"]").find("a")
  87. for (const menuElement of menuElements) {
  88. let type_dic = {
  89. "type_name": $(menuElement).text(),
  90. "type_id": "/show/id/" + menuElement.attribs["href"].split("/").slice(-1)[0].split(".")[0]
  91. }
  92. if ($(menuElement).text() !== "首页") {
  93. this.classes.push(type_dic)
  94. }
  95. }
  96. }
  97. let x = 0
  98. }
  99. async getFilter($) {
  100. let hdElements = $("[class=\"stui-pannel_hd\"]")
  101. let extend_list = []
  102. let index = 0
  103. for (let i = 0; i < 2; i++) {
  104. let cateElemet = hdElements[i]
  105. let typeElements = $(cateElemet).find("ul")
  106. if (i === 0) {
  107. for (const typeElement of typeElements) {
  108. let extend_dic = {
  109. "key": (index + 1).toString(), "name": $($(typeElement).find("li")[0]).text(), "value": []
  110. }
  111. for (const ele of $(typeElement).find("li").slice(1)) {
  112. if (!_.isEmpty($(ele).text())) {
  113. if (index === 0) {
  114. extend_dic["value"].push({
  115. "n": $(ele).text(),
  116. "v": $(ele).find("a")[0].attribs["href"].split("/").slice(-1)[0].split(".")[0]
  117. })
  118. } else {
  119. extend_dic["value"].push({"n": $(ele).text(), "v": $(ele).text()})
  120. }
  121. }
  122. }
  123. extend_list.push(extend_dic)
  124. index = index + 1
  125. }
  126. } else {
  127. let extend_dic = {
  128. "key": (index + 1).toString(), "name": $($(cateElemet).find("li")[0]).text(), "value": []
  129. }
  130. extend_dic["value"].push({"n": "全部", "v": "time"})
  131. for (const ele of $(cateElemet).find("li").slice(1)) {
  132. if (!_.isEmpty($(ele).text())) {
  133. extend_dic["value"].push({
  134. "n": $(ele).text(), "v": $(ele).find("a")[0].attribs["href"].split("/")[3]
  135. })
  136. }
  137. }
  138. extend_list.push(extend_dic)
  139. }
  140. }
  141. return extend_list
  142. }
  143. async setFilterObj() {
  144. for (const type_dic of this.classes) {
  145. let type_id = type_dic["type_id"]
  146. if (type_id !== "/" && type_id !== "最近更新") {
  147. let url = this.siteUrl + type_id + ".html"
  148. let html = await this.fetch(url, null, this.getHeader())
  149. if (html != null) {
  150. let $ = load(html)
  151. this.filterObj[type_id] = await this.getFilter($)
  152. }
  153. }
  154. }
  155. }
  156. async setHomeVod() {
  157. let html = await this.fetch(this.siteUrl, null, this.getHeader())
  158. if (html != null) {
  159. let $ = load(html)
  160. this.homeVodList = await this.parseVodShortListFromDoc($)
  161. }
  162. }
  163. getParams(params, value) {
  164. let x = value ?? "全部"
  165. if (x === "全部" || x === undefined) {
  166. return ""
  167. } else {
  168. return params + value
  169. }
  170. }
  171. async setCategory(tid, pg, filter, extend) {
  172. let typeName = this.getParams("/id/", extend["1"])
  173. if (_.isEmpty(typeName)) {
  174. typeName = "/id/" + tid.split("/").slice(-1)[0]
  175. }
  176. let plot = this.getParams("/class/", extend["2"])
  177. let area = this.getParams("/area/", extend["3"])
  178. let year = this.getParams("/year/", extend["4"])
  179. let language = this.getParams("/lang/ ", extend["5"])
  180. let letter = this.getParams("/letter/ ", extend["6"])
  181. let time = this.getParams("/by/", extend["7"])
  182. let cateUrl = this.siteUrl + `/show${area}${time}${plot}${typeName}${language}${letter}${year}/page/${pg.toString()}.html`
  183. await this.jadeLog.info(`类别URL为:${cateUrl}`)
  184. this.limit = 36
  185. let html = await this.fetch(cateUrl, null, this.getHeader())
  186. if (html != null) {
  187. let $ = load(html)
  188. this.vodList = await this.parseVodShortListFromDoc($)
  189. }
  190. }
  191. async setDetail(id) {
  192. let detailUrl = this.siteUrl + id
  193. let html = await this.fetch(detailUrl, null, this.getHeader())
  194. if (html != null) {
  195. let $ = load(html)
  196. this.vodDetail = await this.parseVodDetailFromDoc($)
  197. }
  198. }
  199. async setSearch(wd, quick) {
  200. let searchUrl = this.siteUrl + `/search.html?wd=${wd}`
  201. let html = await this.fetch(searchUrl, null, this.getHeader())
  202. if (html != null) {
  203. let $ = load(html)
  204. this.vodList = await this.parseVodShortListFromDocBySearch($)
  205. }
  206. let x = 0
  207. }
  208. async setPlay(flag, id, flags) {
  209. let html = await this.fetch(id, null, this.getHeader())
  210. if (html !== null) {
  211. let matcher = Utils.getStrByRegex(/player_aaaa=(.*?)<\/script>/, html)
  212. let player = JSON.parse(matcher);
  213. try {
  214. this.playUrl = decodeURIComponent(Crypto.enc.Utf8.stringify(Crypto.enc.Base64.parse(player["url"])))
  215. this.header = this.getHeader()
  216. } catch (e) {
  217. this.playUrl = player["url"]
  218. }
  219. }
  220. }
  221. }
  222. let spider = new JiuJiuLiuSpider()
  223. async function init(cfg) {
  224. await spider.init(cfg)
  225. }
  226. async function home(filter) {
  227. return await spider.home(filter)
  228. }
  229. async function homeVod() {
  230. return await spider.homeVod()
  231. }
  232. async function category(tid, pg, filter, extend) {
  233. return await spider.category(tid, pg, filter, extend)
  234. }
  235. async function detail(id) {
  236. return await spider.detail(id)
  237. }
  238. async function play(flag, id, flags) {
  239. return await spider.play(flag, id, flags)
  240. }
  241. async function search(wd, quick) {
  242. return await spider.search(wd, quick)
  243. }
  244. export function __jsEvalReturn() {
  245. return {
  246. init: init, home: home, homeVod: homeVod, category: category, detail: detail, play: play, search: search,
  247. };
  248. }
  249. export {spider}