YouTube flagged me so I built a Telegram bot to proxy the videos

August 10, 2020

TLDR;

I use ad blockers. YouTube flagged my account and devices. I can only watch around 1 in 4 videos. So I wrote a Telegram bot that receives YouTube URLs and replies back with the video.

The problem

I use adblockers to have a semi-decent experience on the Internet. I mainly use UBlock Origin plus some DNS ones. One nice feature of UBlock Origin is that it does block ads from YouTube videos. On my phone I uninstalled the YouTube app and watch videos mostly through Firefox.

Unfortunately, their algorithms detected that I do not watch their ads so all my accounts and devices seem flagged. I’m not completely banned, but I can’t see more than half of the videos.

Before you come tell me I am inmoral for not watching the ads that many creators need to make a living, let me point some things out:

  • Most of the content I follow I already support via Patreon (I spend around 80 USD bucks a month supporting those people)
  • Even being a supporter, most of the content gets published exclusively to YouTube.
  • A lot of the videos I can’t watch do not even have ads

Also, I’m not complaining about being flagged. Best case scenario, I come up with away to workaround their restrictions by building tools which is what I enjoy doing anyways… worst case scenario, I can’t never ever watch YouTube; I can live with that.

This is what it looks like when I try to watch a video:

you shall no tube

And for videos that I can watch, the comment section displays:

Restricted Mode has hidden comments for this video.

My solution (for now at least)

I noticed that what seems to be blocked are the devices/accounts that I have used, but the videos are accessible and even downloadable from other other locations (even from the same network). So this is my plan:

  • Run a Telegram bot that receives YouTube urls
  • The bot downloads the video (using youtube-dl)
  • Then the bot replies back with the video attached as a file

bot shot

Source code: https://github.com/casidiablo/youtube-telegram-bot

  • It’s likely that I will hit file size limits of Telegram. To upload big videos I might need to split them using ffmpeg
  • I could make it so that the bot subscribes to the channels I follow and automatically send me those videos.
  • The code itself of this bot was adapted from another bot I run that, given a YouTube URL, downloads the video, encodes it in MP3 and publishes it to a private Podcast feed. I use it to listen to stuff where video is just a distraction (conferences, speeches, etc.)
  • I also run another bot that feeds my Plex server with non-YouTube videos procured from… from nice people out there.

© 2017 | Powered by Hugo ♥ | Art by Clip Art ETC