Youtube video url exporter

try to take over the world!

  1. // ==UserScript==
  2. // @name Youtube video url exporter
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author Huykhong
  7. // @match https://*.youtube.com/*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-3.4.1.min.js
  10. // @run-at document-end
  11.  
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. var copyToClipboard = function (text) {
  18. var $txt = $('<textarea />');
  19. $txt.val(text).css({ width: "1px", height: "1px" }).appendTo('body');
  20. $txt.select();
  21. if (document.execCommand('copy')) {
  22. $txt.remove();
  23. }
  24. };
  25.  
  26. var urls = '';
  27. $( $('a[id="video-title"]') ).each(function( index ) {
  28. urls += "https://youtube.com/"+$( this ).attr('href')+"\n";
  29. });
  30. if(urls === ''){
  31. alert('no url found');
  32. }else{
  33. copyToClipboard(urls);
  34. alert('URLs copied to clipboard');
  35. }
  36. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址