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.0.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.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tumblrbot-1.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 4e839073497d65b4cfe1ffa22e4e98105a95c2a93f3654c46325d2ca06d7f2dd
MD5 f85b84fd62ae4540f4903abe956e34eb
BLAKE2b-256 58d2ca34a7c2527e927e1d7f5e088e8ea281dc602a665704dd56f2cda225f3cd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tumblrbot-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 884dd38cbf25944cbc66282df73cca8ef585094a29b2de25cac7fb3044c52d69
MD5 53de9ec7f6a3013409f5142e44600b0d
BLAKE2b-256 259db38447e32e05793bcc19df7e6afbc5b0f619c72d24890ea4f5cb0ff9c6f7

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