Skip to content

Bot that posts photos and some metadata to twitter.

License

Notifications You must be signed in to change notification settings

tomcook/nostalgiabot

Repository files navigation

nostalgiabot

This was a twitter bot that randomly selected old photos from a data source and posted them, along with some metadata, to twitter. It ran entirely within GitHub via GitHub Actions and had no external dependencies except the Twitter API.

After twitter's late 2022 change in ownership / direction these bots were disabled out of a desire to contribute no new content or value to a service that has so little regard for its users, employees, customers, or the broader public that relied on it.

Example

example tweet

Active Accounts

  • Obama Nostalgia - The original bot this was written to enable. Launched just after President Obama left office using his eight years of archived White House Flickr photos. Source data can be found here.

  • Biden Nostalgia - Posting photos from the Biden campaign and administration. Campaign photos are a frozen-in-time export from Flickr, but administration photos was periodically scraped out as President Biden's time in office went on. Source data can be found here.

Content Licensing

More details on the licensing of this content can be found in each individual content repo's DISCLAIMER file. Everything in those repos are either produced by employees of the United States Government (meaning they are in the public domain) or licensed under Creative Commons. I'm using them for a noncommercial purpose so it's presumed that this use is allowable. Please contact me if this is inaccurate and I'm happy to remove any photos from the content archives.

Cost

GitHub Actions are entirely free for public repositories. All of the data the bot fetches from is also stored in GitHub, either in a repository or as Gists. Running this code was entirely cost free. Additionally, I made no money from the bot.

Resources

The bot relies on three sources of data:

  • This repo which stores the code and GitHub Actions workflow definition files. Under the Actions menu there are two separate workflows. One automatically executes every six hours and actually posts to twitter, while the other one is for manual invocation only and runs as a "Dry Run" to test the bot without posting to Twitter. The bot is written in Python.

  • Content repos which hold the images and "memory" metadata in a big json file.

  • A GitHub Gist for storing long-term state. We use this to track all of the previously posted memories to ensure that we don't re-post a memory. Instead of storing this in an actual database it seemed workable to use json in a Gist, since they can store up to 10MB of text each. For example, the Obama bot's current database is here.

Future Improvements

  • The bot right now just blows up if the tweet to be posted is longer than 280 characters. I've attempted to reduce the size of many of the captions provided by the White House/Archives, but many of them are very very long and would require some real editorial judgement to pare down.

  • I'd like to add more data sources, including those that may be updating in real time, such as currently-ongoing administrations or other sources, but that would require writing a scraper and better parsers to live-extract all the data.

  • Eventually the bot will post every memory in its database and break. I'll need to build a process for removing old posts from the state database so they over time be cycled back into rotation. Once that's done the bot can probably run forever, or at least until the Twitter/GitHub APIs implement breaking changes.

  • There are probably other bugs and stylistic improvements to be made to the bot code.

Contact

If you've got questions or what to chat about this project, the best bet is to reach out to me on twitter. My handle is @ywxwy. All other public contact info is on tom.horse.

About

Bot that posts photos and some metadata to twitter.

Topics

Resources

License

Stars

Watchers

Forks

Languages