infoelectoral: una librería de R para descargar resultados electorales de España

A while ago I stumbled upon [Andrei Taraschuk’s] artbots( These bots are nothing more than automated Twitter accounts that tweet artworks from different artists or museums. I thought it was an original idea to make Twitter a better place.

As I’m always looking for entertaining code projects that serve to learn by creating, I came up with the idea to imitate the idea with the Prado Museum and create PradoBot.](

{{<tweet user=“Prado_Bot” id=“1695949335844766084”>}}}

The project is simple but quite complete, since it requires touching several programming topics such as web scrapping, data cleaning, use of APIs and automation through cron tasks.

First of all it was necessary to collect all the works of art of the Prado Museum including both the information of the works and the high quality images. Fortunately, the art gallery has a well organized and easy to scrape online catalog.](

Once all the museum’s works were collected, I created a Twitter account and generated developer keys]( to control the account through the API.

Finally, I wrote a script in R]( to pick a random artwork from the collected dataset and tweet it using the Twitter API. This script runs 6 times a day from a server using a cron job.](

All the code can be found on Github.](