
Show HN: YouTube-dl wrapper with added features to easily manage YouTube audio - pseudoroot
https://github.com/pseudoroot/yt-audio
======
krick
Cannot understand what exactly is that. I have used a simple alias called
(unsurprisingly) yt-audio for years, which is youtube-dl with appropriate
flags (-x, --audio-quality, --download-archive, -o, etc.), and this seems to
be exactly that, only written in python for some reason.

~~~
3PS
For the record, if you only use youtube-dl for the purposes of downloading
audio (like me), then you can keep a config file in $HOME/.config/youtube-
dl/config with default arguments so you don't have to look them up each time.
For example, here's a sample from my config:

    
    
        # extract audio only
        -x
        # stick to mp3
        --audio-format mp3
        # get rid of the annoying URL stuff at the end
        -o "%(title)s.%(ext)s"

~~~
rwnspace
A minor extension of the idea here and of the GP - I have aliased 'yt' and
'ytm' to target two different config files in the same folder path you gave.

------
crystaldev
Anyone else write a a lot of ripper scripts like youtube-dl but never share
them for fear of starting an arms race with the content provider? It's easy to
rip most .ts/XHR video streams with a bash loop.

~~~
orf
youtube-dl supports a _lot_ of providers/sites[1]. Perhaps it's easier to
contribute a new downloader (it's pretty simple[2]), and judging by the number
of updates required most sites don't care that much.

1\. [https://github.com/ytdl-org/youtube-
dl/tree/master/youtube_d...](https://github.com/ytdl-org/youtube-
dl/tree/master/youtube_dl/extractor)

2\. [https://github.com/ytdl-org/youtube-
dl/blob/master/youtube_d...](https://github.com/ytdl-org/youtube-
dl/blob/master/youtube_dl/extractor/cartoonnetwork.py#L24)

------
whywhywhywhy
YouTube-dl demolishes 100 pain points of using the modern web

This wrapper gets rid of the only pain point in using YouTube-dl which was
having to google every time you wanted just the audio.

Great work

~~~
jchw
Off the top of my head, isnt that just the -x flag?

~~~
alexis_fr
I’m not near a computer but I was persuaded I have used youtube-dl -f mp3
[https://..](https://..). before.

~~~
jchw
Well, if you use just -x alone, it will not attempt to get the format you ask
for. So you will probably end up with a m4a (mp4 container with just AAC
audio) or ogg (vorbis/i think opus?) depending on whether the best quality is
encoded in h264, WebM/VP8 or WebM/VP9. Which may not be what you want.

OTOH, if you specify a format directly without -x, it may not extract the
audio alone. For example if you _wanted_ M4A, you'd specify -x on top of
specifying the format explicitly.

edit: as krick points out though, it doesn’t seem videos generally have an mp3
format, at least on YouTube.

------
qwerty456127
> MP3 works fine. M4a does not work.

Doesn't make much sense then. YouTube doesn't have MP3 so MP3 means
unnecessary transcoding i.e. quality and time loss.

Why would anybody convert to MP3 today having AAC and OPUS originals? OPUS
provides unprecedented quality at all bitrates (better than AAC and MP3), AAC
also provides great quality&compression (better than MP3) and plays
everywhere.

~~~
pseudoroot
When using file's metadata method for tracking downloaded records, m4a file
extension is not supported. Metadata method relies on 'purl' metadata tag. And
m4a format has no purl tag, so it does not work.

One can use archive file method instead.

This limitation has nothing to do with yt-audio's capability of downloading
m4a format. M4a limitation only applies to metadata method of tracking
downloaded tracks.

~~~
qwerty456127
Why rely on tags if there is the ID appended to the file name and the file
name is the title of the video? Youtube-dl names the files it downloads this
way by default, just leave it as it is and you can identify the files easily.

------
igetspam
Typo in the readme: yt-audo

I'd make a PR but I'm not near a computer right now. This is great. I have a
couple audio files I need to pull for my kid and this is gonna save me a
couple steps. Thank you!

~~~
asadlionpk
done

------
monkeydust
Nice, I have script that does speech to text using google cloud and I wanted
an easy way to get text out of youtube videos so this will help.

~~~
genidma
Can you please share the code? Thx!

------
pseudoroot
yt-audio has added features like custom CLI arguments (users can setup their
own CLI arguments to manage playlists/audios), save each audio/playlist to a
separate directory, added option to keep track of downloaded titles without
archive file, and more ...

------
cordite
Will this get into brew?

~~~
pseudoroot
Haven't used brew before. I'll look into it when I'll get some free time.

------
air7
OT but does ytdl violate YouTube's tos? I'd guess so as it skips the ads. Can
it be used commercially, say?

~~~
nadermx
How does simply opening a website bind you to any contract?

~~~
edgineer
It isn't backed by the force of the US judicial system, but when YouTube says
a person's Google account will be banned for commercial usage, I trust them.

~~~
LeoPanthera
YouTube (and youtube-dl) does not require you to be logged in.

And anyway I don't see how downloading a video is "commercial usage".

------
whatsmyusername
youtube-dl is the only thing that makes the modern web actually usable.

I ended up writing a bot that runs on a docker scheduled task and looks at
trello. I can drop a youtube link on the board and it will grab the audio.

Great for when I hear a song somewhere that I want to add to my phone later.

~~~
mmastrac
How are you managing this integration? IFTTT?

~~~
whatsmyusername
It's just python running in a docker container in a scheduled task on ECS once
an hour. I built it to test the pattern for work.

I use a trello integration library, shell out for youtube-dl, run a normalizer
on anything it pulls, boto3 the files to s3 and then call SNS to text me it's
done. I pick the files up later.

When youtube-dl updates (which it does, regularly) I just redeploy as it's
tagged for latest in the requirements file. I could add this update step to
the container or pull a copy from s3 that I maintain, but I'm not a big fan of
pulling in code at runtime.

Trello is acting as an SQS queue, RabbitMQ queue, or redis set. If something
fails the code will dump the error text into the card and retry indefinitely
till I fix it.

This entire setup costs me < $1 a month. I think my route53 domains cost more.

