lovemovie18.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * @File : lovemovie18.js
  3. * @Author : jade
  4. * @Date : 2024/4/29 09:36
  5. * @Email : jadehh@1ive.com
  6. * @Software : Samples
  7. * @Desc : 爱情电影网
  8. */
  9. import {LoveMovieSpider} from "./lovemovie.js";
  10. import {VodShort} from "../lib/vod.js";
  11. class LoveMovie18Spider extends LoveMovieSpider {
  12. constructor() {
  13. super();
  14. this.siteUrl = "https://b.aqdyje.com"
  15. this.removeKey = "骑兵营"
  16. }
  17. getName() {
  18. return "🔞┃爱情电影网18+┃🔞"
  19. }
  20. getAppName() {
  21. return "爱情电影网18+"
  22. }
  23. getJSName() {
  24. return "lovemovie18"
  25. }
  26. getType() {
  27. return 3
  28. }
  29. async parseVodShortListFromDocBySearch($) {
  30. let vodElements = $("[class=\"show-list\"]").find("li")
  31. let vod_list = []
  32. for (const vodElement of vodElements) {
  33. let vodShort = new VodShort()
  34. vodShort.vod_id = $(vodElement).find("a")[0].attribs.href
  35. let imgElement = $(vodElement).find("img")[0]
  36. vodShort.vod_pic = imgElement.attribs.src
  37. vodShort.vod_name = imgElement.attribs.alt
  38. vodShort.vod_remarks = $($(vodElement).find("[class=\"type fn-left\"]")).text().replace("类型:", "")
  39. if (vodShort.vod_remarks === "社处片" || vodShort.vod_remarks === "社保片" || vodShort.vod_remarks === "撸丝片" || vodShort.vod_remarks === "撸丝动漫") {
  40. vod_list.push(vodShort)
  41. }
  42. }
  43. return vod_list
  44. }
  45. async getFilter(type_id) {
  46. let $ = await this.getHtml(this.siteUrl + type_id)
  47. let extend_list = []
  48. let extend_dic = {"key": "class", "name": "类型", "value": []}
  49. for (const navElement of $("[class=\"subnav-tv fn-left\"]").find("a")) {
  50. let type_name = $(navElement).text()
  51. let type_id = navElement.attribs.href
  52. extend_dic["value"].push(this.getFliterDic(type_name, type_id))
  53. }
  54. if (extend_dic["value"].length > 1) {
  55. extend_list.push(extend_dic)
  56. }
  57. return extend_list
  58. }
  59. async setClasses() {
  60. let $ = await this.getHtml()
  61. let navElements = $("[class=\"nav-item drop-down \"]")
  62. this.classes = []
  63. for (const navElement of navElements) {
  64. let element = $(navElement).find("a")[0]
  65. let type_name = $(element).text()
  66. let type_id = element.attribs.href
  67. if (type_name === this.removeKey) {
  68. this.classes.push(this.getTypeDic(type_name, type_id))
  69. this.filterObj[type_id] = await this.getFilter(type_id)
  70. }
  71. }
  72. }
  73. async setCategory(tid, pg, filter, extend) {
  74. let classes = this.getExtend(extend) ?? tid
  75. let url
  76. if (parseInt(pg) === 1) {
  77. url = this.siteUrl + classes
  78. } else {
  79. url = this.siteUrl + classes + `index${pg}.html`
  80. }
  81. let $ = await this.getHtml(url)
  82. this.vodList = await this.parseVodShortListFromDoc($)
  83. }
  84. }
  85. let spider = new LoveMovie18Spider()
  86. async function init(cfg) {
  87. await spider.init(cfg)
  88. }
  89. async function home(filter) {
  90. return await spider.home(filter)
  91. }
  92. async function homeVod() {
  93. return await spider.homeVod()
  94. }
  95. async function category(tid, pg, filter, extend) {
  96. return await spider.category(tid, pg, filter, extend)
  97. }
  98. async function detail(id) {
  99. return await spider.detail(id)
  100. }
  101. async function play(flag, id, flags) {
  102. return await spider.play(flag, id, flags)
  103. }
  104. async function search(wd, quick) {
  105. return await spider.search(wd, quick)
  106. }
  107. export function __jsEvalReturn() {
  108. return {
  109. init: init, home: home, homeVod: homeVod, category: category, detail: detail, play: play, search: search,
  110. };
  111. }
  112. export {spider}