How to Download Twitter Spaces That Aren't Yours

swyx

6 reactions 2022-02-28

I recently caught the tail end of a TimescaleDB Twitter space that I wanted to snip for my mixtape in future. Spaces are only saved for a few days so if you want them beyond that you will have to download it. However, Twitter only lets the host of the space download. I tried using youtube-dl for it but it is currently unsupported.

Fortunately 89z on GitHub is very actively maintaining his own project that interfaces with some arbitrary social media: https://github.com/89z/mech and answered my questions enough to get me using it!

The project bundles releases only for Windows, so here’s a quick sequence of instructions for Mac.

Prerequisites

In case you are a nontechnical person arriving from Google - these instructions are meant for developers but written out step by step as faithfully as I can. The only prerequisite you need is:

but I won’t spend any time teaching you how to use the terminal.

First get the Space ID

The primary piece of knowledge you need is the Twitter Space ID. Given a Twitter space URL https://twitter.com/i/spaces/1RDGlgoYkDkK, the space ID is 1RDGlgoYkDkK. No API key is needed as far as I can tell, which is just peachy.

Current instructions (May 2022)

# make sure you have `git` installed!
git clone https://github.com/89z/mech
cd mech
cd twitter
# make sure you have `go` installed!
go build

This builds a binary called twitter which you can run:

# mac
./twitter -s 1RDGlgoYkDkKL   
# windows
twitter -s 1RDGlgoYkDkKL   

This starts the download:

$ ./twitter -s 1RDGlgoYkDkKL    
POST https://api.twitter.com/1.1/guest/activate.json
GET https://twitter.com/i/api/graphql/Uv5R_-Chxbn1FEkyUkSW2w/AudioSpaceById?variables=%7B%22id%22%3A%221RDGlgoYkDkKL%22%2C%22isMetatagsQuery%22%3Afalse%2C%22withBirdwatchPivots%22%3Afalse%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withReplays%22%3Afalse%2C%22withScheduledSpaces%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Afalse%2C%22withSuperFollowsUserFields%22%3Afalse%7D
GET https://twitter.com/i/api/1.1/live_video_stream/status/28_1496228425874374659
GET https://prod-fastly-us-east-1.video.pscp.tv/Transcoding/v1/hls/Ze8MHZCOuvGIbhBQYBAevAIotnQEwAixsGxoUgsOOJaJsf0Qm6Kxhwt3JH77MIxknSr_2nobkgkUDyYP9YwzbQ/non_transcode/us-east-1/periscope-replay-direct-prod-us-east-1-public/audio-space/playlist_16801097405082696033.m3u8?type=replay
0/1299 /Transcoding/v1/hls/Ze8MHZCOuvGIbhBQYBAevAIotnQEwAixsGxoUgsOOJaJsf0Qm6Kxhwt3JH77MIxknSr_2nobkgkUDyYP9YwzbQ/non_transcode/us-east-1/periscope-replay-direct-prod-us-east-1-public/audio-space/chunk_1645642768437487255_0_a.aac
1/1299 /Transcoding/v1/hls/Ze8MHZCOuvGIbhBQYBAevAIotnQEwAixsGxoUgsOOJaJsf0Qm6Kxhwt3JH77MIxknSr_2nobkgkUDyYP9YwzbQ/non_transcode/us-east-1/periscope-replay-direct-prod-us-east-1-public/audio-space/chunk_1645642768440813639_1_a.aac
2/1299 /Transcoding/v1/hls/Ze8MHZCOuvGIbhBQYBAevAIotnQEwAixsGxoUgsOOJaJsf0Qm6Kxhwt3JH77MIxknSr_2nobkgkUDyYP9YwzbQ/non_transc
# and so on...

The final file is an aac file which is still annoying but at least convertible and playable in Audacity.

image

Old Instructions (Feb 2022)

# make sure you have `git` installed!
git clone https://github.com/89z/mech
cd mech
# update: v1.49 onwards has the twitter spaces support again! https://github.com/89z/mech/issues/18#issuecomment-1058789325
# git reset --hard v1.46.6 # only if you need to pin to a specific version that supports Twitter spaces, otherwise delete this line
cd cmd/twitter
go build

Get updates on new posts and projects

3000+ subscribers including my Mom – see past issues

Reactions: 👍 4 🎉 2
Webmentions
Loading...