基于selenium工具刷b站播放量(请谨慎使用)
from selenium import webdriver
import time
import random
url = input("url:")
if url == "":
url = 'https://www.bilibili.com/video/BV1K64y1574T'
for i in range(50):
driver_path = 'C:\chromedriver.exe'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument("log-level=3")
browser = webdriver.Chrome(executable_path=driver_path, options=chrome_options)
browser.get(url)
time.sleep(random.uniform(4,10))
try:
play_count = browser.find_element_by_class_name('view').text
print(f'当前播放量:{play_count}')
play_button = browser.find_element_by_class_name('bpx-player-state-wrap')
play_button.click()
except:
pass
time.sleep(random.uniform(20,40))
browser.quit()
time.sleep(random.uniform(4,10))