ubestkid_open.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // 无搜索功能
  2. import { _ } from './lib/cat.js';
  3. let key = '🐯贝乐虎';
  4. let HOST = 'https://vd.ubestkid.com';
  5. let siteKey = '';
  6. let siteType = 0;
  7. const MOBILE_UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
  8. async function request(reqUrl, referer, mth, data, hd) {
  9. const headers = {
  10. "User-Agent": MOBILE_UA,
  11. };
  12. if (referer) headers.referer = encodeURIComponent(referer);
  13. let res = await req(reqUrl, {
  14. method: mth || "get",
  15. headers: headers,
  16. data: data,
  17. postType: mth === "post" ? "json" : "",
  18. });
  19. return res.content;
  20. }
  21. async function init(cfg) {
  22. siteKey = cfg.skey;
  23. siteType = cfg.stype
  24. }
  25. async function home(filter) {
  26. const classes = [{ type_id: 65, type_name: '🐯最新上架' }, { type_id: 113, type_name: '🐯人气热播' }, { type_id: 56, type_name: '🐯经典童谣' }, { type_id: 137, type_name: '🐯开心贝乐虎' }, { type_id: 53, type_name: '🐯律动儿歌' }, { type_id: 59, type_name: '🐯经典儿歌' }, { type_id: 101, type_name: '🐯超级汽车1' }, { type_id: 119, type_name: '🐯超级汽车第二季' }, { type_id: 136, type_name: '🐯超级汽车第三季' }, { type_id: 95, type_name: '🐯三字经' }, { type_id: 133, type_name: '🐯幼儿手势舞' }, { type_id: 117, type_name: '🐯哄睡儿歌' }, { type_id: 70, type_name: '🐯英文儿歌' }, { type_id: 116, type_name: '🐯节日与节气' }, { type_id: 97, type_name: '🐯恐龙世界' }, { type_id: 55, type_name: '🐯动画片儿歌' }, { type_id: 57, type_name: '🐯流行歌曲' }, { type_id: 118, type_name: '🐯贝乐虎入园记' }, { type_id: 106, type_name: '🐯贝乐虎大百科' }, { type_id: 62, type_name: '🐯经典古诗' }, { type_id: 63, type_name: '🐯经典故事' }, { type_id: 128, type_name: '🐯萌虎学功夫' }, { type_id: 100, type_name: '🐯绘本故事' }, { type_id: 121, type_name: '🐯开心贝乐虎英文版' }, { type_id: 96, type_name: '🐯嗨贝乐虎情商动画' }, { type_id: 108, type_name: '🐯动物音乐派对' }, { type_id: 126, type_name: '🐯动物音乐派对英文版' }, { type_id: 105, type_name: '🐯奇妙的身体' }, { type_id: 124, type_name: '🐯奇妙的身体英文版' }, { type_id: 64, type_name: '🐯认知卡片' }, { type_id: 109, type_name: '🐯趣味简笔画' }, { type_id: 78, type_name: '🐯数字儿歌' }, { type_id: 120, type_name: '🐯识字体验版' }, { type_id: 127, type_name: '🐯启蒙系列体验版' }];
  27. const filterObj = {};
  28. return JSON.stringify({
  29. class: _.map(classes, (cls) => {
  30. cls.land = 1;
  31. cls.ratio = 1.78;
  32. return cls;
  33. }),
  34. filters: filterObj,
  35. })
  36. }
  37. async function homeVod() {
  38. const link = HOST + "/api/v1/bv/video";
  39. const pdata = { age: 1, appver: "6.1.9", egvip_status: 0, svip_status: 0, vps: 60, subcateId: 56, "p": 1 };
  40. const jo = JSON.parse(await request(link, "", "post", pdata)).result;
  41. const videos = [];
  42. _.each(jo.items, (it) => {
  43. videos.push({
  44. vod_id: it.url,
  45. vod_name: it.title,
  46. vod_pic: it.image,
  47. vod_remarks: '👀' + it.viewcount || '',
  48. })
  49. });
  50. return JSON.stringify({
  51. list: videos,
  52. })
  53. }
  54. async function category(tid, pg, filter, extend) {
  55. if (pg <= 0 || typeof pg == 'undefined') pg = 1;
  56. const link = HOST + "/api/v1/bv/video";
  57. const pdata = { age: 1, appver: "6.1.9", egvip_status: 0, svip_status: 0, vps: 60, subcateId: tid, "p": pg };
  58. const jo = JSON.parse(await request(link, "", "post", pdata)).result;
  59. const videos = [];
  60. _.each(jo.items, (it) => {
  61. videos.push({
  62. vod_id: it.url,
  63. vod_name: it.title,
  64. vod_pic: it.image,
  65. vod_remarks: '👀' + it.viewcount || '',
  66. })
  67. });
  68. const pgCount = pg * 60 > jo.total ? parseInt(pg) : parseInt(pg) + 1;
  69. return JSON.stringify({
  70. page: parseInt(pg),
  71. pagecount: pgCount,
  72. limit: 60,
  73. total: jo.total,
  74. list: videos,
  75. })
  76. }
  77. async function detail(id) {
  78. const vod = {
  79. vod_id: id,
  80. vod_remarks: '',
  81. };
  82. const playlist = ['点击播放' + '$' + id];
  83. vod.vod_play_from = "道长在线";
  84. vod.vod_play_url = playlist.join('#');
  85. return JSON.stringify({
  86. list: [vod],
  87. });
  88. }
  89. async function play(flag, id, flags) {
  90. // console.debug('贝乐虎 id =====>' + id); // js_debug.log
  91. return JSON.stringify({
  92. parse: 0,
  93. url: id,
  94. });
  95. }
  96. async function search(wd, quick) {
  97. return '{}'
  98. }
  99. export function __jsEvalReturn() {
  100. return {
  101. init: init,
  102. home: home,
  103. homeVod: homeVod,
  104. category: category,
  105. detail: detail,
  106. play: play,
  107. search: search,
  108. }
  109. }