Skip to content

Instantly share code, notes, and snippets.

@waynebloss
Last active January 25, 2023 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waynebloss/b24e07102d02e6ed2975b48e547aece4 to your computer and use it in GitHub Desktop.
Save waynebloss/b24e07102d02e6ed2975b48e547aece4 to your computer and use it in GitHub Desktop.
Stop Google search from embedding YouTube results

How to stop Google search from playing embedded YouTube results

NOTE: None of this works very well. I turned it off until I can find a better way.

It's really annoying when you click a YouTube thumbnail in the Google search results now because it doesn't take you to the target site like any other search result. Nope. Now YouTube results are "special" because they want to take you on a "video voyage" to discover the thing you clicked on and they show you a stupid embedded player with crappy video quality that plays right in the Google search results page. (Only for YouTube results! That's not confusing at all!)

So here's one way that I stopped that by using StyleBot...

/** Make the real search result link taller. */
div[data-surl] a[data-ved] {
  position:relative;
  display: block;
  padding-bottom:200px;
}
/** Move embedded player container underneath the real search result. */
div[data-surl] div[jsshadow] {
  margin-top:-200px;
  max-height: 100px;
}
/** Disable embedded player link href for good measure. */
div[data-surl] a[data-vll] {
  pointer-events: none;
  cursor: default;
}

The problem

Without this change, when you click a Google search result that goes to a YouTube video, they remove all the content from the search results page and show you something like the following. If you happened to "middle-click" the result, you get the same thing but in a new tab.

Perhaps there's a setting somewhere to change this for signed-in users but I generally don't sign into Google or YouTube unless I'm using a specific browser profile that needs to be signed in (for work).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment