Guest User

Untitled

a guest
Aug 28th, 2024
44
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.1
  5. // @grant    none
  6. // @include  *://*.bitchute.com/api/*
  7. // ==/UserScript==
  8.  
  9. var videoTag = document.querySelector("video");
  10. if (!videoTag) return;
  11.  
  12. const windowOnload = window.onload;
  13. var link = media_url;
  14.  
  15. //alternative seeds/subdomains //you can add some yourself, if these don't work
  16. var seedArray = [111, 118, 122, 124, 125, 126, 128, 129, 131, 132, 154, 191, 305, 306, 307, "xvj21", "p29xb"];
  17.  
  18. const regex = /https:\/\/([^"'.]*[^"'.]*).*?(?=.|$)/g;
  19.  
  20. errorHandler();
  21.  
  22. function errorHandler() {
  23.   addSrc(null, link);
  24.   seedArray.forEach((seed) => addSrc(seed));
  25.   videoTag.load();
  26.   videoTag.play().then(() => {
  27.     videoTag.pause();
  28.     media_url = videoTag.currentSrc;
  29.     windowOnload();
  30.   });
  31. }
  32.  
  33. function addSrc(seed, originalUrl) {
  34.   let url = originalUrl || "https://seed" + seed + link.replace(regex, "");
  35.   let source = document.createElement("source");
  36.   source.setAttribute("src", url);
  37.   source.setAttribute("type", "video/mp4");
  38.   videoTag.appendChild(source);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment