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] [-v] [-s] [-k] [--input-cookie-file 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] {login} ...

Script designed to help download twitter spaces

positional arguments:
  {login}               (EXPERIMENTAL) Login to your account using username and password

options:
  -h, --help            show this help message and exit
  -v, --verbose
  -s, --skip-download
  -k, --keep-files
  --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/ap-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

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

Known Errors

Changing ID3 metadata in HLS audio elementary stream is not implemented....

This is an error in ffmpeg that does not affect twspace_dl at all as far as I know.

Service

To run as a systemd service please refer to https://github.com/Ryu1845/twspace-dl/blob/main/SERVICE.md

Docker

Run once

Use ${pwd} in powershell, or $(pwd) in bash

docker run --rm -v ${pwd}:/output ryu1845/twspace-dl -i space_url

Run as monitoring service

Using a cookie can help solve some problem with the twitter api. However, using one is not necessary.

Without cookie

  1. Download the docker-compose.yml, .env, monitor.sh files and put them in a folder named twspace-dl.
  2. Edit .env and fill in the Twitter username you want to monitor.
  3. [Optional] If you want to used a cookies file, put it into the folder and named it cookies.txt.
  4. docker-compose up -d

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-2022.2.25.2.tar.gz (20.2 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-2022.2.25.2-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twspace-dl-2022.2.25.2.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for twspace-dl-2022.2.25.2.tar.gz
Algorithm Hash digest
SHA256 51781fb88b203afeade0958ef71d680bc704ea3d89d795dbbc9f4ecb99403fbc
MD5 6d0abe75f5a038b09704bb3cfddaf579
BLAKE2b-256 997172895ad8d3b86b0cca496c15da4e24ae0f0ce6a436dce599e2c3270b347e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: twspace_dl-2022.2.25.2-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for twspace_dl-2022.2.25.2-py3-none-any.whl
Algorithm Hash digest
SHA256 616114c469437edac20625145055b99ad4be5ae60c9893c2d3c0158b35625755
MD5 0b27168f2e46f0e679fc1320fb5447d4
BLAKE2b-256 9d4202ca427ab6e3f0447ccccb15fec679f42ec3d8424f2d50816ec97c4f45bd

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