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.
      • 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

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.

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.2.tar.gz (16.4 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.2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tumblrbot-1.3.2.tar.gz
Algorithm Hash digest
SHA256 8265e0583292e0de1aba2a081b58722f3c8279468831a13965eda9cd11952c50
MD5 fa1f117f6ae8cedde73f5ecf4572f532
BLAKE2b-256 a263b599b1bd3fd46ad5fdddeaf36fc9dfac13dc67e92302f776e49db68c24fd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tumblrbot-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3fb8e5d2fa398505bc59721891cc3dc2c1a9393b3c8445c66395920aa79ab768
MD5 fa253794af056768767ac35c8647b5bb
BLAKE2b-256 fd4731b04b7a810d49f8fa7777b14189541f87ff7a1b54e9e4fda816f8b6fa3b

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