YouTube Studio 광고 적합성 자동 클릭 스크립트 - edit 이동 후 복귀도 감지

세부정보 클릭 감지 → edit 이동 후 복귀해도 자동화 가능

  1. // ==UserScript==
  2. // @name YouTube Studio 광고 적합성 자동 클릭 스크립트 - edit 이동 후 복귀도 감지
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.6
  5. // @description 세부정보 클릭 감지 → edit 이동 후 복귀해도 자동화 가능
  6. // @license MIT
  7. // @author JOJM
  8. // @match https://studio.youtube.com/channel/*
  9. // @match https://studio.youtube.com/video/*/edit
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. const FLAG_KEY = 'gpt_auto_trigger';
  17.  
  18. const currentUrl = window.location.href;
  19.  
  20. // 🟥 edit 페이지에서는 자동화 실행 X
  21. if (currentUrl.includes('/video/') && currentUrl.includes('/edit')) {
  22. console.log('⛔ edit 페이지에서는 자동화 실행 안 함');
  23. return;
  24. }
  25.  
  26. // ✅ channel 페이지
  27. if (currentUrl.includes('/channel/')) {
  28. // 매번 세부정보 클릭 감지 시 플래그 설정
  29. function pollDetailsClick() {
  30. const detailButtons = document.querySelectorAll('[aria-label="세부정보"]');
  31. detailButtons.forEach(btn => {
  32. if (!btn.dataset.listenerAttached) {
  33. btn.addEventListener('click', () => {
  34. console.log('📍 세부정보 클릭 감지됨');
  35. sessionStorage.setItem(FLAG_KEY, 'true');
  36. });
  37. btn.dataset.listenerAttached = "true";
  38. }
  39. });
  40. setTimeout(pollDetailsClick, 1000);
  41. }
  42.  
  43. // 자동화 실행 조건 감지
  44. function watchAutomationTrigger() {
  45. if (sessionStorage.getItem(FLAG_KEY) === 'true') {
  46. const nextButton = document.querySelector('button[aria-label="다음"]');
  47. if (nextButton) {
  48. console.log('🚀 자동화 조건 충족 → 실행 시작');
  49. sessionStorage.removeItem(FLAG_KEY);
  50. startAutomation();
  51. } else {
  52. console.log('⏳ 세부정보 내부 로딩 대기 중...');
  53. }
  54. }
  55. setTimeout(watchAutomationTrigger, 1000);
  56. }
  57.  
  58. // ✅ 자동화 시작
  59. function startAutomation() {
  60. let isRunning = true;
  61.  
  62. function clickNextButtonStep1() {
  63. const nextButton = document.querySelector('button[aria-label="다음"]');
  64. if (nextButton && !nextButton.disabled) {
  65. nextButton.click();
  66. console.log('✅ [1단계] 첫 번째 "다음" 클릭');
  67. setTimeout(clickCheckbox, 2000);
  68. } else {
  69. setTimeout(clickNextButtonStep1, 1000);
  70. }
  71. }
  72.  
  73. function clickCheckbox() {
  74. const checkbox = document.querySelector('ytcp-checkbox-lit[label="해당 사항 없음"] div#checkbox');
  75. if (checkbox) {
  76. checkbox.scrollIntoView({ behavior: 'smooth', block: 'center' });
  77. checkbox.click();
  78. console.log('✅ [2단계] 해당 사항 없음 체크');
  79. setTimeout(clickSubmitButton, 2000);
  80. } else {
  81. setTimeout(clickCheckbox, 1000);
  82. }
  83. }
  84.  
  85. function clickSubmitButton() {
  86. const submitButton = document.querySelector('button[aria-label="평가 제출"]');
  87. if (submitButton && !submitButton.disabled) {
  88. submitButton.click();
  89. console.log('✅ [3단계] 평가 제출 클릭');
  90. setTimeout(clickNextButtonStep4, 2000);
  91. } else {
  92. setTimeout(clickSubmitButton, 1000);
  93. }
  94. }
  95.  
  96. function clickNextButtonStep4() {
  97. const nextButton = document.querySelector('#next-button button');
  98. if (nextButton && !nextButton.disabled) {
  99. nextButton.click();
  100. console.log('✅ [4단계] 두 번째 "다음" 클릭');
  101. setTimeout(clickNextButtonStep5, 2000);
  102. } else {
  103. setTimeout(clickNextButtonStep4, 1000);
  104. }
  105. }
  106.  
  107. function clickNextButtonStep5() {
  108. const nextButton = document.querySelector('#next-button button');
  109. if (nextButton && !nextButton.disabled) {
  110. nextButton.click();
  111. console.log('✅ [5단계] 세 번째 "다음" 클릭');
  112. setTimeout(clickNextButtonStep6, 2000);
  113. } else {
  114. setTimeout(clickNextButtonStep5, 1000);
  115. }
  116. }
  117.  
  118. function clickNextButtonStep6() {
  119. const nextButton = document.querySelector('#next-button button');
  120. if (nextButton && !nextButton.disabled) {
  121. nextButton.click();
  122. console.log('✅ [6단계] 네 번째 "다음" 클릭');
  123. setTimeout(clickSaveButton, 2000);
  124. } else {
  125. setTimeout(clickNextButtonStep6, 1000);
  126. }
  127. }
  128.  
  129. function clickSaveButton() {
  130. const saveButton = document.querySelector('button[aria-label="저장"]');
  131. if (saveButton && !saveButton.disabled) {
  132. saveButton.click();
  133. console.log('✅ [7단계] 저장 클릭 완료 🎉');
  134. isRunning = false;
  135. } else {
  136. setTimeout(clickSaveButton, 1000);
  137. }
  138. }
  139.  
  140. clickNextButtonStep1();
  141. }
  142.  
  143. // 실행
  144. window.addEventListener('load', () => {
  145. console.log('📌 세부정보 감시 및 실행 감시 시작');
  146. pollDetailsClick();
  147. watchAutomationTrigger();
  148. });
  149. }
  150. })();

QingJ © 2025

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