Skip to main content

An updated bot that posts to Tumblr, based on your very own blog!

Project description

tumblrbot

PyPI - Version

Description of original project:

4tv-tumblrbot was a collaborative project I embarked on with my close friend Dima, who goes by @smoqueen on Tumblr. The aim of this endeavor was straightforward yet silly: to develop a Tumblr bot powered by a machine-learning model. This bot would be specifically trained on the content from a particular Tumblr blog or a selected set of blogs, allowing it to mimic the style, tone, and thematic essence of the original posts.

This fork is largely a rewrite of the source code with similarities in its structure and process.

Features:

  • An interactive console for all steps of generating posts for the blog:
    1. Asks for OpenAI and Tumblr tokens.
      • Stores API tokens using keyring.
      • Prevents API tokens from printing to the console.
    2. Retrieves Tumblr OAuth tokens.
    3. Downloads posts from the configured Tumblr blogs.
      • Skips redownloading already downloaded posts.
      • Shows progress and previews the current post.
    4. Creates examples to fine-tune the model from your posts.
      • Filters out posts that contain more than just text data.
      • Filters out any posts flagged by the OpenAI Moderation API (optional).
        • Shows progress and previews the current post.
      • Formats asks as the user message and the responses as the assistant response.
      • Adds custom user messages and assistant responses to the dataset from the configured file.
    5. Provides cost estimates if the currently saved examples are used to fine-tune the configured model.
    6. Uploads examples to OpenAI and begins the fine-tuning process.
      • Resumes monitoring the same fine-tuning process when restarted.
      • Stores the output model automatically when fine-tuning is completed.
    7. Generates and uploads posts to the configured Tumblr blog using the configured fine-tuned model.
      • Creates tags by extracting keywords at the configured frequency using the configured model.
      • Uploads posts as drafts to the configured Tumblr blog.
      • Shows progress and previews the current post.
  • Colorful output, progress bars, and post previews using rich.
  • Automatically keeps the config file up-to-date and recreates it if missing.

To-Do:

  • Add documentation.
  • Finish updating README.md.

Please submit an issue or contact us for features you want added/reimplemented.

Installation

  1. Install the latest version of Python:
    • Windows: winget install python3
    • Linux (apt): apt install python-pip
    • Linux (pacman): pacman install python-pip
  2. Install the pip package: pip install tumblrbot
    • Alternatively, you can install from this repository: pip install git+https://github.com/MaidThatPrograms/tumblrbot.git
    • On Linux, you will have to make a virtual environment.

Usage

Run tumblrbot from anywhere. Run tumblrbot --help for command-line options. Every command-line option corresponds to a value from the config.

Obtaining Tokens

  • The OpenAI API token can be created here.
    1. Leave everything at the defaults and set Project to Default Project.
    2. Press Create secret key.
    3. Press Copy to copy the API token to your clipboard.
  • The Tumblr API tokens can be created here.
    1. Press + Register Application.
    2. Enter anything for Application Name and Application Description.
    3. Enter any URL for Application Website and Default callback URL, like https://example.com.
    4. Enter any email address for Administrative contact email. It probably doesn't need to be one you have access to.
    5. Press the checkbox next to I'm not a robot and complete the CAPTCHA.
    6. Press Register.
    7. You now have access to your consumer key next to Oauth Consumer Key.
    8. Press Show secret key to see your Consumer Secret.

When running this program, you will be prompted to enter all of these tokens. The fields are password-protected, so there will be no output to the console. If something goes wrong while entering the tokens, you can always reset them by running the program again and answering y to the relevant prompt.

After inputting the Tumblr tokens, you will be given a URL that you need to open in your browser. Press Allow, then copy and paste the URL of the page you are redirected to into the console.

Configuration

All config options can be found in config.toml after running the program once. This will be kept up-to-date if there are changes to the config's format in a future update. This also means it may be worthwhile to double-check the config file after an update. Any changes to the config should be in the changelog for a given version.

WIP: There will be more information about the config options soon.

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

tumblrbot-1.3.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tumblrbot-1.3.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file tumblrbot-1.3.1.tar.gz.

File metadata

  • Download URL: tumblrbot-1.3.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for tumblrbot-1.3.1.tar.gz
Algorithm Hash digest
SHA256 64598a540da1c49d551ac7379b646d329d1cdbab7da6266987f6c8bf10e65634
MD5 407decdf0ff1147f0f6159d0eb6e8319
BLAKE2b-256 fb92274bf5c7a092a87e190f127a77743aee5f0becc5d4ab6682204f05138602

See more details on using hashes here.

File details

Details for the file tumblrbot-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: tumblrbot-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for tumblrbot-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea920bbea0727457b86555816a104cca25bd0426ccac9ebb2f0c930ba782f433
MD5 0412f4c926b083e4e5ac3a1167cd44e3
BLAKE2b-256 149140f4ddf4312274cc6d213bdecc424ca5ba5f232d2f7158d071dcf56598a0

See more details on using hashes here.

Supported by

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