Twitter Spaces Downloader Shortcut

Updated 08242022-143402


Social

proud of this one! download recorded Twitter Spaces and convert them to .mp3 locally and swiftly. https://routinehub.co/shortcut/12865/

I did it folks!

if you've been looking for a seamless way of downloading #TwitterSpaces locally on your device, well... https://t.co/7X0VXmSag3 pic.twitter.com/aRrC2o2og6

— ⓓⓐⓥⓘⓓ ⓑⓛⓤⓔ (@NeoYokel) August 24, 2022

proud of this one!

download recorded Twitter Spaces and convert them to .mp3 locally and swiftly. https://t.co/k5w7Xkyx2q pic.twitter.com/CvrlidtQZ9

— ⓓⓐⓥⓘⓓ ⓑⓛⓤⓔ (@NeoYokel) August 24, 2022


Download recorded Twitter Spaces and convert them to .mp3 locally and swiftly.

pip install twspace-dl
pip install twspace-dl

Requirements

This shortcut uses the most reliable command line tool for downloading Twitter Spaces (at the time of its release, anyway) - a python package called twspace-dl. Even first time users of a-Shell or a-Shell Mini should find its installation process - pip install twspace-dl - absurdly quick.

By default, it receives a single recorded Twitter Spaces share URL (ex: https://twitter.com/i/spaces/1BdGYwZBgEzxX) from either the Share Sheet or the system clipboard, from which it parses the ID of the space before inserting the full URL into a standard twspace-dl download command:

twspace_dl -i ${URL}

Because of a-Shell's unique configuration and the way it interacts with Shortcuts, -o ~/Documents/audio/${id}.m4a is also added to the command to specify a usable location of the initial .m4a file.

(If you're satisfied with that format, feel free to delete the following command.)

Twitter Spaces Downloader Shortcut a-Shell Output

Since ffmpeg comes with both a-Shells, only a single additional step is required to convert incoming Spaces audio files to .mp3 format:

ffmpeg -i ~/Documents/audio/${id}.m4a -c:v copy -c:a libmp3lame -q:a 4 ~/Documents/audio/${id}.mp3

At least at the time of this writing, I think you'll find this exact configuration to be particularly efficient/apt for the average bitrates we're currently seeing from the platform in this context.


Video

Description

Download recorded Twitter Spaces and convert them to .mp3 locally and swiftly.

※⃣ ※⃣ ※⃣ ※⃣ ※⃣ ※⃣ ※⃣ ※⃣ ※⃣ ※⃣ World Wide Web: https://bilge.world Contact Card: https://davidblue.wtf/db.vcf Twitter: https://twitter.com/NeoYokel Mastodon: https://mastodon.social/@DavidBlue Instagram: https://instagram.com/asphaltapostle davidblue@extratone.com

【※】【※】【※】【※】【※】【※】【※】【※】【※】【※】

『※』『※』『※』『※』『※』『※』『※』『※』『※』『※』

≋※≋※≋※≋※≋※≋※≋※≋※≋※≋※≋

░※░※░※░※░※░※░※░※░※░※░


Example Output

https://t.co/BWl8J0wOKe

— Southside Vic (@VictorPopeJr) August 21, 2022

Jellycuts

import Shortcuts
import aShell
#Color: grape, #Icon: microphone

/*
Download recorded Twitter Spaces and convert them to .mp3 locally and swiftly.

𝗠𝘆 𝗰𝗼𝗻𝘁𝗮𝗰𝘁 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Email: davidblue@extratone.com
Contact card: https://davidblue.wtf/db.vcf
RoutineHub Profile: https://routinehub.co/user/blue
GitHub: https://github.com/extratone
iOS-specific Repository: https://github.com/extratone/i
Telegram: https://t.me/DavidBlue
Telegram Channel: https://t.me/extratone
Discord: https://davidblue.wtf/discord
Twitter: https://twitter.com/NeoYokel
Reddit: https://reddit.com/u/asphaltapostle
Mastodon: https://mastodon.social/@DavidBlue
EVERYWHERE: https://davidblue.wtf/socialdrop
*/
var url = ShortcutInput
urlComponent(url: "${url.as(URL)}", component: Path) >> urlComponent
splitText(text: Component of URL, separator: Custom, customSeparator: "spaces/") >> splitText
getItemFromList(list: Split Text, type: Last Item) >> getItemFromList
var id = Item from List
text(text: "twspace_dl -i ${id} -o ~/Documents/audio/${id}.mp3 ") >> text
text(text: "ffmpeg -i ~/Documents/audio/${id}.m4a -c:v copy -c:a libmp3lame -q:a 4 ~/Documents/audio/${id}.mp3") >> text 1
text(text: "cp ~/Documents/audio/${id}.mp3 ~group/${id}.mp3") >> text 2
text(text: "open shortcuts://") >> text 3
executeCommand(command: {text}, {text 1}, {text 2}. {text 3}, openWindow: default, keepGoing: true)
waitToReturn()
getFile(fileName: "${id}.mp3") >> file
share(file: {file}) >> share