‘discourse-reader’ 代表用户从 Discourse 论坛检索数据(例如站点、类别、主题)。该实用程序可以在此处找到:
discourse-reader
程序:
名称 : discourse-reader
版本 : v1.0.0 - 2022/11/18
目的 : Discourse 阅读器
信息 : 从 Discourse 论坛检索数据(例如站点、类别、主题)。
用法:
discourse-reader -forum=string -query=string -category=int -topic=int -pages=int -output=string -userapikey -sleeptime=int
一般查询示例:
discourse-reader
discourse-reader -query=community.openstreetmap.org/site.json -output=community.openstreetmap.org.json
discourse-reader -query=community.openstreetmap.org/site.json -output=community.openstreetmap.org.json -userapikey=bd38603815e3f2562c3eb3988c69eb77
discourse-reader -query=meta.discourse.org/site.json -output=meta.discourse.org.json
discourse-reader -query=meta.discourse.org/session/current.json -output=session-current.json
类别示例:
discourse-reader -forum=community.openstreetmap.org -category=56 -output=category-56.json
discourse-reader -forum=community.openstreetmap.org -category=56 -output=category-56.json -userapikey=bd38603815e3f2562c3eb3988c69eb77
discourse-reader -forum=meta.discourse.org -category=67 -pages=99 -sleeptime=6 -output=category-67.json
主题示例:
discourse-reader -forum=community.openstreetmap.org -topic=4120 -output=topic-4120.json
discourse-reader -forum=community.openstreetmap.org -topic=4120 -pages=99 -sleeptime=6 -output=topic-4120.json
discourse-reader -forum=community.openstreetmap.org -topic=4120 --output=topic-4120.json -userapikey=bd38603815e3f2562c3eb3988c69eb77
discourse-reader -forum=meta.discourse.org -topic=112837 -output=topic-112837.json
选项:
-category int
为具有标识符的类别检索数据(主题列表)(默认值 -1)
-forum string
Discourse 论坛 URL
-output string
JSON 输出文件的名称
-pages int
要检索的数据页数(默认值 19)
-query string
一般数据检索查询(完整 URL)
-sleeptime int
在检索下一页之前暂停的秒数(避免用户速率限制)(默认值 2)
-topic int
为具有标识符的主题检索数据(帖子列表)(默认值 -1)
-userapikey string
个人用户 API 密钥(也可以设置为环境变量 'USER_API_KEY')
备注:
- 用户 API 密钥可以设置为环境变量 [USER_API_KEY]。
- Internet 代理可以设置为环境变量 [HTTPS_PROXY]。
- Linux 示例:
export USER_API_KEY=bd38603815e3f2562c3eb3988c69eb77
export HTTPS_PROXY=http://user:password@194.114.63.23:8080
- Windows 示例:
set USER_API_KEY=bd38603815e3f2562c3eb3988c69eb77
set HTTPS_PROXY=http://user:password@194.114.63.23:8080
论坛服务速率限制:
- 该程序的功能与用户通过浏览器进行的操作没有区别。但是,
数据检索速度稍快。这可能导致服务拒绝(速率限制)。为避免这种情况,
程序可以在获取页面之间暂停。暂停时间可以通过选项 '-sleeptime=int' 指定。
- 典型的用户速率限制设置是:
- 每分钟请求数:20
- 每天请求数:2880