Skip to content

Instantly share code, notes, and snippets.

@rijieli
Last active June 15, 2024 17:56
Show Gist options
  • Save rijieli/dac4970b9d41c14a98bb765bcf9f77a8 to your computer and use it in GitHub Desktop.
Save rijieli/dac4970b9d41c14a98bb765bcf9f77a8 to your computer and use it in GitHub Desktop.
Download Twitter Spaces Audio By URL

python -m venv .venv

source .venv/bin/activate

pip install m3u8downloader

downloadm3u8 -o foo.mp4 spaces_m3u8_url

ffmpeg -i foo.mp4 -b:a 192K -vn bar.mp3

ffmpeg -i spaces_m3u8_url -b:a 192K -vn bar.mp3
@rijieli
Copy link
Author

rijieli commented Mar 24, 2022

Requirements

  • FFmpeg
  • Python 3.9

Find spaces_m3u8_url

See This Comment

@rijieli
Copy link
Author

rijieli commented Mar 24, 2022

downloadm3u8 only support mp4 output format, so this need extra file convert process.

see: http://pypi.org/project/m3u8downloader/

@larvata
Copy link

larvata commented Mar 24, 2022

I think you can download hls url with ffmpeg, e.g.:

ffmpeg -i spaces_m3u8_url -b:a 192K -vn bar.mp3

@rijieli
Copy link
Author

rijieli commented Mar 24, 2022

You are right, I made a stupid mistake

@NabilHunt
Copy link

I think this one no longer works. (filtering using m3u8 returns nothing)

@larvata
Copy link

larvata commented May 20, 2023

@NabilHunt tried just now, it still works.
go to the space page: https://twitter.com/<username>/status/<tweet_id>
and click the Play Recording button
the m3u8 will be showed in network panel.

@NabilHunt
Copy link

NabilHunt commented May 21, 2023

@larvata Thanks!

So it's working! my mistake is that I was opening: https://twitter.com/i/spaces/<id>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment