Zero to Shipped

- Master Fullstack Development and finally ship a product

9 days ago

A new way of watching YouTube

YouTube is super useful, but it can also be super addicting.

 

I don't have it on my phone for the longest time. I'm trying to keep my phone a dumb as possible.

 

I locked most of the stuff up, and I gave the Screen Time passcode to my wife so I'm not tempted to reinstall anything. When I go on a trip etc. I unlock it, and I immediately install YouTube, Reddit, etc. 



 

I catch myself scrolling shorts while thinking "what kind of idiot would watch this for hours" only to realize that it's me. I'm the idiot.

 

A toxic way to watch
Even when I'm not watching on my phone I have a horrible etiquette of watching YouTube. I go to the homepage wanting to search something. I end up opening 1389413 random videos in new tabs. I "watch" them at 2-3x speed and I constantly press J and K on my keyboard to jump through the videos. Then I skim through few of them, lose interest, and close the tabs. Refresh the home page, and do this process again.

I realized that I'm paying for premium just to get more addicted to this horrible way of watching YouTube. So I canceled Premium and came up with a better solution.

 

Friction
Before I dive into the technical details, let's discuss why is this important.

 

I will click around on random shit, and watch anything and everything, but for sure I won't bother with the download process, waiting for the download to finish, just to 2x watch and skim through a random skit or a vlog.



 

If I choose to download a video, I'm gonna do that with a purpose and intention that I really want to watch it later.


 

WhY nOt aN exTeNSiOn
Before we get into it, yes I know I can install an extension to clean up YouTube etc. but I can also disable it, and the watching will still be endless because I can keep searching and watching.
I want to separate the browsing and the watching process.

 

In the future, I'm gonna make a special frontend for searching YouTube that doesn't allow me to watch it, but it adds the videos as downloads to my Plex.



 

The technical details
To serve my videos on my TV and other devices I'm using Plex. Plex is super simple to configure. You can run it on your computer, on a spare computer, on a NAS, whatever. I won't get into that. I highly recommend the Infuse app if you're using Apple TV, but the Plex app is also really good.



 

You can create a new library called YouTube, download videos (with any downloader that you like) and just dump the videos in your Plex folder.
 


 

My way is a bit more complex, and I'm going to tell you how I set it up for myself.



 

The script
On my Synology NAS, I made a "scripts" folder with a "youtube-downloader" folder in it.

 

Inside, I added a node.js script that checks an sqlite database every 5 seconds, and if a new video is added to the db, it downloads it.

I'm using the yt-dlp package for downloading videos. I installed it using python3 and pip (somehow, idk, ChatGPT helped me). So the node.js script does the database thingies and it executes yt-dlp using "exec" when needed. Then it updates the download status of the videos in the sqlite db.

 

Starting the script on boot
I had no idea that I can do this in my NAS. Go to NAS → Control Panel → Task Scheduler, and create a new task. As event, choose "boot up"

 

Edit task.jpg

 

General Task Settings.jpg

 

This script command will run the node script in the background, and output all the logs in downloader.log so you can read them with "tail -f downloader.log"

Easily adding videos I created another node script on my mac that simply takes a url as a parameter and adds a new row to the sqlite db. Then I aliased that node script in my zsh file so I can easily download videos by executing "download-youtube https://youtube.com/whatever" in the terminal. 

"Ew, the terminal?" I hear you say. Yeah, yeah I'm definitely not going to download videos this way, but it needs to remain one of the options.



 

Raycast
I created a "Create script command" in Raycast in the same folder with my node script, so I can easily add a video to my sqlite db from Raycast.
I'm also planning to make a special frontend for searching YouTube videos that won't show recommendations

CleanShot 2025-01-11 at 18.00.08@2x.jpg

 

Adding videos from my phone
Now this was a bit tricky because I don't have access to the sqlite db on my phone. 
So I modified the node js script (on the NAS) to also start and expose a local express server (available only on my home network) that has an /api/add-video route.



 

Siri Shortcut
Then I created a Siri shortcut that accepts a text/url input so I can easily share any youtube link from my phone to the shortcut, and it will make a POST request to the local server on the NAS

Receive.jpeg

 

Was it worth it?
Absolutely yes. Anything that protects you from over consuming social media is worth it. YouTube has some great educational stuff which is a shame to miss out on, it's just that it's super addicting and easy to start watching random shit. Unless you tame it, and you really mindfully choose what you want to watch, it can take hours of your day and life.

So yes, this was worth it.

 

More posts

The saddest "Just Ship It" story ever

GitHub stars won't pay your rent

GPT-3 is the beginning of the end

I shot a video with Katy Perry

I made

🟣

Sizzy

The Browser For Developers

🐶

Benji

The life OS

🚢

Zero To Shipped

Interactive video course on mastering fast-paced Fullstack Development.