{"id":16649958,"url":"https://github.com/datamine/archive-tweets","last_synced_at":"2025-09-05T09:32:29.734Z","repository":{"id":86599528,"uuid":"78827350","full_name":"Datamine/Archive-Tweets","owner":"Datamine","description":"Archive and Delete Liked and Posted Tweets","archived":false,"fork":false,"pushed_at":"2017-01-29T05:18:20.000Z","size":9,"stargazers_count":32,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-17T02:03:42.878Z","etag":null,"topics":["python","python-3","tweets","twitter","twitter-api"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Datamine.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-13T07:46:41.000Z","updated_at":"2023-11-30T06:09:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4a71f6e-8dfc-4fb0-b3a6-22347a4ffc28","html_url":"https://github.com/Datamine/Archive-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/Datamine%2FArchive-Tweets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FArchive-Tweets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FArchive-Tweets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FArchive-Tweets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Datamine","download_url":"https://codeload.github.com/Datamine/Archive-Tweets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231893693,"owners_count":18442043,"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":["python","python-3","tweets","twitter","twitter-api"],"created_at":"2024-10-12T09:14:25.298Z","updated_at":"2024-12-31T22:50:54.748Z","avatar_url":"https://github.com/Datamine.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Archive-Tweets\n\nThis is a command-line tool written in Python 2.7, \nto archive or delete all tweets that you have posted, or that you have liked. \nIt is optionally possible to also archive all attached media (images, etc.)\n\n## Use\n\nWindows: set up a UNIX-compatible interface, like Cygwin. Then follow\nthe Linux/OSX instructions below.\n\nLinux/OSX: Open your terminal, clone this repo, `pip install requirements.txt`.\nThis software will need to authenticate with Twitter, so you'll need to \n[create an app on Twitter](https://apps.twitter.com/) and insert the credentials obtained\ninto the `credentials.txt` file.\n\nThen you can run the script. I suggest using `-W ignore` to suppress SSL warnings.\nThere are several flags:\n\n- `--posted` to indicate that you want to select the tweets you have personally made/retweeted\n- `--liked` to indicate that you want to select the tweets you have liked\n- `--archive` to indicate that you want to download the selected tweets\n- `--delete` to indicate that you want to delete the selected tweets (un-like in the case of `--liked`)\n- `--media` to indicate that if you're archiving tweets, you also want to save their media attachments (images, etc.)\n\nYou may select only one of `--posted` and `--liked` at a time, not both. The `--media`\nflag requires the `--archive` flag: you can only archive the media attachments if you're already\narchiving the tweets in the first place.\n\nSome examples of correct use:\n\n`$ python -W ignore TwitterTool.py --archive --media --liked`    \n`$ python -W ignore TwitterTool.py --archive --delete --posted`\n\nThe software then creates a folder, `Archive-Liked-Tweets` or `Archive-Personal-Tweets`,\ndepending on whether you selected `--liked` or `--posted`, respectively, and within that,\ncreates a new folder for every tweet, with the path name given by the timestamp of the tweet's \npublication and the tweet's unique identifier. Within every tweet's folder is the pretty-printed `.json` \nobject representing the tweet, as well as any attached media files, if the option to download them was selected.\n\n## Rate Limits\n\nSince this software is reliant on the Twitter API, the rate limits apply:\n\n- For personal tweets, you can make \n[900 queries every 15 minutes](https://dev.twitter.com/rest/reference/get/statuses/user_timeline), \nin blocks of 200 requests per query. \n\n- For liked tweets, you can make \n[75 queries every 15 minutes](https://dev.twitter.com/rest/reference/get/favorites/list), \nin blocks of 200 requests per query. \n\nWith these generous limits in place, you should find it possible to handle your entire\ntimeline rather swiftly. Should you hit a rate limit, the app will simply sleep until\nthe fifteen minute period is over.\n\n## Display\n\nDisplay of tweets has not been a priority in development so far. I believe there are other\nOpen-Source projects that have done [a reasonable job](https://github.com/amwhalen/archive-my-tweets) at this, which you can\nadapt straight-forwardly. (I'd be happy to accept a PR that generates pages rendering the archived tweets. It is my plan to do this eventually.)\n\nTo search all the tweets in a directory for some text, `cd` into the relevant directory, and then use:\n`grep -rnw . -e \"\u003cyour text here\u003e\"`\ne.g. `grep -rnw ./Archive-Liked-Tweets -e \"rice pudding\"`\n\n## Notes\n\n- The tool relies on the [Python-Twitter](https://github.com/bear/python-twitter) library,\nwhich provides a helpful wrapper around Twitter's API. Duly note that Twitter makes changes\nto their API once in a while (months/years), which makes it possible for the objects \nthat the API functions (`api.GetUserTimeline, api.GetFavorites`, etc.) return to be erroneous.\n\nTo avoid such errors, you should run this tool from the REPL and make a few calls to the API,\nand double-check the JSON objects that you get against the [Twitter API](https://dev.twitter.com/rest/reference).\nThe documentation for every endpoint has examples of the returned objects.\n\nExample of REPL use:\n```\n\u003e\u003e\u003e from TwitterTool import *\n\u003e\u003e\u003e api = credentials_and_authenticate()\n\u003e\u003e\u003e api.GetStatus(824666495305162752).__dict__['_json']                             \n\u003e\u003e\u003e api.GetUserTimeline(count=1)\n```\n\n- One frequent Twitter pattern is the posting of threads or tweetstorms, which this software\ncurrently does not handle automatically. You'd have to `like` all the tweets in a tweetstorm\nto archive all of them. It would be more convenient if you could just `like` the first one,\nand the software also grabs the rest for you. This is a bit of an inconvenience. and it's\na currently open issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamine%2Farchive-tweets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatamine%2Farchive-tweets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamine%2Farchive-tweets/lists"}