Fix Google

This commit is contained in:
Sam Sneed 2024-08-13 18:31:17 -05:00
parent 252984a504
commit 8b6a491ed5

View file

@ -50,14 +50,14 @@ function go() {
if (url.includes("youtube.com") || url.includes("youtu.be")) { if (url.includes("youtube.com") || url.includes("youtu.be")) {
url = url.replaceAll("youtube.com", "invidious.nerdvpn.de") url = url.replaceAll("youtube.com", "invidious.nerdvpn.de")
url = url.replaceAll("youtu.be", "invidious.nerdvpn.de") url = url.replaceAll("youtu.be", "invidious.nerdvpn.de")
} else if (url.includes("google.com/?q")) { } else if (url.includes("google.com/search?q") || url.includes("google.com/?q")) {
// Define the regex pattern // Define the URL object
const pattern = /https:\/\/www\.google\.com\/search\?q=([^&]+)/; const serachUrlObj = new URL(url);
// Define the replacement URL //Get query from old url
const replacement = "https://search.sparksammy.com/search.php?q=$1&p=0&t=0"; const query = serachUrlObj.searchParams.get('q');
// Perform the replacement // Define the pattern for URL replacement
url = url.replace(pattern, replacement); const searchPattern = "https://search.sparksammy.com/search.php?q=!!!QUERY!!!&p=0&t=0";
console.log(url) url = searchPattern.replaceAll("!!!QUERY!!!", query)
} else if (url.includes("https://news.google.com")) { } else if (url.includes("https://news.google.com")) {
url = url.replaceAll("https://news.google.com", "http://68k.news") url = url.replaceAll("https://news.google.com", "http://68k.news")
} else if (url.includes("google.com") && !url.includes("maps") && !url.includes("news") && !url.includes("webstore") && !url.includes("drive") && !url.includes("docs") && !url.includes("sheets") && !url.includes("slides") && !url.includes("mail")) { } else if (url.includes("google.com") && !url.includes("maps") && !url.includes("news") && !url.includes("webstore") && !url.includes("drive") && !url.includes("docs") && !url.includes("sheets") && !url.includes("slides") && !url.includes("mail")) {