Watch YouTube on DuckDuckGo

Automatically watch YouTube on DuckDuckGo

  1. // ==UserScript==
  2. // @name Watch YouTube on DuckDuckGo
  3. // @namespace https://carletonstuberg.com/
  4. // @version 1.1.0
  5. // @description Automatically watch YouTube on DuckDuckGo
  6. // @author Carleton Stuberg
  7. // @include https://www.youtube.com/watch*
  8. // @include https://youtube.com/watch*
  9. // @include https://www.youtube-nocookie.com/*
  10. // @include https://youtube-nocookie.com/*
  11. // @grant none
  12. // @run-at document-end
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict';
  17. if (!window.location.hostname.includes("nocookie")) {
  18. window.location = "https://duckduckgo.com/" + document.title.replace(" \- YouTube", "") + " " + location.search.replace("\?v\=", "") + " video";
  19. } else {
  20. top.location.hostname = "www.youtube.com";
  21. }
  22.  
  23. })();