hscangku.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * @File : hscangku.js
  3. * @Author : jade
  4. * @Date : 2024/01/03 19:19
  5. * @Email : jadehh@1ive.com
  6. * @Software : Samples
  7. * @Desc :
  8. */
  9. import {load} from "../lib/cat.js";
  10. import {VodDetail, VodShort} from "../lib/vod.js";
  11. import {Spider} from "./spider.js";
  12. class HsCangkuSpider extends Spider {
  13. constructor() {
  14. super();
  15. this.siteUrl = "https://hsck12.shop/"
  16. }
  17. getName() {
  18. return "🔞┃黄色仓库┃🔞"
  19. }
  20. getAppName() {
  21. return "黄色仓库"
  22. }
  23. getJSName() {
  24. return "hscangku"
  25. }
  26. getType() {
  27. return 3
  28. }
  29. async parseVodShortListFromDoc($) {
  30. let vod_list = []
  31. let vodElements = $("[class=\"stui-vodlist clearfix\"]").find("li")
  32. for (const vod_element of vodElements) {
  33. let vodShort = new VodShort()
  34. let vodElement = $(vod_element).find("a")[0]
  35. vodShort.vod_id = vodElement.attribs["href"]
  36. vodShort.vod_name = vodElement.attribs["title"]
  37. vodShort.vod_pic = vodElement.attribs["data-original"]
  38. vod_list.push(vodShort)
  39. }
  40. return vod_list
  41. }
  42. async parseVodDetailFromDoc($) {
  43. let vodDetail = new VodDetail()
  44. let element = $($("[class=\"stui-pannel__head clearfix\"]")[1]).find("h3")
  45. let stui_pannel_bd_element = $("div.stui-pannel-bd > div")
  46. let video_element = stui_pannel_bd_element.find("video")[0]
  47. vodDetail.vod_name = element.text()
  48. vodDetail.vod_pic = video_element.attribs["poster"]
  49. vodDetail.vod_play_from = "黄色仓库"
  50. vodDetail.vod_play_url = $(video_element).find("source")[0].attribs["src"]
  51. return vodDetail
  52. }
  53. async setClasses() {
  54. this.classes = [
  55. {
  56. "type_name": "国产视频",
  57. "type_id": "?type=gc"
  58. },
  59. {
  60. "type_name": "国产新片",
  61. "type_id": "?type=ycgc"
  62. },
  63. {
  64. "type_name": "无码中文字幕",
  65. "type_id": "?type=wz"
  66. },
  67. {
  68. "type_name": "有码中文字幕",
  69. "type_id": "?type=yz"
  70. },
  71. {
  72. "type_name": "日本无码",
  73. "type_id": "?type=rw"
  74. }
  75. ]
  76. }
  77. async setCategory(tid, pg, filter, extend) {
  78. let url = this.siteUrl + tid + "&p=" + pg.toString()
  79. let html = await this.fetch(url, null,this.getHeader())
  80. this.limit = 40;
  81. if (html !== null) {
  82. let $ = load(html)
  83. this.vodList = await this.parseVodShortListFromDoc($)
  84. this.total = parseInt($("[class=\"active\"]").find("span").text())
  85. }
  86. }
  87. async setDetail(id) {
  88. let url = this.siteUrl + id
  89. let html = await this.fetch(url,null,this.getHeader())
  90. if (html !== null) {
  91. let $ = load(html)
  92. this.vodDetail = await this.parseVodDetailFromDoc($)
  93. }
  94. }
  95. async setPlay(flag, id, flags) {
  96. this.playUrl = id
  97. this.playHeader = {}
  98. }
  99. }
  100. let spider = new HsCangkuSpider()
  101. async function init(cfg) {
  102. await spider.init(cfg)
  103. }
  104. async function home(filter) {
  105. return await spider.home(filter)
  106. }
  107. async function homeVod() {
  108. return await spider.homeVod()
  109. }
  110. async function category(tid, pg, filter, extend) {
  111. return await spider.category(tid, pg, filter, extend)
  112. }
  113. async function detail(id) {
  114. return await spider.detail(id)
  115. }
  116. async function play(flag, id, flags) {
  117. return await spider.play(flag, id, flags)
  118. }
  119. async function search(wd, quick) {
  120. return await spider.search(wd, quick)
  121. }
  122. export function __jsEvalReturn() {
  123. return {
  124. init: init,
  125. home: home,
  126. homeVod: homeVod,
  127. category: category,
  128. detail: detail,
  129. play: play,
  130. search: search,
  131. };
  132. }
  133. export {spider}