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.  
  39. console.log("StreamtapeDownloader");
  40.  
  41. function checkVideoSrc() {
  42. const mainVideo = document.querySelector('#mainvideo');
  43. const subheadingParent = document.querySelector('.subheading').parentNode;
  44.  
  45. if (mainVideo) {
  46. const videoSrc = mainVideo.src;
  47.  
  48. if (videoSrc) {
  49. console.log("Video source found:", videoSrc);
  50.  
  51. if (!document.getElementById('downloadsDiv')) {
  52. const downloadsDiv = document.createElement('div');
  53. //downloadsDiv.id = 'downloadsDiv';
  54. //downloadsDiv.style.border = '2px solid blue';
  55. //downloadsDiv.style.borderRadius = '7.5px';
  56. //downloadsDiv.style.marginTop = '10px';
  57.  
  58. const openInTabDiv = document.createElement('div');
  59. openInTabDiv.style.border = '2px solid blue';
  60. openInTabDiv.style.borderRadius = '7.5px';
  61. openInTabDiv.style.marginTop = '10px';
  62.  
  63. const downloadDiv = document.createElement('div');
  64. downloadDiv.style.border = '2px solid blue';
  65. downloadDiv.style.borderRadius = '7.5px';
  66. downloadDiv.style.marginTop = '10px';
  67.  
  68. const resolveDiv = document.createElement('div');
  69. resolveDiv.style.border = '2px solid blue';
  70. resolveDiv.style.borderRadius = '7.5px';
  71. resolveDiv.style.marginTop = '10px';
  72.  
  73. const openInTabButton = document.createElement('a');
  74. openInTabButton.innerText = 'Open in New Tab';
  75. openInTabButton.setAttribute('href', videoSrc);
  76. openInTabButton.setAttribute('target', '_blank');
  77. openInTabButton.style.display = 'block';
  78. openInTabButton.style.marginTop = '5px';
  79.  
  80. const downloadButton = document.createElement('a');
  81. downloadButton.innerText = 'Download';
  82. const downloadSrc = videoSrc;
  83. downloadButton.setAttribute('href', downloadSrc);
  84. downloadButton.setAttribute('download', '');
  85. downloadButton.style.display = 'block';
  86. downloadButton.style.marginTop = '5px';
  87.  
  88. const resolveButton = document.createElement('a');
  89. resolveButton.innerText = 'Click here to generate direct URL';
  90. resolveButton.style.display = 'block';
  91. resolveButton.style.marginTop = '5px';
  92.  
  93. // Function to resolve the final download URL
  94. resolveButton.addEventListener('click', async function(event) {
  95. event.preventDefault();
  96. try {
  97. const response = await fetch(videoSrc);
  98. if (response.ok) {
  99. const resolvedURL = response.url;
  100. window.open(resolvedURL, '_blank');
  101. resolveButton.setAttribute('href', resolvedURL);
  102. resolveButton.setAttribute('download', '');
  103. } else {
  104. console.error('Failed to resolve URL');
  105. }
  106. } catch (error) {
  107. console.error('Error resolving URL:', error);
  108. }
  109. });
  110.  
  111. openInTabDiv.appendChild(openInTabButton);
  112. downloadDiv.appendChild(downloadButton);
  113. resolveDiv.appendChild(resolveButton);
  114.  
  115. downloadsDiv.appendChild(openInTabDiv);
  116. downloadsDiv.appendChild(downloadDiv);
  117. downloadsDiv.appendChild(resolveDiv);
  118.  
  119. subheadingParent.appendChild(downloadsDiv);
  120.  
  121. // Stop the interval once buttons are created
  122. clearInterval(intervalId);
  123. } else {
  124. console.log("Buttons already exist. Skipping creation.");
  125. }
  126.  
  127. } else {
  128. console.log("Video source not found. Retrying...");
  129. }
  130. } else {
  131. console.log("Main video element not found. Retrying...");
  132. }
  133. }
  134.  
  135. // Initial check
  136. checkVideoSrc();
  137.  
  138. // Check every second until the buttons are created
  139. const intervalId = setInterval(checkVideoSrc, 1000);
  140.  
  141. console.log("StreamtapeDownloader script loaded.");