Python
YouTube Ads Auto Skipper with Python - 유튜브 광고 자동 클릭 (with 파이썬)
J-sean
2020. 8. 17. 19:24
반응형
유튜브를 시청하다 보면 갑자기 튀어나오는 짜증나는 광고.
아무리 한예슬이 나온다고 해도 어쩔 수 없다. 광고는 짜증난다.
'광고 건너뛰기' 버튼이 나올때 까지 기다렸다 클릭 해야만 다시 시청하던 영상으로 돌아 갈 수 있다. 파이썬 으로 '광고 건너뛰기' 버튼을 자동으로 클릭하는 프로그램을 만들어 보자.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import pyautogui import datetime import time size = pyautogui.size() print('Screen Size: {0}'.format(size)) while True: try : nowTime = datetime.datetime.now() location = pyautogui.locateCenterOnScreen('adskip.png', region = (1200, 750, 300, 100), confidence = 0.7) # region = (left, top, width, height) # You need to have OpenCV installed for the confidence keyword to work. if location == None: print("[{0}] Ad not found. (Press 'Ctrl + C' to quit)".format(nowTime.strftime('%H:%M:%S'))) time.sleep(2.0) continue print('[{0}] Ad found at {1}'.format(nowTime.strftime('%H:%M:%S'), location)) pyautogui.moveTo(location[0], location[1], 1) pyautogui.click(button = 'left') time.sleep(5.0) except KeyboardInterrupt : print("Thank You.") break |
Python Source Code
'광고 건너뛰기' 버튼을 찾기 위해 이 그림을 adskip.png로 저장 한다.
실행 로그
영상으로 확인 하자.
반응형