之前给大家分享过AI爆文的写作教程,没看过的可以看下对应的教程:
因为是怼量,为了高效完成文章,我用python脚本实现了自动写文章的功能,发布文章目前还是要手动进行。
AI爆文教程参考:
运行前提:
1.安装Python
可以安装集成环境,方便点
2.安装Charles抓包工具
整体运行配置思路:
- 首先安装抓包工具获取chatglm的cookie信息
主要是auth,cookie和userID
- 下载脚本到你电脑任意目录
- 配置cookie信息到config.ini
- 程序目录下cmd运行脚本
Python baowen.py
运行结果

写的文章会存放在这个目录:(当天日期)

Python安装
推荐安装anaconda集成环境:
脚本依赖库安装:
安装模拟浏览器依赖库:
pip install bs4 selenium

如果Selenium安装报错,尝试如下指令
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org selenium
脚本下载:
回复:AI爆文变现即可



脚本存档位置:放在你电脑任何路径都可以,最好是英文路径。
运行命令如下
第一步进入你本地保存的目录,比如我的再桌面baowenAI
cd 你的目录

第二步执行:
执行 python baowen.py

如上图红框内的命令。
版本解释:
自动标题版本: 采集淘金阁的标题
需要在config.ini目录下配置BaowenUrl和TotalPage两个参数
本地标题版本:
把你想要写的标题放到这个title目录就行,文件名随便写,txt后缀即可,会获取文件夹内所有的txt文件
格式参考案例的内容

Charles 抓包工具下载:
官网下载:https://www.charlesproxy.com/download/
网盘下载:(软件安装包)

夸克网盘链接:https://pan.quark.cn/s/93711339e8f0
百度网盘下载:https://pan.baidu.com/s/15NqCuCryv2BKqVsOWbEk2w?pwd=8888
不破解也可以用,只是首次打开有一点广告。
破解:https://www.zzzmode.com/mytools/charles/
破解方法:

Charles配置Https抓包
1.安装证书
按照截图一步一步操作
Help->SSL Proxying->Install Charles Root Certificate

安装证书

当前用户->下一步

将所有的证书都放入下列存储->浏览

选择-》收信人的根证书颁发机构-》确认

2.配置SSL
Charle顶部导航->Proxy

Add

类似这样添加443和80端口
Host写*
Port写443/80

3.勾选监听:
Windows Proxy勾上就可以

这个时候去访问chatGlm就可以监听到数据包了
https://chatglm.cn/main/detail
找到如下路径

选info后点Contents

双击下面部分获取Authorization


将这个保存下来,放到后面的Config.ini中
同样的双击下面部分获取Cookie


UserID在这里获取:只要双引号内的部分

配置config.ini
chatglm的配置:
将上面获取的
UserID、Cookie、Authorization 按照对应的关系填到配置文件
配置示例:

爆文Url配置:
选好领域,开始抓取,然后复制url,配置到Config.ini的BaoWenUrl里面

采集页数配置
TotalPage = 100 意思是可以抓取到从1-100的标题内容
配置指令Prompt
prompt.json
可以添加多个prompt
每个prompt里面标题部分固定写法{title}
示例如下图:
