video.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. const API = require("./API");
  2. var api = API(cookie);
  3. module.exports = {
  4. type: 'video',
  5. async beforeCreate() {
  6. getCookie()
  7. api = API(cookie)
  8. },
  9. async fetch({args, page}) {
  10. var options = []
  11. await api.getVideoByURL(args.oid).then(res => {
  12. var info = res.data.data.Component_Play_Playinfo
  13. for (key in info.urls) {
  14. options.push({
  15. title: key,
  16. url: `https:${info.urls[key]}`
  17. })
  18. }
  19. }).catch(err => {
  20. $ui.alert("未知错误!!有可能是Cookie失效了")
  21. })
  22. this.url = options[0].url
  23. return {
  24. url: options[0].url,
  25. selectors: [
  26. {
  27. title: "清晰度",
  28. select: 0,
  29. onSelect: async (option) => {
  30. this.url = option.url
  31. },
  32. options: options
  33. }
  34. ]
  35. }
  36. }
  37. }