Recently, YouTube is messing with user disobedience again. For the sake of that, FreeTube has been updating with fix multiple times.
Although FreeTube has fixed the API block done by YouTube, I have to deal with a new IP block from my end as its aftermath.
“YouTube has blocked your IP address from watching videos. Please try switching to a different VPN or proxy.”
There are many ways to get around this IP block. Because I think switching VPN server is too heavy just for this, I would like to use a proxy.
There are proxy lists all over the internet, but this list from monosans is more reliable than others.
Find one on the list, and copy paste it through FreeTube - Settings
- Proxy
- Enable Proxy/Tor
- Select protocol
- Host/Port
, and then test it with the button or simply load a video.
To check the proxy in a batch, use proxy-scraper-checker from the same awesome developer, and change config.toml
file
check_url = "https://ipwho.is/?output=json&fields=ip,country,city,region&lang=en"
In the urls
section, it is possible to add more proxy lists from other GitHub repos. But this is not needed for this scenario.
I know it can be very unstable in the terms of longevity, but it is counter-intuitive that these free proxies are generally slower than tor!
It is very easy to setup a background tor service on both Linux (with distro’s repo) and Windows (with tor expert bundle).
But I want to optimize tor just for unblock YouTube instead of anonymity. So after researching on tor forum, /r/TOR
and the manual, I came up with something like this in my /etc/tor/torrc
file:
##YouTube Unblock
EntryNodes {us}
ExitNodes {us}
ExcludeNodes {cn},{ru},{ir},{sy},{kp},{cu},{sa},{eg},{tr},{id},{ph},{vn},{th}
NewCircuitPeriod 3600
KeepAlivePeriod 3600
LongLivedPorts 443
##Speed Optimizations
CircuitBuildTimeout 10
NumCPUs 4
TokenBucketRefillInterval 75
SchedulerHighWaterMark 12000
SchedulerLowWaterMark 10000
RelayBandwidthRate 100 MB
RelayBandwidthBurst 150 MB
BandwidthRate 100 MB
BandwidthBurst 150 MB
##Privacy Security Enhancements
HiddenServiceStatistics 0
UseEntryGuards 1
NumEntryGuards 8
NumDirectoryGuards 4
DownloadExtraInfo 1
DisableDebuggerAttachment 1
SafeLogging 1
ReducedConnectionPadding 0
ConnectionPadding 1
The section for Speed Optimizations and Privacy Security Enhancements are optional. Since the anonymity is greatly reduced by strict the entry/end nodes within the US, it is good to compromise less for security while keep the speed fast.
After saving the torrc
configuration, launch tor
inside a terminal and load up a video with socks5 proxy 127.0.0.1:9050
enabled in FreeTube.
Use Ctrl+C
and relaunch tor
to pick another IP. US exit nodes usually would work within 2-3 tries. Once picked up a good IP, copy it from the Proxy Settings into the torrc
file configurations, by replacing {us}
into an IP address for the ExitNodes
.
With the settings above, it can work very stable for a longer time. Do this again when the exit node is gone.
This trick also works with yt-dlp to download videos and mpv to stream:
yt-dlp "https://youtu.be/video" --proxy socks5://127.0.0.1:9050
mpv --ytdl-raw-options=proxy=[socks5://127.0.0.1:9050] --ytdl-format=best "https://youtu.be/video"
The video quality is still loginwalled anyway, but I’m satisfied with current solution for watching video essays and podcasts.