🏠 返回首頁 

Greasy Fork is available in English.

Streamtape Direct Downloader

Streamtape Video Downloader with direct URL resolution


安装此脚本?
  1. // ==UserScript==
  2. // @name Streamtape Direct Downloader
  3. // @namespace StreamtapeDownloader
  4. // @version 1.0
  5. // @author sharmanhall
  6. // @description Streamtape Video Downloader with direct URL resolution
  7. // @match *://streamtape.com/*
  8. // @match *://streamtape.xyz/*
  9. // @match *://streamtape.to/*
  10. // @match *://streamtape.net/*
  11. // @match *://streamtape.site/*
  12. // @match *://streamtape.cc/*
  13. // @match *://tapecontent.net/*
  14. // @match *://streamadblockplus.com/*
  15. // @match *://streamta.pe/*
  16. // @match *://strtape.cloud/*
  17. // @match *://strtape.site/*
  18. // @match *://strtapeadblock.club/*
  19. // @match *://strcloud.link/*
  20. // @match *://strcloud.club/*
  21. // @match *://strcloud.in/*
  22. // @match *://tapeadsenjoyer.com/*
  23. // @match *://gettapeads.com/*
  24. // @match *://streamtape.com/*
  25. // @match *://tapelovesads.org/*
  26. // @match https://streamtape.com/*
  27. // @match https://streamadblocker.xyz/*
  28. // @match https://*.tapecontent.net/*
  29. // @icon https://www.google.com/s2/favicons?sz=64&domain=streamtape.com
  30. // @grant none
  31. // @license MIT
  32. // @compatible chrome
  33. // @compatible edge
  34. // @compatible firefox
  35. // @compatible opera
  36. // @compatible safari
  37. // ==/UserScript==
  38. console.log("StreamtapeDownloader");
  39. function checkVideoSrc() {
  40. const mainVideo = document.querySelector('#mainvideo');
  41. const subheadingParent = document.querySelector('.subheading').parentNode;
  42. if (mainVideo) {
  43. const videoSrc = mainVideo.src;
  44. if (videoSrc) {
  45. console.log("Video source found:", videoSrc);
  46. if (!document.getElementById('downloadsDiv')) {
  47. const downloadsDiv = document.createElement('div');
  48. //downloadsDiv.id = 'downloadsDiv';
  49. //downloadsDiv.style.border = '2px solid blue';
  50. //downloadsDiv.style.borderRadius = '7.5px';
  51. //downloadsDiv.style.marginTop = '10px';
  52. const openInTabDiv = document.createElement('div');
  53. openInTabDiv.style.border = '2px solid blue';
  54. openInTabDiv.style.borderRadius = '7.5px';
  55. openInTabDiv.style.marginTop = '10px';
  56. const downloadDiv = document.createElement('div');
  57. downloadDiv.style.border = '2px solid blue';
  58. downloadDiv.style.borderRadius = '7.5px';
  59. downloadDiv.style.marginTop = '10px';
  60. const resolveDiv = document.createElement('div');
  61. resolveDiv.style.border = '2px solid blue';
  62. resolveDiv.style.borderRadius = '7.5px';
  63. resolveDiv.style.marginTop = '10px';
  64. const openInTabButton = document.createElement('a');
  65. openInTabButton.innerText = 'Open in New Tab';
  66. openInTabButton.setAttribute('href', videoSrc);
  67. openInTabButton.setAttribute('target', '_blank');
  68. openInTabButton.style.display = 'block';
  69. openInTabButton.style.marginTop = '5px';
  70. const downloadButton = document.createElement('a');
  71. downloadButton.innerText = 'Download';
  72. const downloadSrc = videoSrc;
  73. downloadButton.setAttribute('href', downloadSrc);
  74. downloadButton.setAttribute('download', '');
  75. downloadButton.style.display = 'block';
  76. downloadButton.style.marginTop = '5px';
  77. const resolveButton = document.createElement('a');
  78. resolveButton.innerText = 'Click here to generate direct URL';
  79. resolveButton.style.display = 'block';
  80. resolveButton.style.marginTop = '5px';
  81. // Function to resolve the final download URL
  82. resolveButton.addEventListener('click', async function(event) {
  83. event.preventDefault();
  84. try {
  85. const response = await fetch(videoSrc);
  86. if (response.ok) {
  87. const resolvedURL = response.url;
  88. window.open(resolvedURL, '_blank');
  89. resolveButton.setAttribute('href', resolvedURL);
  90. resolveButton.setAttribute('download', '');
  91. } else {
  92. console.error('Failed to resolve URL');
  93. }
  94. } catch (error) {
  95. console.error('Error resolving URL:', error);
  96. }
  97. });
  98. openInTabDiv.appendChild(openInTabButton);
  99. downloadDiv.appendChild(downloadButton);
  100. resolveDiv.appendChild(resolveButton);
  101. downloadsDiv.appendChild(openInTabDiv);
  102. downloadsDiv.appendChild(downloadDiv);
  103. downloadsDiv.appendChild(resolveDiv);
  104. subheadingParent.appendChild(downloadsDiv);
  105. // Stop the interval once buttons are created
  106. clearInterval(intervalId);
  107. } else {
  108. console.log("Buttons already exist. Skipping creation.");
  109. }
  110. } else {
  111. console.log("Video source not found. Retrying...");
  112. }
  113. } else {
  114. console.log("Main video element not found. Retrying...");
  115. }
  116. }
  117. // Initial check
  118. checkVideoSrc();
  119. // Check every second until the buttons are created
  120. const intervalId = setInterval(checkVideoSrc, 1000);
  121. console.log("StreamtapeDownloader script loaded.");