assAdd

给盗版vip视频解析网站加上b站bilibili的(ass格式)弹幕,腾讯视频等网站下载下来的ass文件同理也可以

  1. // ==UserScript==
  2. // @name assAdd
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-07-04
  5. // @description 给盗版vip视频解析网站加上b站bilibili的(ass格式)弹幕,腾讯视频等网站下载下来的ass文件同理也可以
  6. // @author You
  7. // @match https://www.imandaow.com/*
  8. // @require https://update.greasyfork.org/scripts/507156/1442599/JavascriptSubtitlesOctopus_cdnjs.js
  9. // @require https://update.greasyfork.org/scripts/507157/1442600/subtitles-octopus.js
  10. // @require https://unpkg.com/sweetalert/dist/sweetalert.min.js
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14.  
  15. function addStyle(css) {
  16. // 添加样式
  17. const style = document.createElement('style');
  18. style.type = 'text/css';
  19. style.innerHTML = css
  20. document.head.appendChild(style);
  21. }
  22.  
  23. let css = `
  24. #myTextarea {
  25. width: 100%;
  26. height: 200px; /* 可以根据需要调整 */
  27. border: 1px solid #ccc;
  28. border-radius: 5px;
  29. padding: 5px;
  30. resize: vertical; /* 允许垂直调整大小 */
  31. margin-bottom: 10px; /* 添加底部外边距 */
  32. }
  33. `;
  34. addStyle(css)
  35.  
  36. let assContent = "";
  37. let options_video = document.querySelector("video");
  38.  
  39. setTimeout(() => {
  40. if(options_video === null) return;
  41.  
  42. // 创建textarea
  43. const textarea = document.createElement('textarea');
  44. textarea.id = 'myTextarea';
  45. textarea.placeholder = '粘贴进ass文件内容';
  46. swal("粘贴", {
  47. content: textarea,
  48. buttons: {
  49. confirm: {
  50. /*
  51. * We need to initialize the value of the button to
  52. * an empty string instead of "true":
  53. */
  54. value: "",
  55. },
  56. },
  57. closeOnClickOutside: false,
  58. })
  59. .then((value) => {
  60. debugger
  61. assContent = document.querySelector('#myTextarea').value;
  62.  
  63. window.SubtitlesOctopusOnLoad = function () {
  64. var options = {
  65. video: options_video,
  66. subContent: assContent,
  67. // fonts: ['https://raw.githubusercontent.com/freemedom/ass/main/NotoSansSC-Regular.otf',"https://raw.githubusercontent.com/freemedom/ass/main/MicrosoftYaHeiUI-Bold.ttf"],
  68. // availableFonts: {"microsoft yahei ui": "https://raw.githubusercontent.com/freemedom/ass/main/MicrosoftYaHeiUI-Bold.ttf"}, // key需要改为小写
  69. //onReady: onReadyFunction,
  70. fallbackFont: 'https://raw.githubusercontent.com/freemedom/ass/main/NotoSansSC-Regular.otf', // 艹 ass文件里的Fontname跟这里的ttf otf文件的字体名根本不用一样,只要是个有汉字的字体就行(默认字体是不行的) 枉我调试了半天fonts和availableFonts的代码逻辑
  71. // fallbackFont: 'https://raw.githubusercontent.com/freemedom/ass/main/MicrosoftYaHeiUI-Bold.ttf', // 没修改之前实际是这里起作用 // 艹 搞了半天好像不是字体的问题,是ass文件里边其它地方有问题 // 艹 这ass文件下载下来Tex少了个t,坑了我一个小时
  72. debug: true,
  73. workerUrl: URL.createObjectURL(new Blob(["(" + worker_function.toString() + ")()"], {
  74. type: 'text/javascript'
  75. }))
  76. };
  77. window.octopusInstance = new SubtitlesOctopus(options); // You can experiment in console
  78. };
  79.  
  80. if (SubtitlesOctopus) {
  81. SubtitlesOctopusOnLoad();
  82. }
  83. });
  84. }, 5000);
  85.  
  86.  
  87.  
  88.  
  89.