|
|
|
@ -45,6 +45,7 @@ if __name__ == '__main__':
|
|
|
|
|
# 使用json还原为json对象
|
|
|
|
|
cookies = json.loads(content)
|
|
|
|
|
options = Options()
|
|
|
|
|
options.add_argument('-headless') # 无头参数,调试时可以注释掉
|
|
|
|
|
# 设置headers - 使用微信内置浏览器的User-Agent
|
|
|
|
|
header = {
|
|
|
|
|
"HOST": "mp.weixin.qq.com",
|
|
|
|
@ -137,8 +138,8 @@ if __name__ == '__main__':
|
|
|
|
|
print(x)
|
|
|
|
|
# 将返回的地址写入到文件
|
|
|
|
|
with open('article_urls.txt', 'w', encoding='utf-8') as f:
|
|
|
|
|
for url in article_urls:
|
|
|
|
|
f.write(url + '\n')
|
|
|
|
|
for record in article_urls:
|
|
|
|
|
f.write(record['title']+" "+record['publish_time']+" "+record['url'] + '\n')
|
|
|
|
|
|
|
|
|
|
# 关闭浏览器
|
|
|
|
|
driver.quit()
|
|
|
|
|