When i download images or youtube videos, i have to juggle between copying urls and pasting them into a terminal, which is tiresome. I made a script, that monitors the clipboard and echoes changes that happened. All you have to do is pipe it to parallel and copy stuff. It saves me lots of time #!/bin/bash
clipCont=$(xsel --clipboard) #echo $clipCont while sleep 0.5; do new_clipCont=$(xsel --clipboard) if ! [[ "$clipCont" == "$new_clipCont" ]];then #If new echo $new_clipCont fi clipCont=$new_clipCont done
Example: ./script.sh | parallel -L 1 youtube-dl --extract-audio --audio-format opus
This is userful but doesn't it affect performance by checking the clipboard every .5 seconds?
Landon Price
It doesn't affect performance and i you can adjust the rate of refreshing. I will rewrite it in C one day and post it to Jow Forums
Luis Brown
>copying urls and pasting them into a termina
Why would you even do this?
Connor Young
Good idea
Oliver Reyes
Too lazy to find a more efficient way?
Austin Williams
This is convenient and it works everywhere. I use it for downloading lots of files. I have a script to quickly download from unsplash and i use it with this
Samuel Miller
Just bind a hotkey in your wm to feed the clipboard to youtube-dl, why would you open a terminal for this?
>bindsym Ctrl+$hyper+m exec cd music && youtube-dl -x --audio-format mp3 --audio-quality 0 `xsel -o`
Jeremiah Taylor
Why not just a shortcut that feeds current clipboard to your preferred downloader? That's how I'm watching videos.
Blake Robinson
You can use it for other stuff. You can run it and grep the urls. If they point to youtube, it opens mpv, if they point to soundcloud, it youtube-dls it. This is just a concept that i never saw anywhere
Elijah Perez
Do you leave it on permanently? I don't think I'd want things happening whenever I used the clipboard. If I'm copying a url to share with a friend it shouldn't open or download it. And if I have to turn it off in those special cases, it seems like more of a hassle than some dedicated bindings. Also I might want to download a youtube video, or just the music, or open it in mpv, or paste it in a to-watch file. You can't grep my intention of copying a link, but the satisfaction of typing yy+keybinding that does what I want with the clipboard is irreplaceable.
Brandon Johnson
I have a mode for that in i3. When i want it opened, i run meta+shift+z and the next thing copied is grepped and it lets me pick what to do with it in rofi
Carter Perez
Not who you're replying to, but recently I've been getting more into bash scripts and what not so forgive me if this is inaccurate, but couldn't you just have it check the clipboard at the time of execution? > Copy youtube URL into clipboard > Run Script that grabs url from clipboard The only way I see needing it constantly monitor the clipboard is if you intend to download multiple youtube videos at once.
Cooper Scott
Yes. You could alias something to 'xsel -b | youtube-dl' but that defeats the purpose
Joshua Baker
it's english
Levi White
Bash question here, is sleep 0.5 ran during or after the do..done command is ran?
Owen Peterson
>What is youtube downloader add-on?
Connor Gonzalez
i don't really see how this is any better than my browser keybind of bind Y hint links spawn youtube-dl {hint-url} in qutebrowser, hint links being an enumerated key combo that shows up over every link on the page
Samuel Ross
>#!/bin/bash You fucked up
Eli Butler
youtube-dl I have zsh linked to /bin/bash This is actually great! I will use this for mpv
Carter Diaz
>I have zsh linked to /bin/bash Still a fuckup. #! /bin/sh
Cooper Gray
What the hell. Why would i do that?
Thomas Cooper
Portability
Jaxon Collins
Ok, makes sense.
Justin Hall
>making something so simple this complex ...you do know you youtube-dl supports youtube playlists...right user?
Michael Hall
Yes. I would have to put all the stuff in a playlist and then download it and delete the playlist