2 Star 2 Fork 1

趣玩Python/Python自动评论头条

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
login.py 696 Bytes
一键复制 编辑 原始数据 按行查看 历史
Alone 提交于 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/python_play/python_auto_comment_headlines.git
git@gitee.com:python_play/python_auto_comment_headlines.git
python_play
python_auto_comment_headlines
Python自动评论头条
master

搜索帮助