3.6
### 可以写个脚本给番剧在🌸刷赞
虽说一运行网站就大概率崩掉……
点击查看代码
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from time import sleep
import time
import webbrowser
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_experimental_option('excludeSwitches',['enable-automation'])
options.add_experimental_option('useAutomationExtension',False)
url = 'https://www.odcoc.com/play/4790-3-8.html'
driver = webdriver.Chrome(options=options)
driver.execute_cdp_cmd('Page.addScriptToEvaluateOnNewDocument',{
'source':'Object.defineProperty(navigator,"webdriver",{get: () => undefined})'
})
# driver.execute_script('window.open()')
cnt = 1
while True:
# driver.switch_to.window(driver.window_handles[1])
try:
driver.get(url=url)
driver.maximize_window()
driver.execute_script('window.scrollTo(0,450)')
time.sleep(2)
zan = driver.find_element(By.XPATH,value='//*[@id="player-left"]/ul/li[3]/a/i')
ActionChains(driver).move_to_element(zan).perform()
zan.click()
driver.close()
driver = webdriver.Chrome(options=options)
cnt = 1-cnt
except:
pass
UPD
2024年1月21日更新一下 加个try except 不然这网站老是掉...
还有别开这vpn运行 貌似会被ban IP...