Implementing a bot that tweets beautifully formatted cocktail recipes

Twitter bot that publishes cocktail recipes

I have always been a big fan of mixology, which is the science of mixing and composing drinks in a way that they deliver the best experience to the palate.

In the past, when I have wanted to make new cocktails, I had to pull recipes from websites like Liquor. As my passion for this alternative contemporary form of art increased, I wanted to find a way to contribute a little grain of sand of my own to it.

This is how I came up with the idea behind @CocktailsBot, a Twitter bot that posts a cocktail recipe every 6 hours.

This way, any Twitter user with a passion similar to mine, could wake up to a recipe for a cocktail delivered right in the comfort of their Twitter feed.

I wanted to make the bot present the information in the most comfortable and accessible way, I decided to implement the following features:

  • Every recipe would be formed of two or more tweets. The main tweet would display the ingredients, and answer(s) to that tweet would describe the instructions.
  • The ingredients of the cocktail would be preceded by a related emoji.
  • An image with the final result would be included.
Continue reading “Implementing a bot that tweets beautifully formatted cocktail recipes”

Porting @concinnus to Instagram

Instagram bot that posts abstract gifs

Roughly one year after building @concinnus for Twitter, I decided it would be a good idea to implement a port for Instagram. I have never been a big fan of the latter, but it is difficult to deny that, of all networks, it’s probably the best target for publishing the kind of content Concinnus publishes — abstract GIFs.

Besides, I had never had the chance to play with the Instagram API, so it seemed like a good opportunity to also learn something new.

Since I already had the core logic of the bot implemented, it seemed like the task would reduce to adding a new channel of distribution. However, as soon as I started experimenting, the following limitations started to show:

  • Instagram only allows to upload images and videos, but not GIFs.
  • Converting GIFs to videos required the use of CPU-intensive tools that my Bluehost shared-hosting plan did not support or allow.
  • No good libraries for Instagram existed for Python 2.7, which I was forced to use on the shared hosting.

With this, it became obvious that I would have to find a workaround for these limitations, and execute the Instagram bot in a server with higher performance.

I contracted the cheapest VPS I could find (offered by OVH), and I set up the basic tools I normally use (Python, pip, etc). 

Continue reading “Porting @concinnus to Instagram”

Tweeting periodic bits of inspiration using Selenium

Selenium based Twitter bot

At this point, I had already acquired some experience on scraping content online. However, the method followed with @concinnus was quite rudimentary compared to the industry standards, and I was excited to get to play with more robust solutions like Selenium.

In the past, when in need of visual inspiration, I have always resorted to Pinterest. While I have much appreciation for this network, it is not my social media of choice, and having an application/bookmark/favorite for it only to satisfy this use case didn’t seem very reasonable. Instead, I realized I could take steps to integrate this into the social network I use on a regular basis: Twitter.

That’s how I came up with the idea behind @HourlyDesign, a bot that posts a little piece of design every hour, with the intention of introducing some visual inspiration in the Twitter feed.

My first idea was to pull images from Pinterest itself, but it seemed to defy the purpose of the project, so I quickly discarded it. Instead, I realized that sites like Dribbble, Behance and many others are packed with interesting and inspiring content by and for designers.

On top of this, these websites feature the most popular content at the moment in a specific section, which is much more convenient than browsing the vast sea of noise that predominates on Pinterest (and certainly easier to automate).

Continue reading “Tweeting periodic bits of inspiration using Selenium”

Notes on making a Twitter bot that posts abstract GIFs

Twitter bot for abstract gifs

For years, I have followed and been fascinated with Archillect, the 1-million-followers Twitter bot coded by Murat Pak that posts interesting pictures every 20 minutes. The bot, which relies on artificial intelligence (as the author explains here), is based on a pool of Tumblr keywords that grows as the tweets posted receive feedback.

This way, Archillect learns from the tastes of the followers, and caters its decision-making process depending on the reactions of the users. And, oh, it works like a charm. I used to like Archillect’s “taste” so much, that I once took the time to extract 75,000+ of its posted images to use them as a slideshow screensaver.

After a while following it and enjoying its posts, Archillect strongly inspired me to try and create my own Twitter bot. Implementing something as complex seemed a little bit risky for the first time, so I decided I would leave out of my bot the feedback-learning aspect, but I was set on making it post content that other people would find as enjoyable as I find Archillect’s.

Continue reading “Notes on making a Twitter bot that posts abstract GIFs”