Last active
July 3, 2020 07:43
-
-
Save mjy9088/5dd44c6e120b0604f5170b8ce398c0c7 to your computer and use it in GitHub Desktop.
네이버 밴드 글 삭제 매크로?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
import selenium | |
from selenium import webdriver | |
from time import sleep | |
driver = webdriver.Chrome('(웹드라이버 경로)') | |
driver.implicitly_wait(3) | |
driver.get('https://band.us/band/(밴드 ID)') | |
input("로그인 한 다음에 엔터를 눌러주세요.") | |
cnt = 0 | |
while(True): | |
try: | |
sleep(0.05) | |
elem = driver.find_element_by_xpath("//button[@class='postSet _btnPostMore']") | |
elem.click() | |
sleep(0.05) | |
driver.find_element_by_xpath("//ul[@class='_postMoreMenuUl']/li[last()]").click() | |
sleep(0.05) | |
driver.find_element_by_xpath("//button[@class='uButton -confirm _btnConfirm']").click() | |
print("삭제 완료"); | |
except: | |
cnt += 1 | |
if cnt > 10: | |
cnt = 0 | |
print("오류 발생?") | |
try: | |
driver.execute_script("window.scrollTo(0, 0)") | |
except: | |
pass | |
sleep(1) | |
try: | |
driver.execute_script("window.scrollTo(0, document.body.scrollHeight)") | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
아 넵ㅋ 수고링~