Skip to content

Instantly share code, notes, and snippets.

@gvenk
Last active August 28, 2023 18:24
Show Gist options
  • Save gvenk/d093fc892327732185204afcf05e4d56 to your computer and use it in GitHub Desktop.
Save gvenk/d093fc892327732185204afcf05e4d56 to your computer and use it in GitHub Desktop.
Asks users for a youtube url and open it on youtube-nocookie.co
javascript:void%20function(){const%20a=window.prompt(%22Welke%20youtube%20video%20wil%20je%20bekijken%3F%22);if(a){const%20b=new%20URL(a).searchParams,c=b.get(%22v%22);if(c){window.open(%22https://www.youtube-nocookie.com/embed/%22+c)}else{const%20b=a.replace(%22https://youtu.be/%22,%22https://www.youtube-nocookie.com/embed/%22);b!==a%26%26window.open(b)}}}();
const url = window.prompt('Welke youtube video wil je bekijken?');
if (url) {
const search = new URL(url).searchParams;
const videoId = search.get('v');
if (videoId) {
const newUrl = 'https://www.youtube-nocookie.com/embed/' + videoId;
window.open(newUrl);
} else {
const newUrl = url.replace('https://youtu.be/', 'https://www.youtube-nocookie.com/embed/');
if (newUrl !== url) {
window.open(newUrl);
}
}
}
@gvenk
Copy link
Author

gvenk commented Apr 28, 2020

More info about this bookmarklet on this page

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