Skip to main content

The only tool to record Twitter spaces (yet)

Project description

Twspace-dl

PyPI PyPI DLs Github Releases DLs

A python module to download twitter spaces.

Requirements

ffmpeg

Install

From portable binaries

Linux

Windows

From PyPI

pip install twspace-dl

From source

git clone --depth 1 https://github.com/Ryu1845/twspace-dl
cd twspace-dl
pip install .

Usage

twspace_dl -i space_url
With binaries

Windows

.\twspace_dl.exe -i space_url

Linux

./twspace_dl.bin -i space_url

Features

Here's the output of the help option

usage: twspace_dl [-h] [-t THREADS] [-v] [-s] [-k] [-i SPACE_URL] [-U USER_URL] [-M PATH] [-d DYN_URL] [-f URL]
                  [-o FORMAT_STR] [-m] [-p] [-u]

Script designed to help download twitter spaces

optional arguments:
  -h, --help            show this help message and exit
  -t THREADS, --threads THREADS
                        number of threads to run the script with(default with max)
  -v, --verbose
  -s, --skip-download
  -k, --keep-files

input:
  -i SPACE_URL, --input-url SPACE_URL
  -U USER_URL, --user-url USER_URL
  -M PATH, --input-metadata PATH
                        use a metadata json file instead of input url (useful for very old ended spaces)
  -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-ihvePR6o4QmoZV
                        OBGicKvmkL_KB9IQYtxVqm3P_vpZ2HnFkoRfar4_uJOjqC8OCo5A/non_transcode/ap-
                        northeast-1/periscope-replay-direct-prod-ap-northeast-1-public/audio-
                        space/master_playlist.m3u8

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

Format

You can use the following identifiers for the formatting

%(title)s
%(id)s
%(start_date)s
%(creator_name)s
%(creator_screen_name)s
%(url)s

Example: [%(creator_screen_name)s]-%(title)s|%(start_date)s

Service

There's an example service file there You'll have to modify different stuff depending on how you installed or not the script.

I'd be very grateful if someone made a PR with a bash script automating those ;)

Cloned Repository

In that case, you'll have to modify the WorkingDirectory to where you cloned the repo.

Pip

  1. Change WorkingDirectory to where you want the spaces to be downloaded.
  2. Find where your executable is by running which twspace_dl in your terminal.
  3. Change the /usr/bin/python twspace_dl part to the path of your executable.

Now to install the service, you can either install it as a user service(recommended if on your personal desktop), or as a normal service.

User

  1. Copy the file you modified earlier to ~/.config/systemd/user(create the systemd directory if it doesn't exist).
  2. run
systemctl --user daemon-reload
systemctl --user start twspace-dl@USER_ID.service

USER_ID is the part after https://twitter.com/ in the url of a twitter profile (i.e https://twitter.com/USER_ID)

To keep it working after restarts run:

systemctl --user enable twspace-dl@USER_ID.service

System

  1. Copy the file you modified earlier to /etc/systemd/system.
  2. run
sudo systemctl daemon-reload
sudo systemctl start twspace-dl@USER_ID.service

USER_ID is the part after https://twitter.com/ in the url of a twitter profile (i.e https://twitter.com/USER_ID)

To keep it working after restarts run:

sudo systemctl enable twspace-dl@USER_ID.service

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twspace-dl-2021.12.18.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twspace_dl-2021.12.18.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file twspace-dl-2021.12.18.0.tar.gz.

File metadata

  • Download URL: twspace-dl-2021.12.18.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for twspace-dl-2021.12.18.0.tar.gz
Algorithm Hash digest
SHA256 cce3b251b1471098a4938e952e1d292b4f8da1d4424f34b0e28b6e4fb4031ab2
MD5 c19a0d7665314c279ab62ef9093f574e
BLAKE2b-256 f313050ef35183b612d17959793d872662cf7a72fac9cc2868be91ed4e52ad86

See more details on using hashes here.

File details

Details for the file twspace_dl-2021.12.18.0-py3-none-any.whl.

File metadata

  • Download URL: twspace_dl-2021.12.18.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for twspace_dl-2021.12.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b7fced089cd7e495a4dadec9461f871f89659291f2ff6c400fe69e1c859e348
MD5 67db39775ef01a8c1269271bde7ff687
BLAKE2b-256 166f31fd1fd6eaec0e3a418a65ea4c6b192bdbb62077aa6923805c1d88ce977a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page