Skip to main content

twitter-archive-unshorten

Twitter's archive download includes shortened t.co URLs instead of the original URLs that you tweeted. If Twitter ever goes away, the server at t.co won't be available to respond to requests.

twitter-archive-unshorten is a small Python program that will examine all the JavaScript files in the archive download and rewrite the t.co short URLs to their original full URL form. This means the context for your archived tweets will make a little more sense after Twitter is gone. Maybe you can look up those URLs in the Internet Archive if they are no longer available. This would be impossible if all you had was the short URL.

Install

$ pip3 install twitter-archive-unshorten

Run

  1. Unzip your Twitter archive zip file.
  2. Open a terminal window and run: twitter-archive-unshorten /path/to/your/archive/directory/

It might take a while, depending on how many tweets you have. Once it's finished you should be able open your archive and interact with it without the t.co URLs.

The mapping of short URLs to long URLs that was used is saved in your archive directory as data/shorturls.json.

Test

If you'd like to develop further you can run the existing tests:

$ pip3 install pytest
$ pytest test.py

Metadata

Release files for twitter-archive-unshorten 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twitter-archive-unshorten 0.0.10
File Size Uploaded
twitter_archive_unshorten-0.0.10.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for twitter-archive-unshorten 0.0.10
File Interpreter ABI Platform
twitter_archive_unshorten-0.0.10-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / twitter_archive_unshorten-0.0.10.tar.gz

Download URL twitter_archive_unshorten-0.0.10.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
48aebf116b1e8ff57f584d286caa7af38ad33e51ae82a2158588b67f3a807023
BLAKE2b-256 checksum
How to use checksums
03ae98dd4d1f2ea99a0c9c9ce3b923ed9fdcd8ca6fb86b0dff6f3c5a5ab4f6a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release files / twitter_archive_unshorten-0.0.10-py3-none-any.whl

Download URL twitter_archive_unshorten-0.0.10-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15d9ed41a76cf60b6a2df67f62a3984d3934da56594b341e0433168c45e0caf3
BLAKE2b-256 checksum
How to use checksums
687d6c4cd1d069d8ca1417713f3cbac4ec748137b15a4314af4c6b6ab00ea156
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page