This is a bot for the Tumblr blogging platform. It is designed to search through a configured list of tags for posts, and provide them to the user, either through the drafts or queue.
Set up required before installing the bot
The Bot requires a MySQL database for configuration and caching purposes
This project uses version 9.4 of the PostgreSQL server
Ok, so now that you have PostgreSQL installed, we need to create a database for the bot to use
For most installation, I would recommend using PgAdmin for configuring the database
And now you have the initial database set up
The bot will need an account with which to access the database, and, for security reasons, we don't want to use the root user
- To create the user, run
CREATE USER '<username>'@'<ip-address>' IDENTIFIED BY '<password>';
at the MySQL console. ex:CREATE USER 'sourcebot'@'localhost' IDENTIFIED BY 'password123';
In most cases, the IP Address will belocalhost
, but if you plan on running the database on a machine separate from the bot itself, you will need to specify the bot machine's IP Address - Now we need to give the user access to the database, to do that, run
GRANT ALL PRIVILEGES ON <database name> TO '<username>'@'<ip-address>';
ex:GRANT ALL PRIVILEGES ON sourcebot.* TO 'sourcebot'@'localhost';
- Ensure the privileges have been updated by running
FLUSH PRIVILEGES;
Now you either create the tables manually, or they will be created for you when you install the program
-
blogs
Used for storing configuration for each registered blog. Columns:id int NOT NULL AUTO_INCREMENT PRIMARY KEY
url text NOT NULL
blog_check_active boolean NOT NULL DEFAULT TRUE
sample_size int NOT NULL DEFAULT '1000'
post_type text
post_select text
post_state text NOT NULL
post_buffer int NOT NULL DEFAULT 20
post_comment text
post_tags text
preserve_tags boolean NOT NULL DEFAULT FALSE
active boolean NOT NULL DEFAULT FALSE
-
search_rules
Used for storing all the search rules, allowed/blocked blogs/tags. Columns:id int NOT NULL AUTO_INCREMENT PRIMARY KEY
url text NOT NULL
type text NOT NULL
action text NOT NULL
term text NOT NULL
-
seen_posts
A table to store all the post the bot has reblogged, on a per blog basis, so it will not repeatedly reblog posts. Columns:id int NOT NULL AUTO_INCREMENT PRIMARY KEY
url TEXT NOT NULL
post_id bigint NOT NULL
tag test NOT NULL
blog text NOT NULL
rb_id bigint NOT NULL
-
tag_stats
A table for storing information on tag searches, for the purposes of statistical measurement. This table may be made optioninal in the future, but it required as of v0.1. Columns:id int NOT NULL AUTO_INCREMENT PRIMARY KEY
url text NOT NULL
tag text NOT NULL
time datetime NOT NULL DEFAULT NOW()
search_time int NOT NULL
search int NOT NULL
selected int NOT NULL
One of the requirements for this bot is a Tumblr API connection, which requires an API key
- If you do not already have a Tumblr account, you will need to register at tumblr.com
- You will need to register an OAuth Application with Tumblr, to do this, go here
Application Name
Can be anything ex: 'SourceBot'Application Website
Can be any valid website ex: 'http;//github.com'Application Description
A short description of the bot ex: 'A content curator bot, configured by the user to search through tags for interesting posts'Administrative Contact Email
An email Tumblr may contact you at if there is a problem with your application's connection to the API ex: 'bob@example.com'Default Callback URL
Not needed for the bot, set it to '/'
- Click Register and the application should go through
- Once you have your application registered, you should see a page listing all your registered application, most likely just this one
- Click
Explore API
under your Application's name - Allow the API console access to your account
- Click the
Java
tab on the console, the should show something like
// Authenticate via OAuth
JumblrClient client = new JumblrClient(
"<consumer key>",
"<consumer secret>"
);
client.setToken(
"<token>",
"<token secret>"
);
// Make the request
User user = client.user();
You will need to keep this window open during installation or copy the consumer key, consumer secret, token, and token secret to a file
To install the bot, you first need a mysql database and a Tumblr API key
- Download the newest SourceBot release here
- Unzip the archive in to a directory
- Now we need to run the install script
-
Windows
- Open a Command Prompt and change in to the directory where you extracted the archive. ex:
cd \Users\<username>\SourceBot-{version number}
- Now enter the
bin
sub directorycd bin
SourceBot.bat install
- Open a Command Prompt and change in to the directory where you extracted the archive. ex:
-
Linux
- Open a Terminal and change in to the directory where you extracted the archive, ex
cd ~/SourceBot-{version number}
- Now enter the
bin
sub directorycd bin
./SourceBot install
(if the terminal gives a response likePermission Denied
try runningchmod +x SourceBot
and try again)
- Open a Terminal and change in to the directory where you extracted the archive, ex
-
You should be all set, now you need to add some search rules before running the bot for the first time