Guest User

Untitled

a guest
Aug 28th, 2024
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name     Fix BitChute not playing videos
  3. // @author   nilk || https://nilk.xyz
  4. // @version  2.0
  5. // @grant    none
  6. // @include  *://*.bitchute.com/api/*
  7. // ==/UserScript==
  8.  
  9. var videoTag = document.querySelector("video");
  10. if (!videoTag) return;
  11. videoTag.id = "pleaseDontChangeMySrc"; // prevent BitChute from modifying the video element
  12. var link = media_url;
  13.  
  14. //alternative seeds/subdomains //you can add some yourself, if these don't work
  15. var seedArray = [111, 118, 122, 124, 125, 126, 128, 129, 131, 132, 154, 191, 305, 306, 307, "xvj21", "p29xb"];
  16.  
  17. const regex = /https:\/\/([^"'.]*[^"'.]*).*?(?=.|$)/g;
  18.  
  19. errorHandler();
  20.  
  21. function errorHandler() {
  22.   addSrc(null, link);
  23.   seedArray.forEach((seed) => addSrc(seed));
  24.   videoTag.load();
  25.   videoTag.play();
  26. }
  27.  
  28. function addSrc(seed, originalUrl) {
  29.   let url = originalUrl || "https://seed" + seed + link.replace(regex, "");
  30.   let source = document.createElement("source");
  31.   source.setAttribute("src", url);
  32.   source.setAttribute("type", "video/mp4");
  33.   videoTag.appendChild(source);
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment