How to Stop YouTube AI-Translation on Mobile

In my previous post, I’ve hinted there is something in the works for the mobile environment. I wasn’t sure how well it would work. For some contexts, YouTube has a mobile webpage, not a responsive UI like you see on The Mad Tea Party. You can easily catch that by the subdomain, m.youtube., when it automatically redirects mobile users. Now, an argument can be made — I believe this is where Google stands — the best mobile UX for YouTube is on YouTube app. But that’s not always an option, especially when it comes to stopping AI translation.

Using the same script from the previous post, search and replace the following areas with your favorite editor:

ORIGINAL:
// @match        https://www.youtube.com/*

CHANGE TO:
// @match        https://www.youtube.com/*
// @match        https://m.youtube.com/*
ORIGINAL:
var links = Array.prototype.slice.call(document.getElementsByTagName("a")).filter(a => {
            const bounds = a.getBoundingClientRect();
            return (
					a.id == 'video-title-link' ||
					a.id == 'video-title' ||
					a.classList.contains("yt-lockup-metadata-view-model-wiz__title") ||
					a.classList.contains("yt-lockup-metadata-view-model__title")) &&

CHANGE TO:
var links = Array.prototype.slice.call(document.getElementsByTagName("a")).filter(a => {
            const bounds = a.getBoundingClientRect();
            return (
					a.id == 'video-title-link' ||
					a.id == 'video-title' ||
					a.classList.contains("yt-lockup-metadata-view-model-wiz__title") ||
					a.classList.contains("yt-lockup-metadata-view-model__title") ||
                    // Mobile Selectors added below:
                    a.classList.contains("media-item-title") ||
                    a.classList.contains("large-media-item-metadata-title") ||
                    a.classList.contains("compact-media-item-metadata-title") ||
                    a.querySelector('.media-item-title') !== null) &&
ORIGINAL:
var pageTitle = document.querySelector("h1.style-scope > yt-formatted-string");

CHANGE TO:
var pageTitle = document.querySelector("h1.style-scope > yt-formatted-string") || document.querySelector("h2.slim-video-metadata-title") || document.querySelector("ytm-slim-video-metadata-section-renderer h2");

The idea is rather simple. The script has the name schemes for mobile version of YouTube. Full disclosure, I didn’t do the investigate part myself; this is a product of vibe coding as some would put it — in other words, I asked Gemini to hunt down the css. If it ever breaks down and in need of update, I suspect popular LLMs would be able to catch the new naming convention quickly.

Leave a comment

Comments will be automatically closed after 30 days.