Youtube Copy Comment

Copy comment from Youtube to clipboard. If there is a "See more" button here, click it.

  1. // ==UserScript==
  2. // @name Youtube Copy Comment
  3. // @name:vi Sao Chép Bình Luận Youtube
  4. // @namespace https://lelinhtinh.github.io
  5. // @description Copy comment from Youtube to clipboard. If there is a "See more" button here, click it.
  6. // @description:vi Sao chép bình luận từ Youtube vào bộ nhớ đệm. Nếu có nút "Xem thêm" ở đây, nhấn vào nó.
  7. // @version 1.0.1
  8. // @icon https://raw.githubusercontent.com/lelinhtinh/Userscript/master/yt_copy_comment/icon.png
  9. // @author lelinhtinh
  10. // @oujs:author baivong
  11. // @license MIT; https://baivong.mit-license.org/license.txt
  12. // @match https://www.youtube.com/live_chat
  13. // @supportURL https://github.com/lelinhtinh/Userscript/issues
  14. // @run-at document-idle
  15. // @grant none
  16. // ==/UserScript==
  17.  
  18. document.addEventListener("click", (e) => {
  19. const mess = e.target.closest('span[dir="auto"]');
  20. if (!mess?.classList?.contains("yt-live-chat-text-message-renderer")) return;
  21.  
  22. const commendText = mess.innerText;
  23. // console.log(commendText);
  24. if (!commendText) return;
  25.  
  26. navigator.clipboard.writeText(commendText).then(
  27. () => {
  28. document.title = commendText;
  29. document.body.style.cursor = 'wait'
  30. setTimeout(() => {
  31. document.body.style.cursor = 'initial'
  32. }, 200);
  33. },
  34. () => {
  35. document.body.style.cursor = 'not-allowed'
  36. setTimeout(() => {
  37. document.body.style.cursor = 'initial'
  38. }, 200);
  39. },
  40. );
  41. });

QingJ © 2025

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