| Post Reply | RetroFed Forum Forum Index » Linux |
| Author | Message | ||
|---|---|---|---|
|
RavenofDespair
lemmy.ml
RavenofDespair@lemmy.ml Joined: 2023-10-29 |
made it so i just click file and paste YouTube url Linux is amazing
|
||
| 203 Original | |||
GodEmperorOfDuneUrMom
lemmy.world
matrixrunner@lemmy.worldJoined: 2023-06-24 |
Hell yeah |
||
| 10 | |||
myrmidex
belgae.social
myrmidex@belgae.socialJoined: 2025-06-22 |
One of us! One of us! |
||
| 15 | |||
MagnificentSteiner
lemmy.zip
MagnificentSteiner@lemmy.zipJoined: 2025-11-25 |
You'll probably like this youtube channel then :) |
||
| 19 | |||
|
abbadon420
sh.itjust.works
abbadon420@sh.itjust.works Joined: 2025-06-28 |
You'll probably like this youtube channel then :) https://www.youtube.com/@BreadOnPenguins
|
||
| 6 | |||
|
hoppolito
mander.xyz
hoppolito@mander.xyz Joined: 2024-11-23 |
Very happy you had fun making the little script! One thing that will become important pretty quick if you continue making these scripts is that it’s almost always better to wrap your variables in quotes - so it becomes If you want to expand your knowledge with this, some fruitful paths to go down are the following:
The last one is already quite a bit advanced but if you can do that you have enough of the ‘programming’ basics of the shell down to a degree that you can create many little helpers like this with ease. Of course don’t feel forced to do any of that - if you’re happy with the improvement as-is, that’s all you need to enjoy the fun of Linux! |
||
| 64 | |||
|
FEIN
lemmy.world
FEIN@lemmy.world Joined: 2024-03-24 |
hell yeah |
||
| 2 | |||
EccTM
lemmy.ml
EccTM@lemmy.mlJoined: 2023-06-14 |
I have a similar scriptlet that I use to open YouTube URLs in mpv, using just and wl-clipboard... I just copy the URL and press my G1 key (it has a keybind of
|
||
| 3 | |||
|
BananaTrifleViolin
lemmy.world
BananaTrifleViolin@lemmy.world Joined: 2023-06-16 |
That's great! Here's a few tips to take it a bit further; the world is your oyster! Open your .bashrc file (e.g. /home/yourusername/.bashrc) and add the following:
Now open a terminal and type get, and it'll launch the script. No clicking needed, it'll run anytime from any terminal! And if you do use the alias then you can use another refinement, you can drop the echo: instead of $a, you can use $1 and remove the echo & read as you no longer need them:
Now for example you can type in a terminal:
And yt-dlp will do it's stuff. $1 passes the first parameter after starting the script as a variable to it. You can use the keyboard shortcut Control+shift+v to paste a URL into the terminal, no mouse needed; just remember to add a space after typing get |
||
| 9 | |||
|
0t79JeIfK01RHyzo
lemmy.ml
0t79JeIfK01RHyzo@lemmy.ml Joined: 2024-07-17 |
That's great! Here's a few tips to take it a bit further; the world is your oyster! Open your .bashrc file (e.g. /home/yourusername/.bashrc) and add the following: alias get="/path/to/your/bash/file" Now open a terminal and type get, and it'll launch the script. No clicking needed, it'll run anytime from any terminal! And if you do use the alias then you can use another refinement, you can drop...
What does your ~/.bashrc look like? My last change was modifying a spoiler: I explain my last change to my ~/.bashrc file
or
or just from any directory with files
And then takes all the videos found at the url or at the path (including within folders), adds them to a playlist, shuffles them, and plays them from mpv.
other functions and aliases in my ~/.bashrc
|
||
| 1 | |||
|
TechnoCat
piefed.social
TechnoCat@piefed.social Joined: 2025-06-20 |
Here is a script I wrote:
|
||
| 8 | |||
NorthWestWind
lemmy.world
NorthWestWind@lemmy.worldJoined: 2023-06-11 |
Guess we're sharing scripts now. I have a script that downloads playlists as MP3s and keep an archive.
|
||
| 8 | |||
|
Ephera
lemmy.ml
Ephera@lemmy.ml Joined: 2020-05-31 |
Very happy you had fun making the little script! One thing that will become important pretty quick if you continue making these scripts is that it’s almost always better to wrap your variables in quotes - so it becomes yt-dlp -x “$a”. It’s okay here but if you ever paste something that has a space in it, this will keep it together ‘as one’. If you want to expand your knowledge with this, some f...
Oh man, this reminds me of the joke that any program that's more complex than Hello World has bugs – and folks still don't even agree how to spell "Hello, World!". Of course, Bash is a particular minefield in this regard... |
||
| 8 | |||
|
18107
aussie.zone
18107@aussie.zone Joined: 2023-07-04 |
One thing that will become important pretty quick if you continue making these scripts is that it’s almost always better to wrap your variables in quotes - so it becomes yt-dlp -x “$a”. Oh man, this reminds me of the joke that any program that's more complex than Hello World has bugs – and folks still don't even agree how to spell "Hello, World!". Of course, Bash is a particular minefield in th...
I once wrote a 2 line, 10 word script that had 9 bugs in it. I'm not overly proud of that one. |
||
| 17 | |||
|
db2
lemmy.world
db2@lemmy.world Joined: 2023-07-29 |
That's great! Here's a few tips to take it a bit further; the world is your oyster! Open your .bashrc file (e.g. /home/yourusername/.bashrc) and add the following: alias get="/path/to/your/bash/file" Now open a terminal and type get, and it'll launch the script. No clicking needed, it'll run anytime from any terminal! And if you do use the alias then you can use another refinement, you can drop...
The op script is meant to be opened in the GUI in a terminal then the URL gets pasted in there. It took me a second to see it. |
||
| 2 | |||
|
db2
lemmy.world
db2@lemmy.world Joined: 2023-07-29 |
What does your ~/.bashrc look like? My last change was modifying a playlist command ::: spoiler spoiler: I explain my last change to my ~/.bashrc file playlist https://www.youtube.com/@YouTube/videos or playlist /home/username/Videos or just from any directory with files playlist And then takes all the videos found at the url or at the path (including within folders), adds them to a playlist, s...
I wonder if we have the same resize.sh |
||
| 1 | |||
|
NewDawnOwl
lemmy.world
NewDawnOwl@lemmy.world Joined: 2025-04-01 |
I love things like this, makes it so easy to learn when it's a really simple to understand and explicit implementation of a high level feature (read input, pass to command) |
||
| 3 | |||
|
0t79JeIfK01RHyzo
lemmy.ml
0t79JeIfK01RHyzo@lemmy.ml Joined: 2024-07-17 |
I wonder if we have the same resize.sh
The version I have was copied from stackoverflow. It doesn't work very well, it makes a rough estimate to get the video file size under the set value. As an example
Which then resizes the video to 10 megabytes if possible. resize.sh code
I'll probably replace it eventually. |
||
| 1 | |||
|
db2
lemmy.world
db2@lemmy.world Joined: 2023-07-29 |
The version I have was copied from stackoverflow. It doesn't work very well, it makes a rough estimate to get the video file size under the set value. As an example resize video.mp4 10 Which then resizes the video to 10 megabytes if possible. ::: spoiler resize.sh code file=$1 target_size_mb=$2 # target size in MB target_size=$(( $target_size_mb * 1000 * 1000 * 8 )) # target size in bits length...
Definitely not the same lol Mine uses ffmpeg to change the resolution, it doesn't so much care about file sizes. It could be a one-liner if you only ever feed it a single file to manipulate.. |
||
| 2 | |||
|
chunes
lemmy.world
chunes@lemmy.world Joined: 2025-04-08 |
You've got me beat. I just have a text file with some common usage examples in it. |
||
| 4 | |||
|
osanna
thebrainbin.org
osanna@thebrainbin.org Joined: 2026-02-01 |
awesome! I never would have thought to make something like that. |
||
| 1 | |||
|
0t79JeIfK01RHyzo
lemmy.ml
0t79JeIfK01RHyzo@lemmy.ml Joined: 2024-07-17 |
Definitely not the same lol Mine uses ffmpeg to change the resolution, it doesn't so much care about file sizes. It could be a one-liner if you only ever feed it a single file to manipulate..
I might add one for scaling. I just don't use it as frequently as trying to meet a file size limit. The scaling is also much easier to remember
It does get complicated though, when scaling many videos and images, I've used something like the following in the past
Those were the only two that showed up when I typed after commenting, I also added a new video file resizer.It works significantly better than the one I previously posted. It's also copied from stackoverflow.
|
||
| 2 | |||
|
draco_aeneus
mander.xyz
draco_aeneus@mander.xyz Joined: 2026-01-23 |
I once wrote a 2 line, 10 word script that had 9 bugs in it. I'm not overly proud of that one.
I think you might have a career as an accomplished entymologist ahead of you with so much success finding bugs! |
||
| 5 | |||
|
GarbadgeGoober
feddit.org
GarbadgeGoober@feddit.org Joined: 2025-04-02 |
Amazing. Injust switched a year ago and now I finally discovered bash scripts. It is so mich easier, I also automated some manual tasks with Python scripts to name my PDFs, never would have done that with windows. And the best part of it, it's actually fun and I want to even do more. As always I have to thank DJT, for make me switch. 🤣 |
||
| 5 | |||
|
urhovaldeko
lemmy.world
urhovaldeko@lemmy.world Joined: 2023-06-08 |
Stop right now. This will all end in tears. You’ll become a developer and spend the rest of your life fixing bugs. You can still get out. |
||
| 51 | |||
MousePotatoDoesStuff
lemmy.world
MousePotatoDoesStuff@lemmy.worldJoined: 2025-03-09 |
Amazing. Injust switched a year ago and now I finally discovered bash scripts. It is so mich easier, I also automated some manual tasks with Python scripts to name my PDFs, never would have done that with windows. And the best part of it, it's actually fun and I want to even do more. As always I have to thank DJT, for make me switch. 🤣
DJT, best Linux promoter of 2025 :P |
||
| 2 | |||
texture
lemmy.world
texture@lemmy.worldJoined: 2025-12-19 |
this is neat, thanks! |
||
| 1 | |||
|
RavenofDespair
lemmy.ml
RavenofDespair@lemmy.ml Joined: 2023-10-29 |
You'll probably like this youtube channel then :) https://www.youtube.com/@BreadOnPenguins
Thanks looks good |
||
| 3 | |||
|
RavenofDespair
lemmy.ml
RavenofDespair@lemmy.ml Joined: 2023-10-29 |
You've got me beat. I just have a text file with some common usage examples in it.
I do the same, for the commands I forget. Joplin is also handy for making longer notes. |
||
| 2 | |||
|
RavenofDespair
lemmy.ml
RavenofDespair@lemmy.ml Joined: 2023-10-29 |
Stop right now. This will all end in tears. You’ll become a developer and spend the rest of your life fixing bugs. You can still get out.
I like fixing things but getting paid to do it is the hard part. I also want to give back to Linux community even if it is small. |
||
| 11 | |||
|
RavenofDespair
lemmy.ml
RavenofDespair@lemmy.ml Joined: 2023-10-29 |
Very happy you had fun making the little script! One thing that will become important pretty quick if you continue making these scripts is that it’s almost always better to wrap your variables in quotes - so it becomes yt-dlp -x “$a”. It’s okay here but if you ever paste something that has a space in it, this will keep it together ‘as one’. If you want to expand your knowledge with this, some f...
Thanks might make it bigger now. The "$a" very helpful as I might copy url from web pages which may cause a error. |
||
| 1 | |||
katy ✨
piefed.blahaj.zone
cupcakezealot@piefed.blahaj.zoneJoined: 2025-06-06 |
this isn't perfect but i made one when i wanted to fetch a video for a specific resolution (because i prefer 480)
|
||
| 4 | |||
|
kittenroar
beehaw.org
kittenroar@beehaw.org Joined: 2023-06-05 |
You could make it an alias and shorten the number of keystrokes I prefer keeping my aliases in ~/.bash_aliases, which is sourced in my ~/.bashrc, ie
Then you would just need to source your bashrc to load it the first time. |
||
| 1 | |||
|
JamonBear
sh.itjust.works
JamonBear@sh.itjust.works Joined: 2024-12-28 |
You all forgot to add the best yt-dlp option: |
||
| 18 | |||
|
Mactan
lemmy.ml
mactan@lemmy.ml Joined: 2023-06-04 |
You all forgot to add the best yt-dlp option: --sponsorblock-remove all
thank you |
||
| 2 | |||
|
HuePony
lemmy.ml
HuePony@lemmy.ml Joined: 2026-02-10 |
I simply using local LLM for it |
||
| -4 | |||
|
ExperimentalGuy
programming.dev
ExperimentalGuy@programming.dev Joined: 2023-07-25 |
this isn't perfect but i made one when i wanted to fetch a video for a specific resolution (because i prefer 480) ytgrab() { local id="$1" local res="${2:-480}" # default to 480 local url="https://www.youtube.com/watch?v=$id" # fetch formats local fmt fmt=$(yt-dlp -F --cookies-from-browser vivaldi "$url") # printing the format output echo "$fmt" # pick video format matching the requested resolu...
Just curious, but why 480? |
||
| 2 | |||
katy ✨
piefed.blahaj.zone
cupcakezealot@piefed.blahaj.zoneJoined: 2025-06-06 |
Just curious, but why 480?
usually i just like older videos but in this case i was saving a bunch of wcw vault videos to my jellyfin library and i prefer 480 since it was as close to tv as can be (also i've never been a fan of hd and tv after 2000 because i felt that's when it went downhill) |
||
| 1 | |||
katy ✨
piefed.blahaj.zone
cupcakezealot@piefed.blahaj.zoneJoined: 2025-06-06 |
Here is a script I wrote: ~/bin 0s > cat vget #!/usr/bin/env fish yt-dlp --embed-metadata --write-subs --embed-subs --write-thumbnail --prefer-free-formats -f "[height<=1080]" $argv
does --write-thumbnail save a jpg with the video? or is it something else? |
||
| 2 | |||
aqua
lemmy.world
aqua@lemmy.worldJoined: 2023-06-12 |
I do the same, for the commands I forget. Joplin is also handy for making longer notes.
Check out atuin, when you press arrow up in the terminal it shows a history list that is also searchable. |
||
| 2 | |||
|
JTskulk
lemmy.world
JTskulk@lemmy.world Joined: 2023-06-20 |
No offense, but I'm seeing a lot of useless scripts here. You can simply put these option in yt-dlp.conf and then just run yt-dlp "url". |
||
| 3 | |||
|
DarkSpectrum
lemmy.world
DarkSpectrum@lemmy.world Joined: 2023-06-12 |
I self host Pinchflat and have set it up to monitor one of my own yt playlists. Then if I want to download anything on mobile or desktop I just save it to that playlist and it's done. |
||
| 3 | |||
|
TechnoCat
piefed.social
TechnoCat@piefed.social Joined: 2025-06-20 |
does --write-thumbnail save a jpg with the video? or is it something else?
You're correct!
There is also this option:
|
||
| 1 | |||
katy ✨
piefed.blahaj.zone
cupcakezealot@piefed.blahaj.zoneJoined: 2025-06-06 |
You're correct! --write-thumbnail Write thumbnail image to disk There is also this option: --embed-thumbnail Embed thumbnail in the video as cover art
makes note of this since it will make tagging a lot easier and also cataloging for jellyfin |
||
| 2 | |||
|
RavenofDespair
lemmy.ml
RavenofDespair@lemmy.ml Joined: 2023-10-29 |
No offense, but I'm seeing a lot of useless scripts here. You can simply put these option in yt-dlp.conf and then just run yt-dlp "url".
I made this for easy use so no typing or terminal. some people like to do thing differently and that's ok |
||
| 1 | |||
|
JTskulk
lemmy.world
JTskulk@lemmy.world Joined: 2023-06-20 |
I made this for easy use so no typing or terminal. some people like to do thing differently and that's ok
When you |
||
| 1 | |||
|
Random Dent
lemmy.ml
CrabAndBroom@lemmy.ml Joined: 2023-06-01 |
Nice! I did mine as an alias:
And then just |
||
| 2 | |||
| Post Reply |
Back to top |