1 Star 0 Fork 1

wudoo/Python自动评论头条

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
login.py 696 Bytes
Copy Edit Raw Blame History
Alone authored 2020-04-04 03:54 . 添加Python自动评论头条
# coding=utf-8
from selenium import webdriver
import json
file = 'cookies.json'
# 打开网址
def open_url(url,driver):
driver.get(url)
driver.delete_all_cookies()
driver.implicitly_wait(5)
driver.maximize_window()
def save_cookies(driver):
cookies = driver.get_cookies()
fp = open(file, 'w')
jsonCookies = json.dumps(cookies)
# 登录完成后,将cookie保存到本地文件
with open(file, 'w') as f:
f.write(jsonCookies)
fp.close()
if __name__ == '__main__':
driver = webdriver.Firefox()
open_url("https://www.toutiao.com", driver)
key= input("请输入")
if key =='login':
save_cookies(driver)
driver.close()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/wudoo/python_auto_comment_headlines.git
git@gitee.com:wudoo/python_auto_comment_headlines.git
wudoo
python_auto_comment_headlines
Python自动评论头条
master

Search