dd_js.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const axios = require("axios");
  2. const CryptoJS = require("../assets/crypt");
  3. const cheerio = require('cheerio');
  4. async function getJson(url) {
  5. // var url = "https://ddrk.me/euphoria";
  6. var res = await axios.get(url, {
  7. headers: {
  8. 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
  9. }
  10. });
  11. var $ = cheerio.load(res.data);
  12. var json = $(".wp-playlist-script");
  13. // console.log(json.html())
  14. json = json.html().toString();
  15. json = JSON.parse(json);
  16. var tracks = json.tracks;
  17. var tt = tracks.map(t => {
  18. return {
  19. title: t.caption,
  20. src: t.src0
  21. }
  22. })
  23. console.log(tt);
  24. return tt;
  25. }
  26. module.exports = {
  27. type: 'list',
  28. title: '低端影视',
  29. async fetch({args}) {
  30. this.title = args.title;
  31. // var url = "https://ddrk.me/euphoria";
  32. var json = await getJson(args.url);
  33. var data = json.map(m => {
  34. return {
  35. spanCount: 6,
  36. title: m.title,
  37. route: $route('dd_video', {
  38. src: m.src,
  39. title: m.title
  40. })
  41. }
  42. })
  43. return data;
  44. }
  45. }