JavTree.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. const baseParse = _ => {
  2. let d = [];
  3. const [empty, page] = MY_URL.split('##')
  4. const className = getMyVar('JavTree.tyrantgenesis.className', 'last')
  5. let url = getMyVar('JavTree.tyrantgenesis.url', 'https://javtree.com/last.html')
  6. url = url.replace('.html', '-'+page+'.html')
  7. if (parseInt(page) === 1) {
  8. d.push(
  9. {
  10. title: className === 'last' ? '““””<b><span style="color: #1cb96f">最新更新</span></b>' : '最新更新',
  11. url: $(empty).lazyRule(() => {
  12. putMyVar('JavTree.tyrantgenesis.className', 'last')
  13. putMyVar('JavTree.tyrantgenesis.url', 'https://javtree.com/last.html')
  14. refreshPage(true)
  15. return "hiker://empty"
  16. }),
  17. col_type: 'scroll_button',
  18. },
  19. {
  20. title: className === 'category' ? '““””<b><span style="color: #1cb96f">主題選片</span></b>' : '主題選片',
  21. url: $(empty).lazyRule(() => {
  22. putMyVar('JavTree.tyrantgenesis.className', 'category')
  23. putMyVar('JavTree.tyrantgenesis.url', 'https://javtree.com/last.html')
  24. refreshPage(false)
  25. return "hiker://empty"
  26. }),
  27. col_type: 'scroll_button',
  28. },
  29. {
  30. col_type:"blank_block"
  31. },
  32. )
  33. if (className === 'category') {
  34. const tags_html = fetch('https://javtree.com/tags.html')
  35. const tags = pdfa(tags_html, '.gm-main&&.gm-genre')
  36. tags.forEach(tag => {
  37. let list = pdfa(tag, '.list&&li')
  38. d.push({
  39. title: pdfh(tag, '.title&&Text')+':',
  40. url: empty,
  41. col_type: 'scroll_button',
  42. })
  43. list.forEach(item => {
  44. let url = 'https://javtree.com'+pdfh(item, 'a&&href')
  45. d.push({
  46. title: pdfh(item, 'a&&Text').replace('#', ''),
  47. url: $(url).lazyRule(() => {
  48. putMyVar('JavTree.tyrantgenesis.className', 'category')
  49. putMyVar('JavTree.tyrantgenesis.url', input)
  50. refreshPage(true)
  51. return "hiker://empty"
  52. }),
  53. col_type: 'scroll_button',
  54. })
  55. })
  56. d.push({
  57. col_type:"blank_block"
  58. })
  59. })
  60. }
  61. }
  62. const html = fetch(url)
  63. const list = pdfa(html, '.gm-list&&.item')
  64. list.forEach(item => {
  65. let pic_url = pdfh(item, 'img&&data-src')
  66. let url = 'https://javtree.com'+pdfh(item, '.title&&href')
  67. d.push({
  68. title: pdfh(item, '.info&&.title&&Text'),
  69. desc: pdfh(item, '.volume&&Text'),
  70. pic_url: pic_url.startsWith('http') ? pic_url : 'https:'+pic_url,
  71. url: $(url).lazyRule(() => {
  72. const html = fetch(input)
  73. const video_source_json = html.match(/var post = (.*?);/)[1]
  74. const video_source = JSON.parse(video_source_json).vods
  75. return JSON.stringify({urls: video_source.map(item => item.source), names: video_source.map(item => item.name)})
  76. }),
  77. col_type: 'movie_2',
  78. })
  79. })
  80. setResult(d);
  81. }