Truthbrush is an API client for Truth Social.
Currently, this tool can:
- Search for users, statuses, groups, or hashtags
- Pull a user's statuses
- Pull the list of "People to Follow" or suggested users
- Pull "trending" hashtags
- Pull "trending" Truth posts
- Pull ads
- Pull a user's metadata
- Pull the list of users who liked a post
- Pull the list of comments on a post
- Pull "trending" groups
- Pull list of suggested groups
- Pull "trending" group hashtags
- Pull posts from group timeline
Truthbrush is designed for academic research, open source intelligence gathering, and data archival. It pulls all data from the publicly accessible API.
From PyPi:
pip install truthbrushFrom git:
- To install it, run
pip install git+https://github.com/stanfordio/truthbrush.git
From source:
- Clone the repository and run
pip3 install .. Provided yourpipis setup correctly, this will maketruthbrushavailable both as a command and as a Python package.
After installation, you will need to set your Truth Social username and password as environmental variables.
export TRUTHSOCIAL_USERNAME=foo
export TRUTHSOCIAL_PASSWORD=bar
If you encounter login issues, you can instead extract your login token from the truth:auth Local Storage store and export it in TRUTHSOCIAL_TOKEN.
You may also set these variables in a .env file in the directory from which you are running Truthbrush.
Usage: truthbrush [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
search Search for users, statuses 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
comments Pull the list of oldest comments on a post
groupposts Pull posts from a groups's timeline
grouptags Pull trending group tags.
grouptrends Pull trending groups.
groupsuggestions Pull list of suggested groups.
Search for users, statuses, groups, or hashtags
truthbrush search --searchtype [accounts|statuses|hashtags|groups] QUERYPull all statuses (posts) from a user
truthbrush statuses HANDLEPull "People to Follow" (suggested) users
truthbrush suggestionsPull trendy tags
truthbrush tagsPull ads
truthbrush adsPull all of a user's metadata
truthbrush user HANDLEPull the list of users who liked a post
truthbrush likes POST --includeall TOP_NUMPull the list of oldest comments on a post
truthbrush comments POST --includeall --onlyfirst TOP_NUMPull trending group tags
truthbrush grouptagsPull trending groups
truthbrush grouptrendsPull list of suggested groups
truthbrush groupsuggestionsPull posts from a group's timeline
truthbrush groupposts GROUP_IDContributions are encouraged! For small bug fixes and minor improvements, feel free to just open a PR. For larger changes, please open an issue first so that other contributors can discuss your plan, avoid duplicated work, and ensure it aligns with the goals of the project. Be sure to also follow the code of conduct. Thanks!
Development setup (ensure you have Poetry installed):
poetry install
poetry shell
truthbrush --help # will use your local copy of truthbrushTo run the tests:
pytest
# optionally run tests with verbose logging outputs:
pytest --log-cli-level=DEBUG -sPlease format your code with black:
black .