testVideo.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { __jsEvalReturn } from './kunyu77_open.js';
  2. var spider = __jsEvalReturn();
  3. function jsonParse(obj) {
  4. if (typeof obj === 'string') {
  5. return JSON.parse(obj);
  6. }
  7. return obj;
  8. }
  9. async function test() {
  10. var spType = null;
  11. var spVid = null;
  12. spType = '2';
  13. // spVid = '95873';
  14. await spider.init({ skey: 'siteKey', ext: '' });
  15. var classes = jsonParse(await spider.home(true));
  16. console.log(classes);
  17. var homeVod = jsonParse(await spider.homeVod());
  18. console.log(homeVod);
  19. if (classes.class && classes.class.length > 0) {
  20. var page = jsonParse(await spider.category(spType || classes.class[0].type_id, 0, undefined, {}));
  21. console.log(page);
  22. if (page.list && page.list.length > 0) {
  23. for (const k in page.list) {
  24. if (k >= 5) break;
  25. var detail = jsonParse(await spider.detail(spVid || page.list[k].vod_id));
  26. console.log(detail);
  27. if (detail.list && detail.list.length > 0) {
  28. var pFlag = detail.list[0].vod_play_from.split('$$$');
  29. var pUrls = detail.list[0].vod_play_url.split('$$$');
  30. if (pFlag.length > 0 && pUrls.length > 0) {
  31. for (const i in pFlag) {
  32. var flag = pFlag[i];
  33. var urls = pUrls[i].split('#');
  34. if (urls.length > 0) {
  35. var url = urls[0].split('$')[1];
  36. console.log(flag, url);
  37. var playUrl = await spider.play(flag, url, []);
  38. console.log(playUrl);
  39. }
  40. }
  41. }
  42. }
  43. if (spVid) break;
  44. }
  45. }
  46. }
  47. var search = jsonParse(await spider.search('奥特曼'));
  48. console.log(search);
  49. search = jsonParse(await spider.search('喜欢'));
  50. console.log(search);
  51. }
  52. export { test };