{"id":17026272,"url":"https://github.com/kevboh/expiring-tweets","last_synced_at":"2025-04-05T20:29:38.504Z","repository":{"id":43996581,"uuid":"171178121","full_name":"kevboh/expiring-tweets","owner":"kevboh","description":"Deletes old tweets, archiving them as json to Dropbox.","archived":false,"fork":false,"pushed_at":"2022-12-10T17:29:48.000Z","size":65,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-11T20:49:56.785Z","etag":null,"topics":["dropbox","forgetting","the-fallibility-of-memory","twitter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevboh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-17T22:08:30.000Z","updated_at":"2020-02-08T16:34:45.000Z","dependencies_parsed_at":"2023-01-26T05:31:11.816Z","dependency_job_id":null,"html_url":"https://github.com/kevboh/expiring-tweets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevboh%2Fexpiring-tweets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevboh%2Fexpiring-tweets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevboh%2Fexpiring-tweets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevboh%2Fexpiring-tweets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevboh","download_url":"https://codeload.github.com/kevboh/expiring-tweets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247398157,"owners_count":20932674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dropbox","forgetting","the-fallibility-of-memory","twitter"],"created_at":"2024-10-14T07:31:26.739Z","updated_at":"2025-04-05T20:29:38.486Z","avatar_url":"https://github.com/kevboh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# expiring-tweets\n\nSimple script (and, optionally, Heroku app) to:\n\n1. delete tweets older than a certain interval, currently hardcoded to be 14 days, and\n2. delete likes, saving any links in them to Pinboard.\n\nDeleted tweets and likes are saved as JSON in a Dropbox app's `Apps/app-name` folder for your own personal curiosity. Preconfigured to run in Heroku with Heroku Scheduler.\n\nThis was something I threw together to satisfy my own constraints—I wanted a Dropbox archive, specifically—and because I wanted to see how these pieces would fit together. If you don't care about the Dropbox bit, there are [probably better solutions](https://www.google.com/search?q=delete+tweets+older+than).\n\n## How to use it\n\n1. Wherever you want to run this, on your own machine or in Heroku, you need to set some env vars. You'll need to create a [Twitter app](https://developer.twitter.com) and [Dropbox app](https://www.dropbox.com/developers/apps) to get the necessary tokens. When creating the Dropbox app, specify the dedicated folder option—your tweets will appear there.\n\n```sh\nexport TWITTER_CONSUMER_KEY=\"your-consumer-key\"\nexport TWITTER_CONSUMER_SECRET=\"your-consumer-secret\"\nexport TWITTER_ACCESS_TOKEN_KEY=\"your-twitter-access-token\"\nexport TWITTER_ACCESS_TOKEN_SECRET=\"your-twitter-access-token-secret\"\nexport TWITTER_USERNAME=\"your-username-on-twitter\"\nexport DROPBOX_ACCESS_TOKEN=\"your-dropbox-app-access-token\"\nexport PINBOARD_API_TOKEN=\"user:1234\"\n```\n\n2. You can optionally throw some tweet IDs (the long number at the end of a single tweet's url) **as a string** in the `ignored-tweets.json` file. Tweets with IDs in that json array will not be deleted (and thus not saved to Dropbox).\n\n3. With those tokens set and json configured, you can run this locally with `yarn install \u0026\u0026 node expire-tweets.js`. Please be aware that there's no confirm step here—your tweets will immediately start disappearing. Because Dropbox's API is a little wonky and because I care more about the tweets being deleted than true 1:1 archiving, if a tweet's upload to Dropbox fails it will still be deleted. If there's an actual error, though—like a 503 returned, which I saw once in my many rounds of running this—the entire script will stop.\n\n4. This repo is also preconfigured to be runnable as a Heroku app, with the script triggered via Heroku Scheduler. [Create a Heroku app](https://dashboard.heroku.com/), add the heroku remote to this repo, set your env vars as above, and push. Then add the Heroku Scheduler add-on and configure a `tweets-worker` job and a `likes-worker` job to run as frequently or infrequently as you please. The actual web app does nothing.\n\n## Additional Configuration\n\nIf you want to change the number of days to retain tweets, edit the `DAYS_THRESHOLD` constant at the top of `expire-tweets.js`. If you want to mess with the number of tweets downloaded from Twitter and sent to Dropbox per respective API call, edit the `BATCH_SIZE` constant—keeping in mind that Twitter doesn't allow timeline fetches larger than 200 tweets, and that I saw strange Dropbox errors with more than 50ish files in flight simultaneously.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevboh%2Fexpiring-tweets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevboh%2Fexpiring-tweets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevboh%2Fexpiring-tweets/lists"}