This article will show how anyone can download the recording archive of a Twitterspace as an audio file to their PC or smartphone.
Until last June 2022, the specification was that the archive of recordings in the Twitter space would be deleted after one month, but since then the specification has changed and the archive is stored for an unlimited period of time, allowing for semi-permanent listening playback as long as the host continues to publish.
However, there is no guarantee that the recording archive will be available to the public forever, and many people would like to save and save useful space archives offline.
After all, I am one of them. So I recently created a web tool to easily download an archive of recordings from the Twitter space as an audio file.
The main part of this presentation is an introduction to the program for the general public. In the second half, for programmers, we will explain how to download the Twitterspace archive with a single command using Python.
Download with Twitter Space Downloader
First, obtain a direct link to the Twitter space you wish to download.
When you access the above site, there is a space at the bottom to enter a space link, so enter the space and press the “Execute” button on the right.
The item is then added to the “waiting list for download” and enters the download processing queue on the server side, so the dunload process is executed in order.
If the site is busy, it may take some time for the download process to run. If this site is well received, we will consider increasing resource allocation to improve processing speed, while also considering the server load.
When the download process is completed on the server side, the text on the right button of each item changes from “In process…” to “Download. to “Download”.
This site uses a browser cookie to store your download history, which will not be reset if you close the page or leave while waiting for the process to complete. However, 24 hours after the download process is complete, the data is deleted from the server and the history is reset.
This is all you need to do to download the Twitter space. The file format is “m4a”.
Downloading Twitter space using the Python library “twspace-dl”.
It is very easy to explain, so I will give a brief introduction.
The library used is called “twspace-dl”. The web tool I created this time also uses this library in the backend.
This library is available for Windows/Linux/Mac, so you can use it in your individual environment. I am Windows. The environment is “Python v 3.10”.
pip install twspace-dl
Use the above command to install “twspace-dl”.
After installation, you will also need an open source media editing tool called “ffmpeg”, which you can download from the official site below and install.
After installation, add the path to the installed “ffmpeg.exe” to the environment variable and confirm that the version information is displayed by “ffmpeg -L” from the command line.
twspace_dl -i 'space_url' -o 'output_path'
You can then use the above command to download the Twitterspace as an audio file in “m4a” format. The “-o” option should be set if you wish to specify an output path. If the “-o” option is omitted, the output will be directed to the current directory where the command is executed.
There are many more options, which are listed below for reference.
usage: twspace_dl [-h] [-v] [-s] [-k] [-l] [--input-cookie-file COOKIE_FILE] [--username USERNAME] [--password PASSWORD] [--output-cookie-file OUTPUT_COOKIE_FILE] [-i SPACE_URL | -U USER_URL] [-d DYN_URL] [-f URL] [-M PATH] [-o FORMAT_STR] [-m] [-p] [-u] [--write-url URL_OUTPUT] twspace_dl: error: unrecognized arguments: --version yamaz ~ ♥ 13:38 twspace_dl --help usage: twspace_dl [-h] [-v] [-s] [-k] [-l] [--input-cookie-file COOKIE_FILE] [--username USERNAME] [--password PASSWORD] [--output-cookie-file OUTPUT_COOKIE_FILE] [-i SPACE_URL | -U USER_URL] [-d DYN_URL] [-f URL] [-M PATH] [-o FORMAT_STR] [-m] [-p] [-u] [--write-url URL_OUTPUT] Script designed to help download twitter spaces options: -h, --help show this help message and exit -v, --verbose -s, --skip-download -k, --keep-files -l, --log create logfile --input-cookie-file COOKIE_FILE input: -i SPACE_URL, --input-url SPACE_URL -U USER_URL, --user-url USER_URL -d DYN_URL, --from-dynamic-url DYN_URL use the dynamic url for the processes(useful for ended spaces) example: https://prod-fastly-ap-northeast- 1.video.pscp.tv/Transcoding/v1/hls/zUUpEgiM0M18jCGxo2eSZs99p49hfyFQr1l4cdze- Sp4T-DQOMMoZpkbdyetgfwscfvvUkAdeF-I5hPI4bGoYg/non_transcode/ap- northeast-1/periscope-replay-direct-prod-ap-northeast-1-public/audio- space/dynamic_playlist.m3u8?type=live -f URL, --from-master-url URL use the master url for the processes(useful for ended spaces) example: https://prod-fastly-ap-northeast- 1.video.pscp.tv/Transcoding/v1/hls/YRSsw6_P5xUZHMualK5- ihvePR6o4QmoZVOBGicKvmkL_KB9IQYtxVqm3P_vpZ2HnFkoRfar4_uJOjqC8OCo5A/non_transcode/a p-northeast-1/periscope-replay-direct-prod-ap-northeast-1-public/audio- space/master_playlist.m3u8 -M PATH, --input-metadata PATH use a metadata json file instead of input url (useful for very old ended spaces) output: -o FORMAT_STR, --output FORMAT_STR -m, --write-metadata write the full metadata json to a file -p, --write-playlist write the m3u8 used to download the stream(e.g. if you want to use another downloader) -u, --url display the master url --write-url URL_OUTPUT write master url to file login: --username USERNAME --password PASSWORD --output-cookie-file OUTPUT_COOKIE_FILE