Androxilogin

Redirect MSN News articles to their original sources with TamperMonkey.

Jan 25th, 2025
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Replace MSN News with Original Sources
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Redirect MSN News articles to their original sources
  6. // @match *://www.msn.com/*
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12. let paragraphs = document.querySelectorAll("p");
  13. if (paragraphs.length > 0) {
  14. let searchQuery = paragraphs[0].innerText.trim();
  15. let googleSearchURL = `https://www.google.com/search?q="${encodeURIComponent(searchQuery)}"`;
  16. window.location.href = googleSearchURL;
  17. }
  18. })();
  19.  
Advertisement
Add Comment
Please, Sign In to add comment