Guest User

Fix BitChute Video play Bug

a guest
Dec 14th, 2020
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name     Fix BitChute Video play Bug
  3. // @author   nilk || https://bitchute.com/nilk
  4. // @version  1.0
  5. // @grant    none
  6. // @include  *://*.bitchute.com/video/*
  7. // ==/UserScript==
  8.  
  9. //If a video doesn't play, reload the page and the fix will be applied.
  10.  
  11. var videoTag = document.querySelector('video');
  12. var srcTag = videoTag.firstElementChild;
  13. var link = srcTag.src;
  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, 305, 306, 'xvj21'];
  17.  
  18. const regx = /https:\/\/([^"'.]*[^"'.]*).*?(?=.|$)/g;
  19.  
  20. errorHandler();
  21.  
  22. function errorHandler(){
  23.   srcTag.remove();
  24.   seedArray.forEach(seed => addSrc(seed));
  25.   videoTag.appendChild(srcTag);
  26.   videoTag.load();
  27.   videoTag.play();
  28. }
  29.  
  30. function addSrc(seed){
  31.   let url = 'https://seed' + seed + link.replace(regx, '');
  32.   let source = document.createElement('source');
  33.   source.setAttribute('src', url);
  34.   source.setAttribute('type', 'video/mp4');
  35.   videoTag.appendChild(source);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment