### 抽屉半自动点赞
```python
browser = webdriver.Chrome()
browser.get('https://dig.chouti.com/')
browser.implicitly_wait(10)
browser.maximize_window()
login = browser.find_element(By.CSS_SELECTOR, '#login_btn')
login.click()
phone = browser.find_element(By.CSS_SELECTOR,
'body > div.login-dialog.dialog.animated2.scaleIn > div > div.login-body > div.form-item.login-item.clearfix.phone-item.mt24 > div.input-item.input-item-short.left.clearfix > input')
password = browser.find_element(By.CSS_SELECTOR,
'body > div.login-dialog.dialog.animated2.scaleIn > div > div.login-footer > div.form-item.login-item.clearfix.mt24 > div > input.input.pwd-input.pwd-input-active.pwd-password-input')
phone.send_keys('')
password.send_keys('%')
seen = browser.find_element(By.CSS_SELECTOR,
'body > div.login-dialog.dialog.animated2.scaleIn > div > div.login-footer > div:nth-child(4) > button')
seen.click()
input('好了')
time.sleep(3)
cookie = browser.get_cookies()
with open('chouti.json', 'w', encoding='utf-8') as f:
json.dump(cookie, f)
time.sleep(3)
browser.close()
header = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
}
cookie = {}
with open('./chouti.json', 'r', encoding='utf-8') as f:
cookies = json.load(f)
for item in cookies:
cookie[item['name']] = item['value']
print(cookie)
res = requests.get('https://dig.chouti.com/top/24hr?_=1689063020932', headers=header).json()
for i in res.get('data'):
id = i.get('id')
data = {
"linkId": id
}
print(data)
resd = requests.post('https://dig.chouti.com/link/vote', headers=header, data=data, cookies=cookie)
print(resd.text)
标签:点赞,item,cookie,半自动,input,div,抽屉,login,browser
From: https://www.cnblogs.com/liyuanxiangls/p/17545593.html