Skip to main content

API client for Truth Social

Project description

truthbrush

Truthbrush is an API client for Truth Social. Truthbrush is built and maintained by the Stanford Internet Observatory.

Currently, this tool can:

  • Search for users, statuses, 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

Truthbrush is designed for academic research, open source intelligence gathering, and data archival. It pulls all of the data from the publicly accessible API.

Installation

Truthbrush is not yet available on PyPI. To install it, run pip install git+https://github.com/stanfordio/truthbrush.git, or clone the repository and run pip3 install .. Provided your pip is setup correctly, this will make truthbrush available both as a command and as a Python package. Note that Truthbrush requires Python 3.9 or higher.

After installation, you will need to set your Truth Social username and password as environmental variables.

export TRUTHSOCIAL_USERNAME=foo

export TRUTHSOCIAL_PASSWORD=bar

You may also set these variables in a .env file in the directory from which you are running Truthbrush.

CLI Usage

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.

Search for users, statuses, or hashtags

truthbrush search --searchtype [accounts|statuses|hashtags] QUERY

Pull all statuses (posts) from a user

truthbrush statuses HANDLE

Pull "People to Follow" (suggested) users

truthbrush suggestions

Pull trendy tags

truthbrush tags

Pull ads

truthbrush ads

Pull all of a user's metadata

truthbrush user HANDLE

Contributing

Contributions 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 truthbrush

If you prefer not to install Poetry in your root environment, you can also use Conda:

conda create -n truthbrush-env python=3.9
conda activate truthbrush-env

conda install -c conda-forge poetry
poetry install

To run the tests:

pytest

# optionally run tests with verbose logging outputs:
pytest --log-cli-level=DEBUG -s

Please format your code with black:

black .

Wishlist

Support for the following capabilities is planned:

  • ...nothing right now! (Got an idea? Submit an issue/PR!)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

truthbrush-0.1.6.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

truthbrush-0.1.6-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file truthbrush-0.1.6.tar.gz.

File metadata

  • Download URL: truthbrush-0.1.6.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for truthbrush-0.1.6.tar.gz
Algorithm Hash digest
SHA256 aed52e94b1df52e692675cde1f7af922b4b6934194f026bc4094fdab6bfafc52
MD5 8a700422009a43f3f1a645eefec65c02
BLAKE2b-256 3c9dc20f7c11729362d02d2610ddd4bd6750a47f99567e866889551d48c2be3c

See more details on using hashes here.

File details

Details for the file truthbrush-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: truthbrush-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for truthbrush-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 20efced200e0eeb1d97c7cef1bfbb58f64262d8f5d2f6742dcf71513be5bd885
MD5 5e63d6479c234f134e5c79bd7f2c3a9d
BLAKE2b-256 d5b97b6b5b24330f6cf034d9e76c659110c2779deba65c3760e51caab1b33fa3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page