extratone / i

All of my iOS/iPhone-related documentation, files, media, etc.
The Unlicense
43 stars 0 forks source link

Twitter Spaces Downloader Shortcut #251

Open extratone opened 2 years ago

extratone commented 2 years ago

Updated 08242022-034359


Social


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

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

- [Tweet](https://twitter.com/VictorPopeJr/status/1561402991323889665) --- ## Jellycuts ```jelly 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 ```
extratone commented 2 years ago

pip install twspace-dl

extratone commented 2 years ago

Twitter Spaces Downloader Shortcut a-Shell Output