虾米.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // http://localhost:5757/parse/虾米?url=https://v.qq.com/x/cover/mzc00200vkqr54u/v4100qp69zl.html
  2. // https://jx.xmflv.com/?url=https://v.qq.com/x/cover/mzc00200qon7vo3/b4100sccuyb.html
  3. const {getHtml} = $.require('./_lib.request.js')
  4. const jx = {
  5. header: {
  6. 'User-Agent': PC_UA,
  7. 'Referer': 'https://jx.xmflv.com'
  8. },
  9. };
  10. async function lazy(input, params) {
  11. console.log('input:', input);
  12. const t = Date.now()
  13. const a = CryptoJS.MD5(t + encodeURIComponent(input)).toString()
  14. const sign = function (a) {
  15. const b = CryptoJS.MD5(a);
  16. const c = CryptoJS.enc.Utf8.parse(b);
  17. const d = CryptoJS.enc.Utf8.parse('3cccf88181408f19');
  18. return CryptoJS.AES.encrypt(a, c, {
  19. iv: d,
  20. mode: CryptoJS.mode.CBC,
  21. padding: CryptoJS.pad.ZeroPadding
  22. }).toString()
  23. };
  24. let ua = randomUa.generateUa();
  25. let reqs = (await getHtml({
  26. url: "https://122.228.8.29:4433/xmflv.js",
  27. method: 'POST',
  28. headers: {'User-Agent': ua, 'Origin': 'https://jx.xmflv.com'},
  29. data: qs.stringify({
  30. 'wap': '',
  31. 'url': encodeURIComponent(input),
  32. 'time': t,
  33. 'key': sign(a)
  34. }),
  35. })).data;
  36. let key = reqs.aes_key
  37. let iv = reqs.aes_iv
  38. let play_url = reqs.url
  39. // let m3u8 = (await axios.request({
  40. // url:m3u8_url
  41. // })).data
  42. return {
  43. url: decrypt(play_url, key, iv),
  44. header: {
  45. 'origin': 'https://jx.xmflv.cc/',
  46. // 'Origin': 'https://jx.xmflv.com',
  47. 'User-Agent': ua,
  48. }
  49. }
  50. }
  51. function decrypt(text, aes_key, aes_iv) {
  52. let key = CryptoJS.enc.Utf8.parse(aes_key),
  53. iv = CryptoJS.enc.Utf8.parse(aes_iv),
  54. decrypted = CryptoJS.AES.decrypt(text, key, {
  55. iv: iv,
  56. mode: CryptoJS.mode.CBC,
  57. padding: CryptoJS.pad.Pkcs7
  58. });
  59. return decrypted.toString(CryptoJS.enc.Utf8);
  60. }