thisVID.com Native Player (HTML5) and download

Replace video player with HTML5 native player (also enables download of videos)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name thisVID.com Native Player (HTML5) and download
  3. // @namespace _pc
  4. // @version 2.1
  5. // @license MIT
  6. // @description Replace video player with HTML5 native player (also enables download of videos)
  7. // @author verydelight
  8. // @match *://thisvid.com/videos/*
  9. // @icon https://www.thisvid.com/favicon.ico
  10. // @compatible Firefox Tampermonkey
  11. // @grant none
  12. // ==/UserScript==
  13. (function() {
  14. 'use strict';
  15. function insertVideo() {
  16. const videoElement = document.querySelector('video.fp-engine');
  17. if (!videoElement) return;
  18. const videoUrl = videoElement.src;
  19. const posterUrl = document.querySelector('.video-holder img').src;
  20. const newVideoElement = document.createElement('video');
  21. newVideoElement.poster = posterUrl;
  22. newVideoElement.src = videoUrl;
  23. newVideoElement.controls = true;
  24. newVideoElement.style.width = '100%';
  25. const videoHolder = document.querySelector('.video-holder');
  26. if (videoHolder) {
  27. videoHolder.innerHTML = '';
  28. videoHolder.appendChild(newVideoElement);
  29. newVideoElement.play();
  30. }
  31. }
  32. const targetNode = document.getElementById('kt_player');
  33. if (targetNode) {
  34. const observer = new MutationObserver((mutationsList) => {
  35. for (const mutation of mutationsList) {
  36. if (mutation.type === 'childList') {
  37. const videoElement = targetNode.querySelector('video');
  38. if (videoElement) {
  39. insertVideo();
  40. observer.disconnect();
  41. }
  42. }
  43. }
  44. });
  45. observer.observe(targetNode, { childList: true, subtree: true });
  46. //console.log('MutationObserver is monitoring for <video> elements within kt_player');
  47. } else {
  48. //console.error('The element with ID "kt_player" was not found.');
  49. }
  50. })();