LiveLeak download

Creates a download link next to video title

  1. // ==UserScript==
  2. // @name LiveLeak download
  3. // @version 1.4
  4. // @description Creates a download link next to video title
  5. // @author Mark Lin
  6. // @match *://www.liveleak.com/view*
  7. // @grant none
  8. // @namespace https://greasyfork.org/users/17419
  9. // ==/UserScript==
  10.  
  11. function insertAfter(newNode, selector) {
  12. const target = document.querySelector(selector);
  13. target.parentElement.insertBefore(newNode, target.nextSibling);
  14. }
  15.  
  16. const title = document.querySelector('title').innerText + '.mp4';
  17. const url = document.querySelector('video.vjs-tech').src;
  18.  
  19. const anchor = document.createElement('a');
  20. anchor.href = url;
  21. anchor.setAttribute('download', title);
  22. anchor.innerText = 'Download File';
  23.  
  24. insertAfter(anchor, '.channel_video_heading h3');