main
HuangHai 1 week ago
parent a5e7d0e501
commit 36f57caaee

@ -39,7 +39,7 @@ if __name__ == '__main__':
cookies = json.loads(content) cookies = json.loads(content)
# "expiry": 1787106233 # "expiry": 1787106233
# 检查是否有过期时间 # 检查是否有过期时间
expiry=cookies["expiry"] expiry = cookies["expiry"]
if expiry: if expiry:
# 换算出过期时间 # 换算出过期时间
expiry_time = time.localtime(expiry) expiry_time = time.localtime(expiry)
@ -51,6 +51,8 @@ if __name__ == '__main__':
if current_timestamp > expiry: if current_timestamp > expiry:
print("Cookie已过期") print("Cookie已过期")
exit() exit()
# 移除expiry属性
del cookies["expiry"]
options = Options() options = Options()
options.add_argument('-headless') # 无头参数,调试时可以注释掉 options.add_argument('-headless') # 无头参数,调试时可以注释掉
@ -80,7 +82,8 @@ if __name__ == '__main__':
logging.info("微信token:" + token) logging.info("微信token:" + token)
article_urls = [] article_urls = []
gzlist = [{"account_name": "长春教育八卦阵", "account_id": "jybg100"}] gzlist = [{"account_name": "长春教育八卦阵", "account_id": "jybg100"},
{"account_name": "致知物理", "account_id": "zhizhiphysics"}]
for item in gzlist: for item in gzlist:
account_name = item["account_name"] account_name = item["account_name"]
account_id = item["account_id"] account_id = item["account_id"]
@ -147,7 +150,7 @@ if __name__ == '__main__':
# 将返回的地址写入到文件 # 将返回的地址写入到文件
with open('article_urls.txt', 'w', encoding='utf-8') as f: with open('article_urls.txt', 'w', encoding='utf-8') as f:
for record in article_urls: for record in article_urls:
f.write(record['title']+" "+record['publish_time']+" "+record['url'] + '\n') f.write(record['title'] + " " + record['publish_time'] + " " + record['url'] + '\n')
# 关闭浏览器 # 关闭浏览器
driver.quit() driver.quit()

Loading…
Cancel
Save