JavWan.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. const wan = {
  2. d: [],
  3. baseParse: () => {
  4. const html = getResCode()
  5. wan.listParse(html)
  6. setResult(wan.d)
  7. },
  8. listParse: (html) => {
  9. const list = pdfa(html, '#main&&a')
  10. list.forEach(item => {
  11. try {
  12. let title = pdfh(item, 'a&&span&&Text')
  13. let img = pdfh(item, '.post-list-image&&img&&src')
  14. wan.d.push({
  15. title: title,
  16. desc: pdfh(item, '.post-list-duration&&Text'),
  17. pic_url: img,
  18. url: $(pdfh(item, 'a&&href')+'#immersiveTheme#').rule((title, img) => {
  19. const wan = $.require('hiker://page/wan')
  20. wan.videoParse(title, img)
  21. setResult(wan.d)
  22. }, title, img),
  23. col_type: 'movie_2',
  24. })
  25. }catch(e){}
  26. })
  27. },
  28. videoParse: (title, img) => {
  29. setPageTitle(title)
  30. const html = getResCode()
  31. const info = pdfh(html, '#post-data&&Html')
  32. let url = 'hiker://empty'
  33. const player = pdfh(info, '#player-width&&Html')
  34. const iframe = player.match(/id="iframe"/)
  35. if (iframe) {
  36. let iframe_context = ''
  37. let iframe_src = ''
  38. let script = pdfh(player, 'script&&Html').replace('return p', 'iframe_context = p')
  39. eval(script)
  40. try {
  41. iframe_src = iframe_context.match(/src="(.*?)"/)[1]
  42. }catch(e){}
  43. if (iframe_src) {
  44. url = pdfh(fetch(iframe_src), 'meta[property="og:video:url"]&&content')
  45. }
  46. } else {
  47. let context = ''
  48. let script = pdfh(player, 'script,2&&Html').replace('return p', 'context = p')
  49. eval(script)
  50. try {
  51. url = context.match(/video.src='(.*?)';/)[1]
  52. }catch(e){}
  53. }
  54. wan.d.push({
  55. title: title,
  56. desc: pdfh(info, '.post-content&&Text'),
  57. pic_url: img,
  58. url: MY_URL,
  59. col_type: 'movie_1_vertical_pic_blur'
  60. })
  61. wan.d.push({
  62. col_type: 'line_blank'
  63. })
  64. wan.d.push({
  65. title: '播放',
  66. url: url,
  67. col_type: 'text_center_1',
  68. extra: {lineVisible: false},
  69. })
  70. wan.d.push({
  71. col_type: 'line_blank'
  72. })
  73. wan.listParse(html)
  74. },
  75. }
  76. $.exports = wan