파이톤+셀레니움에서 유튜브 광고를 건너뛰는 방법
비디오를 열 때
GiitHub에 따라
우선 GiitHub의adskipper입니다.
This is a program written in python programming language. It automatically clicks on the 'skip ad' button on the youtube ads. It uses opencv library's Template Matching functionality to do that.
혹은
def check_ad(self):
try:
self.driver.find_element_by_class_name("videoAdUiPreSkipButton").click()
self.has_ad = True
return self.driver.find_element_by_class_name("videoAdUiPreSkipText").text
except:
return None
def skip_ad(self):
try:
self.has_ad = False
self.total_skip_ad += 1
print("已跳過{}個廣告".format(self.total_skip_ad))
self.driver.find_element_by_class_name("videoAdUiSkipButton").click()
sleep(1)
#return self.driver.find_element_by_class_name("videoAdUiSkipButtonExperimentalText").text
except:
return None
Stackoverflow
건너뛰기 버튼을 어떻게 눌러요?
[How to click the 'skip ads' button in youtube using selenium in python 3](
selenium-in-python-3)
원소를 찾을 수 없을 때 어떻게 처리해야 합니까?
Continue the script if an element is not found using selenium in Python
간단한 파이썬 예외 처리의 기초
그리고 유한한 재시도는 보기 싫지만 현재의 타협점.
좋은 걸 찾으면 추가될지도 몰라요.
Reference
이 문제에 관하여(파이톤+셀레니움에서 유튜브 광고를 건너뛰는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/e99h2121/articles/ded6a601d61c25텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)