APPV2.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * 传参 ?type=url&params=http://122.228.85.203:1000@泽少1
  3. * 传参 ?type=url&params=http://122.228.85.203:1000@泽少2
  4. */
  5. var rule = {
  6. title: 'APPV2[模板]',
  7. author: '道长',
  8. version: '20241012 beta1',
  9. update_info: `
  10. 20241012:
  11. 1.根据群友嗷呜的appv2模板修改成可传参源,类似采集之王用法传参
  12. `.trim(),
  13. host: '',
  14. url: '/api.php/app/video?tid=fyclassfyfilter&limit=20&pg=fypage',
  15. filter_url: '',
  16. filter: {},
  17. homeUrl: '/api.php/app/index_video',
  18. detailUrl: '/api.php/app/video_detail?id=fyid',
  19. searchUrl: '/api.php/app/search?text=**&pg=fypage',
  20. parseUrl: '',
  21. searchable: 2,
  22. quickSearch: 1,
  23. filterable: 1,
  24. headers: {
  25. 'User-Agent': 'okhttp/4.1.0'
  26. },
  27. params: 'http://122.228.85.203:1000$http://122.228.85.203:1000/play?url=',
  28. hostJs: $js.toString(() => {
  29. HOST = rule.params.split('$')[0];
  30. }),
  31. 预处理: $js.toString(() => {
  32. log(`传入参数:${rule.params}`);
  33. let _host = rule.params.split('$')[0];
  34. rule.parseUrl = rule.params.split('$')[1];
  35. let _url = _host.rstrip('/') + '/api.php/app/nav?token';
  36. let _headers = {'User-Agent': 'Dart/2.14 (dart:io)'};
  37. let html = request(_url, {headers: _headers});
  38. let data = JSON.parse(html);
  39. let _classes = [];
  40. let _filter = {};
  41. let _filter_url = '';
  42. let dy = {"class": "类型", "area": "地区", "lang": "语言", "year": "年份", "letter": "字母", "by": "排序"};
  43. let jsonData = data.list;
  44. for (let k = 0; k < jsonData.length; k++) {
  45. let hasNonEmptyField = false;
  46. let _obj = {
  47. type_name: jsonData[k].type_name,
  48. type_id: jsonData[k].type_id,
  49. };
  50. _classes.push(_obj);
  51. for (let key in dy) {
  52. if (key in jsonData[k].type_extend && jsonData[k].type_extend[key].trim() !== "") {
  53. hasNonEmptyField = true;
  54. break
  55. }
  56. }
  57. if (hasNonEmptyField) {
  58. _filter[String(jsonData[k].type_id)] = [];
  59. for (let dkey in jsonData[k].type_extend) {
  60. if (dkey in dy && jsonData[k].type_extend[dkey].trim() !== "") {
  61. if (k === 0) {
  62. _filter_url += `&${dkey}={{fl.${dkey}}}`
  63. }
  64. let values = jsonData[k].type_extend[dkey].split(',');
  65. let valueArray = values.map(value => ({"n": value.trim(), "v": value.trim()}));
  66. _filter[String(jsonData[k].type_id)].push({"key": dkey, "name": dy[dkey], "value": valueArray})
  67. }
  68. }
  69. }
  70. }
  71. rule.classes = _classes;
  72. rule.filter = _filter;
  73. rule.filter_url = _filter_url;
  74. }),
  75. class_parse: $js.toString(() => {
  76. input = rule.classes;
  77. }),
  78. play_parse: true,
  79. lazy: $js.toString(() => {
  80. if (!/^http/.test(input)) {
  81. input = rule.parseUrl + input
  82. } else {
  83. input = {
  84. url: input,
  85. parse: 0,
  86. header: ''
  87. }
  88. }
  89. }),
  90. 推荐: $js.toString(() => {
  91. let data = JSON.parse(request(input)).list;
  92. let com = [];
  93. data.forEach(item => {
  94. if (Array.isArray(item.vlist) && item.vlist.length !== 0) {
  95. com = com.concat(item.vlist)
  96. }
  97. })
  98. VODS = com
  99. }),
  100. 一级: $js.toString(() => {
  101. VODS = JSON.parse(request(input)).list
  102. }),
  103. 二级: $js.toString(() => {
  104. VOD = JSON.parse(request(input)).data
  105. }),
  106. 搜索: '*',
  107. }