infoelectoral: una librería de R para descargar resultados electorales de España
A while ago I stumbled upon [Andrei Taraschuk’s] artbots( https://twitter.com/andreitr)..) 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.](https://twitter.com/Prado_Bot).)
{{<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.](https://www.museodelprado.es/coleccion/obras-de-arte).)
Once all the museum’s works were collected, I created a Twitter account and generated developer keys](https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api)) to control the account through the API.
Finally, I wrote a script in R](https://www.r-project.org/)) 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.](https://ostechnix.com/a-beginners-guide-to-cron-jobs/).)
All the code can be found on Github.](https://github.com/hmeleiro/PradoBot).)