This is a command-line tool that posts an image-preview of a recent blog post to Twitter, complete with a call-to-action to read the full post at the blog's own website. It adds an appropriate hyperlink to the tweet's text, in an attempt to make this easy Twitter-browsing humans and others.
When configured with a Twitter account and a blog's Atom feed, this program upon invocation will fetch that blog's basic information and most recent post, then create a new tweet containing the following elements:
The blog's name
The title of the most recent post
A link to the most recent post
And this is the kicker — An image containing the most recent post's first paragraph, followed by an exhortation to read the rest of the post by clicking the attached link or just going to the blog's front page.
Furthermore, if the post contains at least one image (via an ordinary HTML
<img>tag), then alisio will work that illustration into the resulting image, recoloring its output text and background so that everything looks reasonably good.
Alternately, the program can just write the image to your local filesystem instead of posting it to Twitter.
You can find all this tool's prerequisite software through your favorite package manager (
apt-get or whatever).
ImageMagick, giving you the
libxml2. (If the command
xml2-config --versionreturns something that looks like a version number, you're probably OK.)
Optional: wkhtmltopdf, giving you the
wkhtmltoimagecommand-line program. If installed, then you can invoke alisio with the
--preserve_markupoption, allowing its output image to retain the original text's inline markup.
If you enjoy blindly running
curl | bash invocations straight off of GitHub README files as much as I do, then you can just do this:
curl -fsSL https://cpanmin.us | perl - --installdeps .
More conservative users can install cpanm manually and then run
cpanm --installdeps . instead.
Copy conf/alisio-example.conf to conf/alisio.conf, then update as the file itself directs. (You can instead copy the file to some other location and then tell alisio about it at runtime, per "Usage", below.)
In order to fill in all four required consumer/access-token keys, you will probably need to go to apps.twitter.com and register a new app and then give yourself access tokens to it.
If the config file is "../config/alisio.conf" relative to the alisio script's location on the filesystem, just run it with no arguments.
Otherwise, run it like so:
If you would like it to output a local file rather than make a Twitter post, use the
alisio --config_file=/path/to/alisio.conf --preview=my_image.png
More command-line options exist, and you can
perldoc the alisio program file to learn about them.
Bugs and TODO
This is beta software. Its author is still figuring out how it wants to work, and the interface might still change. Use at your own risk.
Rather inflexible. (Can't customize the call-to-action text, for example.)
It should really be able to work with both Atom and RSS. Well, it doesn't.
Blog posts with absurdly long titles will make the tweet-post fail silently.
Unexpected uses of the
<link>element in the Atom document can make the program fail.