Molytov's Cocktail Lounge

How I Watch YouTube Without Using YouTube (And Without Them Using Me)

There's been a lot of discussion about how YouTube is starting to detect and attempt to block ad/tracker blockers. People pissed about it to say the least, and for good reason. Trying to force users to use your website the way you want them to will only make them resist harder.

There have been many projects that have sprouted up with the aim of providing users with a more private and/or more minimal video-watching experience.

Mobile

I used to use ReVanced for watching YouTube. It is a successor to the Vanced project, which unfortunately was discontinued after a DMCA issue, since distributing modified versions of the YouTube app violates their copyright.
ReVanced is different. Instead of distributing the modified app itself, ReVanced is a patcher for the YouTube app. You download the YouTube app's APK and ReVanced will modify it on your device and install it. While it is a definite improvement over the standard YouTube experience, you are still dealing with an app that is proprietary at its core, and requires a Google account to have features like playlists.

After I made the decision to delete my personal Google account, I also made the move to Newpipe, specifically to the NewpipeSponsorblock fork. Newpipe does not rely on YouTube's API, and all data is stored locally. You can subscribe, create playlists, listen to audio only, play videos in the background, and even download video and audio. Newpipe does all this while not showing ads and not providing YouTube information they could use to track you.

The NewpipeSponsorblock fork adds two very cool additional abilities: skipping sponsor segments via Sponsorblock, and viewing dislikes via ReturnYoutubeDislike. I found these features attractive enough to use it as opposed to the original version of the app.
You can download Newpipe on F-Droid, with the fork being on the Izzysoft repository.

Desktop

The two most popular YouTube front-ends are Invidious and Piped. I have tried to use both of these, but they tend to suffer a consistent issue of instances often being slow or going offline. Due to the fact that they are both pretty resource intensive to host, there are less people willing to host their own instances. This results in instances often being overwhelmed and becoming sluggish, with some locking user registration. This issue made them simply not worth it for me, I found myself switching between multiple instances, having a video not load anyway, and just opening YouTube's website to watch it instead.

Nowdays, I've been using a project called Youtube-Local. It's a lightweight, locally-hosted app that has the same idea as NewPipe. It's lightweight, has a minimal UI, and your subscriptions and playlists are stored locally.

Installing YouTube-Local

This is what I did to set it up for myself.
These instructions will apply to Fedora, since that's what I run.

First, making sure I had the dependencies I needed:
sudo dnf install python3 python3-pip python3-virtualenv

Then, cloning the repo and setting up the virtual environment:

git clone https://github.com/user234683/youtube-local
cd youtube-local
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

After that, making the settings.txt file and doing a quick test run:

touch settings.txt
python3 server.py

After that, there should be a http://localhost:9010 URL and the settings.txt file was populated with settings I could adjust.

I don't want to have to open a terminal and start it every time, so I made a SystemD service to automatically start it on boot:
sudo vim /etc/systemd/system/ytlocal.service

This is the contents of the service file:

[Unit]
Description=YouTube-Local

[Service]
User=username
WorkingDirectory=/home/path/to/youtube-local
ExecStart=/home/path/to/youtube-local/venv/bin/python3 /home/path/to/youtube-local/server.py

Restart=on-failure
ProtectSystem=full
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

After that, enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now ytlocal.service

Watching videos at 1080p caused an issue where the video exceeds the size of the viewport, causing the bottom of the video to go off the screen. While there currently isn't a complete fix, I had found a band-aid solution that works for me:

In youtube-local/youtube/templates/watch.html, go to Line 90.
Change the % from 100% to a smaller value. I found 60% works for 1080p videos, but this differs depending on resolution.

padding-top: calc(100%*var(--video_height)/var(--video_width));
Change to
padding-top: calc(60%*var(--video_height)/var(--video_width));

Restart the service to ensure changes take effect.

If there are specific channels you don't want to see, you can use the following Ublock Origin filter to hide videos from a channel:

##.horizontal-item-box.video-item-box:has(address:has-text(/(Channel1|Channel2|AnotherChannel)/i))

They aren't perfect

There are a few downsides to using these solutions. Neither NewPipe nor YouTube-Local make it very quick to synchronize your subscriptions and playlists, since it's all kept offline. You would need to export the data and re-import it wherever else you wish to have the same data.

When it comes to using YouTube-Local, there's that video size issue that I needed to fix. The UI is somewhat primative which could be a downside for some people, but personally I'm fine with it. It also has an issue showing multiple pages of videos on a channel page.

There's often some sort of sacrifice to user experience or ease of use being made when it comes to using more private alternatives to modern software.

But here's the thing:
YouTube hates you and wishes to exploit you for your data and attention. They shove ads (that often promote scams, malware and misinformation) down your throat. They track every single thing you do on their website to feed data to their algorithm, which does whatever it can to keep you on the website. When you use something like Ublock Origin to get rid of them, they try to force you to disable it with annoying popups.

For me, it is worth the limitations of using these services if it means not putting up with YouTube's bullshit.

#foss #selfhosting #youtube