xgcartoon.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * @Author: jadehh
  3. * @Date: 2024-06-21 15:47:27
  4. * @LastEditTime: 2024-06-21 16:20:30
  5. * @LastEditors: jadehh
  6. * @Description:
  7. * @FilePath: \TVSpider\js\xgcartoon.js
  8. * @
  9. */
  10. import * as Utils from "../lib/utils.js";
  11. import {_, load} from "../lib/cat.js";
  12. import {VodDetail, VodShort} from "../lib/vod.js";
  13. import {Spider} from "./spider.js";
  14. class XGCartoonSpider extends Spider {
  15. constructor() {
  16. super();
  17. this.siteUrl = "https://cn.xgcartoon.com/"
  18. this.nextObj = {}
  19. }
  20. getName() {
  21. return `🍉┃西瓜卡通┃🍉`
  22. }
  23. getAppName() {
  24. return "西瓜卡通"
  25. }
  26. getJSName() {
  27. return "xgcartoon"
  28. }
  29. getType() {
  30. return 3
  31. }
  32. async setClasses() {
  33. let $ = await this.getHtml(this.siteUrl)
  34. let navElements = $('[class="index-tab"]').find("a")
  35. for (const navElement of navElements){
  36. let type_name = $(navElement).text()
  37. let type_id = navElement.attribs.href
  38. this.classes.push(this.getTypeDic(type_name,type_id))
  39. }
  40. let x = 0
  41. }
  42. async parseVodShortListFromJson(obj) {
  43. let vod_list = []
  44. for (const data of obj) {
  45. let vodShort = new VodShort()
  46. vodShort.vod_id = data["vodId"]
  47. vodShort.vod_name = data["vodName"]
  48. vodShort.vod_remarks = data["watchingCountDesc"]
  49. vodShort.vod_pic = data["coverImg"]
  50. vod_list.push(vodShort)
  51. }
  52. return vod_list
  53. }
  54. async parseVodDetailfromJson(obj) {
  55. let vodDetail = new VodDetail()
  56. return vodDetail
  57. }
  58. async setHomeVod() {
  59. }
  60. async setCategory(tid, pg, filter, extend) {
  61. }
  62. async setDetail(id) {
  63. }
  64. async setPlay(flag, id, flags) {
  65. }
  66. async setSearch(wd, quick) {
  67. }
  68. }
  69. let spider = new XGCartoonSpider()
  70. async function init(cfg) {
  71. await spider.init(cfg)
  72. }
  73. async function home(filter) {
  74. return await spider.home(filter)
  75. }
  76. async function homeVod() {
  77. return await spider.homeVod()
  78. }
  79. async function category(tid, pg, filter, extend) {
  80. return await spider.category(tid, pg, filter, extend)
  81. }
  82. async function detail(id) {
  83. return await spider.detail(id)
  84. }
  85. async function play(flag, id, flags) {
  86. return await spider.play(flag, id, flags)
  87. }
  88. async function search(wd, quick) {
  89. return await spider.search(wd, quick)
  90. }
  91. async function proxy(segments, headers) {
  92. return await spider.proxy(segments, headers)
  93. }
  94. export function __jsEvalReturn() {
  95. return {
  96. init: init,
  97. home: home,
  98. homeVod: homeVod,
  99. category: category,
  100. detail: detail,
  101. play: play,
  102. search: search,
  103. proxy: proxy
  104. };
  105. }
  106. export {spider}