Truth Social的API客户端
项目描述
truthbrush
Truthbrush是Truth Social的API客户端。Truthbrush由斯坦福互联网观察站开发和维护。
目前,此工具可以
- 搜索用户、状态、群组或标签
- 获取用户的帖子
- 获取“要关注的人”或建议用户列表
- 获取“热门”标签
- 获取“热门”Truth帖子
- 获取广告
- 获取用户的元数据
- 获取“热门”群组
- 获取建议群组列表
- 获取“热门”群组标签
Truthbrush专为学术研究、开源情报收集和数据处理设计。它从公开可访问的API中提取所有数据。
安装
Truthbrush目前尚未在PyPI上提供。要安装它,运行pip install git+https://github.com/stanfordio/truthbrush.git
,或克隆仓库并运行pip3 install .
。只要您的pip
设置正确,这将使truthbrush
既可作为命令行工具,也可作为Python包使用。请注意,Truthbrush需要Python 3.9或更高版本。
安装后,您需要将您的Truth Social用户名和密码设置为环境变量。
export TRUTHSOCIAL_USERNAME=foo
export TRUTHSOCIAL_PASSWORD=bar
您还可以在运行Truthbrush的目录中的.env
文件中设置这些变量。
CLI用法
Usage: truthbrush [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
search Search for users, statuses, groups, or hashtags.
statuses Pull a user's statuses.
suggestions Pull the list of suggested users.
tags Pull trendy tags.
trends Pull trendy Truths.
ads Pull ads.
user Pull a user's metadata.
likes Pull the list of users who liked a post
group-tags Pull trending group tags.
group-trends Pull trending groups.
group-suggestions Pull list of suggested groups.
搜索用户、状态、群组或标签
truthbrush search --searchtype [accounts|statuses|hashtags|groups] QUERY
获取用户的全部帖子
truthbrush statuses HANDLE
获取“要关注的人”(建议)用户
truthbrush suggestions
获取热门标签
truthbrush tags
获取广告
truthbrush ads
获取用户的所有元数据
truthbrush user HANDLE
获取喜欢帖子的用户列表
truthbrush likes POST TOP_NUM
获取热门群组标签
truthbrush group-tags
获取热门群组
truthbrush group-trends
获取建议群组列表
truthbrush group-suggestions
贡献
鼓励贡献!对于小的错误修复和微小的改进,请随时直接提交PR。对于较大的更改,请先打开一个issue,以便其他贡献者可以讨论您的计划,避免重复工作,并确保与项目目标一致。请确保遵守行为准则。谢谢!
开发环境设置(确保您已安装Poetry)
poetry install
poetry shell
truthbrush --help # will use your local copy of truthbrush
如果您不想在根环境中安装Poetry,您也可以使用Conda
conda create -n truthbrush-env python=3.9
conda activate truthbrush-env
conda install -c conda-forge poetry
poetry install
运行测试
pytest
# optionally run tests with verbose logging outputs:
pytest --log-cli-level=DEBUG -s
请使用black
格式化您的代码
black .
愿望清单
计划支持以下功能
- ...目前没有!(有什么想法吗?提交issue/PR!)
项目详情
下载文件
下载您平台对应的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。