URL Modifier for Search Engines

Modify (Redirect) URL links in search engines results to alternative frontends or for other purposes

当前为 2024-02-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name URL Modifier for Search Engines
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.4
  5. // @description Modify (Redirect) URL links in search engines results to alternative frontends or for other purposes
  6. // @author Domenic
  7.  
  8. // @match *://www.google.com/search?*
  9. // @match *://www.google.ad/search?*
  10. // @match *://www.google.ae/search?*
  11. // @match *://www.google.com.af/search?*
  12. // @match *://www.google.com.ag/search?*
  13. // @match *://www.google.al/search?*
  14. // @match *://www.google.am/search?*
  15. // @match *://www.google.co.ao/search?*
  16. // @match *://www.google.com.ar/search?*
  17. // @match *://www.google.as/search?*
  18. // @match *://www.google.at/search?*
  19. // @match *://www.google.com.au/search?*
  20. // @match *://www.google.az/search?*
  21. // @match *://www.google.ba/search?*
  22. // @match *://www.google.com.bd/search?*
  23. // @match *://www.google.be/search?*
  24. // @match *://www.google.bf/search?*
  25. // @match *://www.google.bg/search?*
  26. // @match *://www.google.com.bh/search?*
  27. // @match *://www.google.bi/search?*
  28. // @match *://www.google.bj/search?*
  29. // @match *://www.google.com.bn/search?*
  30. // @match *://www.google.com.bo/search?*
  31. // @match *://www.google.com.br/search?*
  32. // @match *://www.google.bs/search?*
  33. // @match *://www.google.bt/search?*
  34. // @match *://www.google.co.bw/search?*
  35. // @match *://www.google.by/search?*
  36. // @match *://www.google.com.bz/search?*
  37. // @match *://www.google.ca/search?*
  38. // @match *://www.google.cd/search?*
  39. // @match *://www.google.cf/search?*
  40. // @match *://www.google.cg/search?*
  41. // @match *://www.google.ch/search?*
  42. // @match *://www.google.ci/search?*
  43. // @match *://www.google.co.ck/search?*
  44. // @match *://www.google.cl/search?*
  45. // @match *://www.google.cm/search?*
  46. // @match *://www.google.cn/search?*
  47. // @match *://www.google.com.co/search?*
  48. // @match *://www.google.co.cr/search?*
  49. // @match *://www.google.com.cu/search?*
  50. // @match *://www.google.cv/search?*
  51. // @match *://www.google.com.cy/search?*
  52. // @match *://www.google.cz/search?*
  53. // @match *://www.google.de/search?*
  54. // @match *://www.google.dj/search?*
  55. // @match *://www.google.dk/search?*
  56. // @match *://www.google.dm/search?*
  57. // @match *://www.google.com.do/search?*
  58. // @match *://www.google.dz/search?*
  59. // @match *://www.google.com.ec/search?*
  60. // @match *://www.google.ee/search?*
  61. // @match *://www.google.com.eg/search?*
  62. // @match *://www.google.es/search?*
  63. // @match *://www.google.com.et/search?*
  64. // @match *://www.google.fi/search?*
  65. // @match *://www.google.com.fj/search?*
  66. // @match *://www.google.fm/search?*
  67. // @match *://www.google.fr/search?*
  68. // @match *://www.google.ga/search?*
  69. // @match *://www.google.ge/search?*
  70. // @match *://www.google.gg/search?*
  71. // @match *://www.google.com.gh/search?*
  72. // @match *://www.google.com.gi/search?*
  73. // @match *://www.google.gl/search?*
  74. // @match *://www.google.gm/search?*
  75. // @match *://www.google.gr/search?*
  76. // @match *://www.google.com.gt/search?*
  77. // @match *://www.google.gy/search?*
  78. // @match *://www.google.com.hk/search?*
  79. // @match *://www.google.hn/search?*
  80. // @match *://www.google.hr/search?*
  81. // @match *://www.google.ht/search?*
  82. // @match *://www.google.hu/search?*
  83. // @match *://www.google.co.id/search?*
  84. // @match *://www.google.ie/search?*
  85. // @match *://www.google.co.il/search?*
  86. // @match *://www.google.im/search?*
  87. // @match *://www.google.co.in/search?*
  88. // @match *://www.google.iq/search?*
  89. // @match *://www.google.is/search?*
  90. // @match *://www.google.it/search?*
  91. // @match *://www.google.je/search?*
  92. // @match *://www.google.com.jm/search?*
  93. // @match *://www.google.jo/search?*
  94. // @match *://www.google.co.jp/search?*
  95. // @match *://www.google.co.ke/search?*
  96. // @match *://www.google.com.kh/search?*
  97. // @match *://www.google.ki/search?*
  98. // @match *://www.google.kg/search?*
  99. // @match *://www.google.co.kr/search?*
  100. // @match *://www.google.com.kw/search?*
  101. // @match *://www.google.kz/search?*
  102. // @match *://www.google.la/search?*
  103. // @match *://www.google.com.lb/search?*
  104. // @match *://www.google.li/search?*
  105. // @match *://www.google.lk/search?*
  106. // @match *://www.google.co.ls/search?*
  107. // @match *://www.google.lt/search?*
  108. // @match *://www.google.lu/search?*
  109. // @match *://www.google.lv/search?*
  110. // @match *://www.google.com.ly/search?*
  111. // @match *://www.google.co.ma/search?*
  112. // @match *://www.google.md/search?*
  113. // @match *://www.google.me/search?*
  114. // @match *://www.google.mg/search?*
  115. // @match *://www.google.mk/search?*
  116. // @match *://www.google.ml/search?*
  117. // @match *://www.google.com.mm/search?*
  118. // @match *://www.google.mn/search?*
  119. // @match *://www.google.com.mt/search?*
  120. // @match *://www.google.mu/search?*
  121. // @match *://www.google.mv/search?*
  122. // @match *://www.google.mw/search?*
  123. // @match *://www.google.com.mx/search?*
  124. // @match *://www.google.com.my/search?*
  125. // @match *://www.google.co.mz/search?*
  126. // @match *://www.google.com.na/search?*
  127. // @match *://www.google.com.ng/search?*
  128. // @match *://www.google.com.ni/search?*
  129. // @match *://www.google.ne/search?*
  130. // @match *://www.google.nl/search?*
  131. // @match *://www.google.no/search?*
  132. // @match *://www.google.com.np/search?*
  133. // @match *://www.google.nr/search?*
  134. // @match *://www.google.nu/search?*
  135. // @match *://www.google.co.nz/search?*
  136. // @match *://www.google.com.om/search?*
  137. // @match *://www.google.com.pa/search?*
  138. // @match *://www.google.com.pe/search?*
  139. // @match *://www.google.com.pg/search?*
  140. // @match *://www.google.com.ph/search?*
  141. // @match *://www.google.com.pk/search?*
  142. // @match *://www.google.pl/search?*
  143. // @match *://www.google.pn/search?*
  144. // @match *://www.google.com.pr/search?*
  145. // @match *://www.google.ps/search?*
  146. // @match *://www.google.pt/search?*
  147. // @match *://www.google.com.py/search?*
  148. // @match *://www.google.com.qa/search?*
  149. // @match *://www.google.ro/search?*
  150. // @match *://www.google.ru/search?*
  151. // @match *://www.google.rw/search?*
  152. // @match *://www.google.com.sa/search?*
  153. // @match *://www.google.com.sb/search?*
  154. // @match *://www.google.sc/search?*
  155. // @match *://www.google.se/search?*
  156. // @match *://www.google.com.sg/search?*
  157. // @match *://www.google.sh/search?*
  158. // @match *://www.google.si/search?*
  159. // @match *://www.google.sk/search?*
  160. // @match *://www.google.com.sl/search?*
  161. // @match *://www.google.sn/search?*
  162. // @match *://www.google.so/search?*
  163. // @match *://www.google.sm/search?*
  164. // @match *://www.google.sr/search?*
  165. // @match *://www.google.st/search?*
  166. // @match *://www.google.com.sv/search?*
  167. // @match *://www.google.td/search?*
  168. // @match *://www.google.tg/search?*
  169. // @match *://www.google.co.th/search?*
  170. // @match *://www.google.com.tj/search?*
  171. // @match *://www.google.tl/search?*
  172. // @match *://www.google.tm/search?*
  173. // @match *://www.google.tn/search?*
  174. // @match *://www.google.to/search?*
  175. // @match *://www.google.com.tr/search?*
  176. // @match *://www.google.tt/search?*
  177. // @match *://www.google.com.tw/search?*
  178. // @match *://www.google.co.tz/search?*
  179. // @match *://www.google.com.ua/search?*
  180. // @match *://www.google.co.ug/search?*
  181. // @match *://www.google.co.uk/search?*
  182. // @match *://www.google.com.uy/search?*
  183. // @match *://www.google.co.uz/search?*
  184. // @match *://www.google.com.vc/search?*
  185. // @match *://www.google.co.ve/search?*
  186. // @match *://www.google.co.vi/search?*
  187. // @match *://www.google.com.vn/search?*
  188. // @match *://www.google.vu/search?*
  189. // @match *://www.google.ws/search?*
  190. // @match *://www.google.rs/search?*
  191. // @match *://www.google.co.za/search?*
  192. // @match *://www.google.co.zm/search?*
  193. // @match *://www.google.co.zw/search?*
  194. // @match *://www.google.cat/search?*
  195.  
  196. // @match *://search.yahoo.com/search*
  197. // @match *://search.yahoo.co.jp/search?*
  198. // @match *://*.search.yahoo.com/search*
  199.  
  200. // @match *://yandex.com/search/?*
  201. // @match *://yandex.ru/search/?*
  202.  
  203. // @match *://search.disroot.org/search*
  204. // @match *://searx.tiekoetter.com/search*
  205. // @match *://search.bus-hit.me/search*
  206. // @match *://search.inetol.net/search*
  207. // @match *://priv.au/search*
  208. // @match *://searx.be/search*
  209. // @match *://searxng.site/search*
  210. // @match *://search.hbubli.cc/search*
  211. // @match *://search.im-in.space/search*
  212. // @match *://opnxng.com/search*
  213. // @match *://search.upinmars.com/search*
  214. // @match *://search.sapti.me/search*
  215. // @match *://freesearch.club/search*
  216. // @match *://xo.wtf/search*
  217. // @match *://www.gruble.de/search*
  218. // @match *://searx.tuxcloud.net/search*
  219. // @match *://baresearch.org/search*
  220. // @match *://searx.daetalytica.io/search*
  221. // @match *://etsi.me/search*
  222. // @match *://search.leptons.xyz/search*
  223. // @match *://search.rowie.at/search*
  224. // @match *://search.mdosch.de/search*
  225. // @match *://searx.catfluori.de/search*
  226. // @match *://searx.si/search*
  227. // @match *://searx.namejeff.xyz/search*
  228. // @match *://search.itstechtime.com/search*
  229. // @match *://s.mble.dk/search*
  230. // @match *://searx.kutay.dev/search*
  231. // @match *://ooglester.com/search*
  232. // @match *://searx.ox2.fr/search*
  233. // @match *://searx.techsaviours.org/search*
  234. // @match *://searx.perennialte.ch/search*
  235. // @match *://s.trung.fun/searxng/search*
  236. // @match *://search.in.projectsegfau.lt/search*
  237. // @match *://search.projectsegfau.lt/search*
  238. // @match *://darmarit.org/searx/search*
  239. // @match *://searx.lunar.icu/search*
  240. // @match *://nyc1.sx.ggtyler.dev/search*
  241. // @match *://search.rhscz.eu/search*
  242. // @match *://paulgo.io/search*
  243. // @match *://northboot.xyz/search*
  244. // @match *://searx.zhenyapav.com/search*
  245. // @match *://searxng.ch/search*
  246. // @match *://copp.gg/search*
  247. // @match *://searx.sev.monster/search*
  248. // @match *://searx.oakleycord.dev/search*
  249. // @match *://searx.juancord.xyz/search*
  250. // @match *://searx.work/search*
  251. // @match *://search.ononoki.org/search*
  252. // @match *://search.demoniak.ch/search*
  253. // @match *://searx.cthd.icu/search*
  254. // @match *://searx.fmhy.net/search*
  255. // @match *://searx.headpat.exchange/search*
  256. // @match *://sex.finaltek.net/search*
  257. // @match *://search.gcomm.ch/search*
  258. // @match *://search.smnz.de/search*
  259. // @match *://searx.ankha.ac/search*
  260. // @match *://search.lvkaszus.pl/search*
  261. // @match *://searx.nobulart.com/search*
  262. // @match *://sx.t-1.org/search*
  263. // @match *://www.jabber-germany.de/searx/search*
  264. // @match *://sx.catgirl.cloud/search*
  265. // @match *://sx.vern.cc/searxng/search*
  266.  
  267. // @match *://www.startpage.com/search*
  268. // @match *://www.startpage.com/sp/search*
  269.  
  270. // @match *://search.brave.com/search*
  271.  
  272. // @match *://duckduckgo.com
  273. // @match *://duckduckgo.com/?*
  274.  
  275. // @match *://ghosterysearch.com/search?*
  276. // @match *://presearch.com/search?*
  277.  
  278. // @match *://metager.org/*meta/meta.ger3*
  279. // @match *://metager.de/*meta/meta.ger3*
  280.  
  281. // @match *://4get.ca/web?*
  282. // @match *://4get.silly.computer/web?*
  283. // @match *://4get.plunked.party/web?*
  284. // @match *://4get.konakona.moe/web?*
  285. // @match *://4get.sijh.net/web?*
  286. // @match *://4get.hbubli.cc/web?*
  287. // @match *://4get.perennialte.ch/web?*
  288. // @match *://4get.zzls.xyz/web?*
  289. // @match *://4getus.zzls.xyz/web?*
  290. // @match *://4get.seitan-ayoub.lol/web?*
  291. // @match *://4get.dcs0.hu/web?*
  292. // @match *://4get.psily.garden/web?*
  293. // @match *://4get.lvkaszus.pl/web?*
  294. // @match *://4get.kizuki.lol/web?*
  295.  
  296. // @match *://search.ahwx.org/search.php?*
  297. // @match *://search2.ahwx.org/search.php?*
  298. // @match *://search3.ahwx.org/search.php?*
  299. // @match *://ly.owo.si/search.php?*
  300. // @match *://librey.franklyflawless.org/search.php?*
  301. // @match *://librey.org/search.php?*
  302. // @match *://search.davidovski.xyz/search.php?*
  303. // @match *://search.milivojevic.in.rs/search.php?*
  304. // @match *://glass.prpl.wtf/search.php?*
  305. // @match *://librex.uk.to/search.php?*
  306. // @match *://librey.ix.tc/search.php?*
  307. // @match *://search.funami.tech/search.php?*
  308. // @match *://librex.retro-hax.net/search.php?*
  309. // @match *://librex.nohost.network/search.php?*
  310. // @match *://search.pabloferreiro.es/search.php?*
  311. // @match *://librey.baczek.me/search.php?*
  312. // @match *://lx.benike.me/search.php?*
  313. // @match *://search.seitan-ayoub.lol/search.php?*
  314. // @match *://librey.myroware.net/search.php?*
  315. // @match *://librey.nezumi.party/search.php?*
  316. // @match *://search.zeroish.xyz/search.php?*
  317.  
  318. // @match *://stract.com/search?*
  319.  
  320. // @match *://www.etools.ch/searchSubmit.do*
  321. // @match *://www.etools.ch/mobileSearch.do*
  322.  
  323. // @match *://www.mojeek.com/search?*
  324. // @match *://yep.com/web?*
  325. // @match *://www.torry.io/search*
  326. // @match *://www.qwant.com/?*
  327. // @match *://www.ecosia.org/search?*
  328. // @match *://www.alltheinternet.com/?*
  329. // @match *://search.aol.com/*/search*
  330. // @match *://oceanhero.today/web?*
  331.  
  332. // @match *://swisscows.com/*/web?*
  333.  
  334. // @match *://search.lilo.org/?*
  335. // @match *://search.entireweb.com/search?*
  336. // @match *://search.gmx.com/web/result?*
  337. // @match *://search.gmx.com/web?*
  338. // @match *://youcare.world/all?*
  339. // @match *://spot.ecloud.global/search*
  340. // @match *://www.nona.de/?*
  341. // @match *://www.exalead.com/search/web/results/?*
  342. // @match *://search.seznam.cz/?*
  343. // @match *://gibiru.com/results.html?*
  344. // @match *://www.lukol.com/s.php?*
  345. // @match *://search.givewater.com/serp?*
  346. // @match *://results.excite.com/serp?*
  347. // @match *://www.webcrawler.com/serp?*
  348. // @match *://www.metacrawler.com/serp?*
  349. // @match *://www.dogpile.com/serp?*
  350.  
  351. // @grant none
  352. // @run-at document-end
  353. // @license GPL-2.0-only
  354. // ==/UserScript==
  355.  
  356. (function() {
  357. 'use strict';
  358.  
  359. // Define URL modification rules with precompiled regex
  360. const urlModificationRules = [
  361. // {
  362. // matchRegex: new RegExp(/^(?:.*?\/RU=)?(?:https?:\/\/)(?:[\w-]+\.|)((?:imdb|imgur|instagram|medium|odysee|quora|reddit|tiktok|twitter|wikipedia|youtube)\.(?:[a-z]+).*?)(?:$|\/RK=\d.*)/),
  363. // replaceWith: 'https://farside.link/$1'
  364. // },
  365. {
  366. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/((?!test)[a-z]+)\.?m?\.wikipedia\.org\/(?:[a-z]+|wiki)\/(?!Special:Search)(.*?)(?:$|\/RK=\d.*)/),
  367. replaceWith: 'https://www.wikiwand.com/$1/$2'
  368. },
  369. {
  370. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/zh\.?m?\.wikipedia\.org\/(?:zh-hans|wiki)\/(.*?)(?:$|\/RK=\d.*)/),
  371. replaceWith: 'https://www.wikiwand.com/zh-hans/$1'
  372. },
  373. {
  374. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/wikipedia\.org\/(?:[a-z]+|wiki)\/(?!Special:Search)(.*?)(?:$|\/RK=\d.*)/),
  375. replaceWith: 'https://www.wikiwand.com/en/$1'
  376. },
  377. {
  378. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:old|www)\.reddit\.com\/((?:r|u)\/.*?)(?:$|\/RK=\d.*)/),
  379. replaceWith: 'https://safereddit.com/$1'
  380. // replaceWith: 'https://lr.vern.cc/$1'
  381. },
  382. {
  383. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.quora\.com\/((?=.*-)[\w-]+|profile\/.*?)(?:$|\/RK=\d.*)/),
  384. replaceWith: 'https://quetre.iket.me/$1'
  385. },
  386. {
  387. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/twitter\.com\/([A-Za-z_][\w]+)(\/status\/(?:\d+))?(?:.*?)(?:$|\/RK=\d.*)/),
  388. replaceWith: 'https://nitter.catsarch.com/$1$2'
  389. },
  390. {
  391. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/stackoverflow\.com(\/questions\/\d+\/[\w-]+)(?:.*?)(?:$|\/RK=\d.*)/),
  392. replaceWith: 'https://ao.vern.cc$1'
  393. },
  394. {
  395. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/((?:(?:[\w.-]+)?medium(?:\.[\w-]+)?|towardsdatascience|betterprogramming|.*?plainenglish|.*?gitconnected|aninjusticemag|betterhumans|uxdesign|uxplanet)\.\w+\/(?=.*-)(?:.*?|[\w@.]+\/[\w-]+))(?:\?source=.*)?(?:$|\/RK=\d.*)/),
  396. replaceWith: 'https://freedium.cfd/https://$1'
  397. },
  398. {
  399. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:www\.|m\.)?youtube\.com\/((?:@|watch\?|playlist\?|channel\/|user\/|shorts\/).*?)(?:$|\/RK=\d.*)/),
  400. replaceWith: 'https://vid.puffyan.us/$1'
  401. // replaceWith: 'https://piped.video/$1'
  402. },
  403. {
  404. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/music\.youtube\.com\/((?:playlist\?|watch\?|channel\/|browse\/).*?)(?:$|\/RK=\d.*)/),
  405. replaceWith: 'https://hyperpipe.surge.sh/$1'
  406. },
  407. {
  408. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.twitch\.tv\/(\w+)(?:.*?)(?:$|\/RK=\d.*)/),
  409. replaceWith: 'https://ttv.vern.cc/$1'
  410. },
  411. {
  412. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:m|www)\.imdb\.com\/((?:title|name)\/\w+)(?:.*?)(?:$|\/RK=\d.*)/),
  413. replaceWith: 'https://ld.vern.cc/$1'
  414. },
  415. {
  416. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.goodreads\.com\/((?:(?:[a-z]+\/)?book\/show|work\/quotes|series|author\/show)\/[\w.-]+)(?:.*?)(?:$|\/RK=\d.*)/),
  417. replaceWith: 'https://bl.vern.cc/$1'
  418. },
  419. {
  420. // only support English Fandom sites
  421. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/((?!www|community).*?)\.fandom\.com\/wiki\/(.*?)(?:$|\/RK=\d.*)/),
  422. replaceWith: 'https://antifandom.com/$1/wiki/$2'
  423. },
  424. {
  425. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.urbandictionary\.com\/(define\.php\?term=.*?)(?:$|\/RK=\d.*)/),
  426. replaceWith: 'https://rd.vern.cc/$1'
  427. },
  428. {
  429. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.reuters\.com\/((?=.*\/)(?=.*-).*?)(?:$|\/RK=\d.*)/),
  430. replaceWith: 'https://nu.vern.cc/$1'
  431. },
  432. {
  433. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(www\.ft\.com\/content\/[\w-]+)(?:.*?)(?:$|\/RK=\d.*)/),
  434. replaceWith: 'https://archive.today/https://$1'
  435. },
  436. {
  437. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(www\.bloomberg\.com\/(?:(?:[a-z]+\/)?news|opinion)\/.*?)(?:$|\/RK=\d.*)/),
  438. replaceWith: 'https://archive.today/https://$1'
  439. },
  440. {
  441. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.npr\.org\/(?:\d{4}\/\d{2}\/\d{2}|sections)\/(?:[A-Za-z-]+\/\d{4}\/\d{2}\/\d{2}\/)?(\d+)\/(?:.*?)(?:$|\/RK=\d.*)/),
  442. replaceWith: 'https://text.npr.org/$1'
  443. },
  444. {
  445. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/news\.ycombinator\.com\/item\?id=(\d+)(?:.*?)(?:$|\/RK=\d.*)/),
  446. replaceWith: 'https://www.hckrnws.com/stories/$1'
  447. },
  448. {
  449. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:[a-z]+)\.slashdot\.org(.*?)(?:$|\/RK=\d.*)/),
  450. replaceWith: 'https://slashdot.org$1'
  451. },
  452. {
  453. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:(?:.*)(?:arxiv\.org\/pdf|arxiv-export-lb\.library\.cornell\.edu\/(?:pdf|abs)))\/(\d{4}\.\d{4,5}(v\d)?)(?:.*)/),
  454. replaceWith: 'https://arxiv.org/abs/$1'
  455. },
  456. {
  457. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(ieeexplore\.ieee\.org\/document\/\d+)\/(?:.*?)(?:$|\/RK=\d.*)/),
  458. replaceWith: 'https://$1'
  459. },
  460. {
  461. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/github\.ink(.*?)(?:$|\/RK=\d.*)/),
  462. replaceWith: 'https://github.com$1'
  463. },
  464. {
  465. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.snopes\.com(.*?)(?:$|\/RK=\d.*)/),
  466. replaceWith: 'https://sd.vern.cc$1'
  467. },
  468. {
  469. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.instructables\.com\/(.*?)(?:$|\/RK=\d.*)/),
  470. replaceWith: 'https://ds.vern.cc/$1'
  471. // replaceWith: 'https://structables.private.coffee/$1'
  472. },
  473. {
  474. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/genius\.com\/((?=[\w-]+lyrics|search\?q=).*?)(?:$|\/RK=\d.*)/),
  475. replaceWith: 'https://dm.vern.cc/$1'
  476. },
  477. {
  478. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(.*?)\.bandcamp\.com\/(?:$|\/RK=\d.*)/),
  479. replaceWith: 'https://tn.vern.cc/artist.php?name=$1'
  480. },
  481. {
  482. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(.*?)\.bandcamp\.com\/(.*?)\/(.*?)(?:$|\/RK=\d.*)/),
  483. replaceWith: 'https://tn.vern.cc/release.php?artist=$1&type=$2&name=$3'
  484. },
  485. {
  486. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/bandcamp\.com\/search\?q=(.*?)(?:$|\/RK=\d.*)/),
  487. replaceWith: 'https://tn.vern.cc/search.php?query=$1'
  488. },
  489. {
  490. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/f4\.bcbits\.com\/img\/(.*?)(?:$|\/RK=\d.*)/),
  491. replaceWith: 'https://tn.vern.cc/image.php?file=$1'
  492. },
  493. {
  494. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/t4\.bcbits\.com\/stream\/(.*?)\/(.*?)\/(.*?)\?token=(.*?)(?:$|\/RK=\d.*)/),
  495. replaceWith: 'https://tn.vern.cc/audio.php?directory=$1&format=$2&file=$3&token=$4'
  496. },
  497. {
  498. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:\w+\.)?imgur.com\/((?:a\/)?(?!gallery)[\w.]+)(?:.*?)(?:$|\/RK=\d.*)/),
  499. replaceWith: 'https://rimgo.totaldarkness.net/$1'
  500. },
  501. {
  502. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/www\.pixiv\.net\/(?:[a-z]+\/)?(artworks\/\d+|tags\/\w+|users\/\d+).*/),
  503. replaceWith: 'https://pixivfe.exozy.me/$1'
  504. },
  505. {
  506. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/knowyourmeme\.com\/(.*?)(?:$|\/RK=\d.*)/),
  507. replaceWith: 'https://mm.vern.cc/$1'
  508. },
  509. {
  510. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/tenor\.com\/((?:view|search)\/.*?)(?:$|\/RK=\d.*)/),
  511. replaceWith: 'https://sp.vern.cc/$1'
  512. },
  513. {
  514. matchRegex: new RegExp(/^(?:.*?\/RU=)?https?:\/\/(?:\w+\.)?ifunny\.co\/(picture\/.*?)(?:$|\/RK=\d.*)/),
  515. replaceWith: 'https://uf.vern.cc/$1'
  516. },
  517. {
  518. matchRegex: new RegExp(/^(?:.*?\/RU=)https?:\/\/(.*?)(?:$|\/RK=\d.*)/),
  519. replaceWith: 'https://$1'
  520. },
  521. // Add more rules here as needed
  522. ];
  523.  
  524. // Define enhanced selector rules for each search engine
  525. const selectorRules = {
  526. 'google': [
  527. {
  528. selector: 'div.MjjYud div.yuRUbf div span a',
  529. childSelector: 'div.byrV5b cite',
  530. updateChildText: true,
  531. containProtocol: true,
  532. urlDisplayMethod: 1
  533. },
  534. {
  535. // selector for sub-results
  536. selector: 'div.MjjYud div.HiHjCd a'
  537. },
  538. {
  539. // selector for sidebar links
  540. selector: 'div.TQc1id#rhs a'
  541. }
  542. ],
  543. 'yahoo': [
  544. {
  545. parentSelector: 'div#left div#web ol li div div.compTitle h3.title',
  546. linkNodeSelector: 'a',
  547. textNodeSelector: 'span.p-abs',
  548. childSelector: 'span',
  549. updateChildText: true,
  550. containProtocol: false,
  551. multiElementsForUrlDisplay: 2
  552. },
  553. {
  554. selector: 'div#left div#web ol li div ul.compArticleList a'
  555. },
  556. {
  557. selector: 'div#left div#web ol li div div.compGenericCardList a'
  558. },
  559. {
  560. selector: 'div#right ol.cardReg.searchRightTop a'
  561. }
  562. ],
  563. 'yahoojp': [
  564. {
  565. parentSelector: 'div.sw-CardBase div.sw-Card__title',
  566. linkNodeSelector: 'a.sw-Card__titleInner',
  567. textNodeSelector: 'div.sw-Card__titleCiteWrapper cite ol',
  568. childSelector: 'li',
  569. updateChildText: true,
  570. containProtocol: true,
  571. multiElementsForUrlDisplay: 1
  572. },
  573. {
  574. selector: 'div.sw-CardBase p.Algo__osl a'
  575. },
  576. {
  577. selector: 'div.sw-CardBase div.sw-Card.AnswerKnowledgePanel__title div.sw-Tooltip__balloonInner a',
  578. updateTextByOverwrite: true,
  579. urlDisplayMethod: 2
  580. },
  581. {
  582. selector: 'div.sw-CardBase div.sw-Card.AnswerKnowledgePanel__title a'
  583. },
  584. {
  585. selector: 'div.sw-CardBase div.sw-Card.AnswerKnowledgePanel__info a'
  586. }
  587. ],
  588. 'yandex': [
  589. {
  590. selector: 'ul#search-result li div.Organic-Subtitle div a',
  591. updateChildText: true,
  592. containProtocol: false,
  593. urlDisplayMethod: 1,
  594. },
  595. {
  596. selector: 'ul#search-result li div.Organic div a',
  597. }
  598. ],
  599. 'searx': [
  600. {
  601. selector: 'article.result a.url_wrapper',
  602. childSelector: 'span span',
  603. updateChildText: true,
  604. containProtocol: true,
  605. multiElementsForUrlDisplay: 1
  606. },
  607. {
  608. selector: 'article.result h3 a'
  609. },
  610. {
  611. selector: 'aside.infobox div.urls ul li a'
  612. }
  613. ],
  614. 'startpage': [
  615. {
  616. selector: 'a.w-gl__result-url.result-link',
  617. updateTextByOverwrite: true,
  618. urlDisplayMethod: 2
  619. },
  620. {
  621. selector: 'a.w-gl__result-title.result-link'
  622. },
  623. {
  624. selector: 'div.sx-kp-main a'
  625. }
  626. ],
  627. 'brave': [
  628. {
  629. selector: 'div.snippet a.h',
  630. childSelector: 'div.site cite.snippet-url span',
  631. updateChildText: true,
  632. containProtocol: false,
  633. multiElementsForUrlDisplay: 1
  634. },
  635. {
  636. selector: 'div#discussions.snippet a',
  637. },
  638. {
  639. selector: 'div#infobox-snippet.snippet a'
  640. }
  641. ],
  642. 'duckduckgo': [
  643. {
  644. selector: 'a.eVNpHGjtxRBq_gLOfGDr.LQNqh2U1kzYxREs65IJu'
  645. },
  646. {
  647. selector: 'a.Rn_JXVtoPVAFyGkcaXyK',
  648. childSelector: 'span',
  649. updateChildText: true,
  650. containProtocol: true,
  651. multiElementsForUrlDisplay: 1
  652. },
  653. {
  654. // Selector for sub-results
  655. selector: 'ul.b269SZlC2oyR13Fcc4Iy li a.f3uDrYrWF3Exrfp1m3Og'
  656. },
  657. {
  658. selector: 'div.react-module div section div a'
  659. }
  660. ],
  661. 'ghostery': [
  662. {
  663. selector: 'li.result h2 a'
  664. },
  665. {
  666. selector: 'li.result div.snippet div.address a.url',
  667. updateTextByOverwrite: true,
  668. urlDisplayMethod: 2
  669. }
  670. ],
  671. 'presearch': [
  672. {
  673. selector: 'div.relative div.w-auto a',
  674. childSelector: 'div',
  675. updateChildText: true,
  676. urlDisplayMethod: 3,
  677. },
  678. {
  679. selector: 'div.relative div.inline-block a'
  680. }
  681. ],
  682. 'metager': [
  683. {
  684. selector: 'h2.result-title a'
  685. },
  686. {
  687. selector: 'div.result-subheadline a',
  688. updateTextByOverwrite: true,
  689. urlDisplayMethod: 3
  690. },
  691. {
  692. selector: 'div.quicktip div.quicktip-headline h1 a'
  693. },
  694. {
  695. selector: 'div.quicktip div.quicktip-detail h2 a'
  696. }
  697. ],
  698. '4get': [
  699. {
  700. selector: 'div.text-result a.hover'
  701. },
  702. {
  703. selector: 'div.text-result div.sublinks a'
  704. },
  705. {
  706. selector: 'div.right-wrapper div.answer-wrapper div.answer div.answer-title a.answer-title'
  707. }
  708. ],
  709. 'librey': [
  710. {
  711. selector: 'div.text-result-wrapper a',
  712. updateTextWithoutOverwrite: true,
  713. useTopLevelDomain: true,
  714. urlDisplayMethod: 2
  715. },
  716. {
  717. selector: 'p.special-result-container a',
  718. updateTextWithoutOverwrite: true,
  719. urlDisplayMethod: 2
  720. },
  721. ],
  722. 'stract': [
  723. {
  724. selector: 'div.grid div div.flex div div a.text-link'
  725. },
  726. {
  727. selector: 'div.grid div div.flex div div div a',
  728. updateTextByOverwrite: true,
  729. urlDisplayMethod: 2
  730. },
  731. {
  732. selector: 'div.mb-5.text-xl a'
  733. },
  734. {
  735. selector: 'div.text-sm a.text-link'
  736. }
  737. ],
  738. 'etools': [
  739. {
  740. // searchSubmit.do
  741. selector: 'td.record a.title'
  742. },
  743. {
  744. // mobileSearch.do
  745. selector: 'p a.title'
  746. }
  747. ],
  748. 'mojeek': [
  749. {
  750. selector: 'ul.results-standard li h2 a.title'
  751. },
  752. {
  753. selector: 'ul.results-standard li a.ob',
  754. childSelector: 'span.url',
  755. updateChildText: true,
  756. containProtocol: true,
  757. urlDisplayMethod: 1
  758. },
  759. {
  760. selector: 'div.infobox p a'
  761. },
  762. {
  763. selector: 'div.results.news-results li a'
  764. },
  765. {
  766. selector: 'div.right-col div.results ul li a'
  767. }
  768. ],
  769. 'yep': [
  770. {
  771. selector: 'div.css-102xgmn-card div div a',
  772. childSelector: 'div span',
  773. updateChildText: true,
  774. containProtocol: false,
  775. urlDisplayMethod: 1
  776. }
  777. ],
  778. 'torry': [
  779. {
  780. selector: 'div.searpList p a.toranclick',
  781. updateTextByOverwrite: true,
  782. urlDisplayMethod: 2
  783. },
  784. {
  785. selector: 'div.searpList div h2 a.toranclick',
  786. },
  787. {
  788. selector: 'div.searpList ul li a',
  789. }
  790. ],
  791. 'qwant': [
  792. {
  793. selector: 'div._35zId._3A7p7 a.external'
  794. },
  795. {
  796. selector: 'div._35zId._3WA-c a.external',
  797. childSelector: 'span',
  798. updateChildText: true,
  799. containProtocol: false,
  800. multiElementsForUrlDisplay: 1
  801. },
  802. {
  803. // Selector for sub-results
  804. selector: 'div._12BMd div._2-LMx._2E8gc._16lFV.Ks7KS.tCpbb.m_hqb a.external'
  805. },
  806. {
  807. selector: 'div._3McWE.is-sidebar a.external'
  808. }
  809. ],
  810. 'ecosia': [
  811. {
  812. selector: 'div.mainline__result-wrapper div.result__header div.result__info a',
  813. childSelector: 'span span',
  814. updateChildText: true,
  815. containProtocol: true,
  816. multiElementsForUrlDisplay: 1
  817. },
  818. {
  819. selector: 'div.mainline__result-wrapper div.result__header div.result__title a'
  820. },
  821. {
  822. selector: 'div.mainline__result-wrapper div ul li a'
  823. },
  824. {
  825. selector: 'aside.sidebar article div.entity-links ul li a'
  826. },
  827. {
  828. selector: 'aside.sidebar article div.entity__content p a'
  829. }
  830. ],
  831. 'alltheinternet': [
  832. {
  833. parentSelector: 'div.gs-webResult.gs-result',
  834. linkNodeSelector: 'a.gs-title',
  835. textNodeSelector: 'div.gsc-url-top div.gs-visibleUrl-long',
  836. updateTextByOverwrite: true,
  837. urlDisplayMethod: 2
  838. }
  839. ],
  840. 'aol': [
  841. {
  842. parentSelector: 'div#left div#web ol li div div.compTitle',
  843. linkNodeSelector: 'h3.title a',
  844. textNodeSelector: 'div span',
  845. updateTextByOverwrite: true,
  846. urlDisplayMethod: 3
  847. },
  848. {
  849. selector: 'div#left div#web ol li div div.compList a'
  850. },
  851. {
  852. selector: 'div#right ol.cardReg.searchRightTop a'
  853. }
  854. ],
  855. 'oceanhero': [
  856. {
  857. selector: 'div div div a',
  858. childSelector: 'span cite',
  859. updateChildText: true,
  860. containProtocol: false,
  861. urlDisplayMethod: 1
  862. },
  863. {
  864. selector: 'section div ul li a'
  865. },
  866. {
  867. selector: 'div div div p a'
  868. }
  869. ],
  870. 'swisscows': [
  871. {
  872. selector: 'article.item-web a.site',
  873. updateTextWithoutOverwrite: true,
  874. containProtocol: false,
  875. urlDisplayMethod: 1
  876. },
  877. {
  878. selector: 'article.item-web a'
  879. }
  880. ],
  881. 'lilo': [
  882. {
  883. selector: 'div.lilo-text-result div p a.has-text-grey-darker',
  884. childSelector: 'span',
  885. updateChildText: true,
  886. containProtocol: true,
  887. multiElementsForUrlDisplay: 2
  888. },
  889. {
  890. selector: 'div.lilo-text-result div a.has-text-primary'
  891. },
  892. {
  893. selector: 'div.column.is-two-fifths a'
  894. }
  895. ],
  896. 'entireweb': [
  897. {
  898. parentSelector: 'div.web-result',
  899. linkNodeSelector: 'a.web-result-title',
  900. textNodeSelector: 'div.web-result-domain',
  901. updateTextWithoutOverwrite: true,
  902. urlDisplayMethod: 3
  903. },
  904. {
  905. selector: 'div#infobox-list.card div.card-body a'
  906. },
  907. {
  908. parentSelector: 'div.gsc-webResult.gsc-result',
  909. linkNodeSelector: 'a.gs-title',
  910. textNodeSelector: 'div.gsc-url-top',
  911. updateTextByOverwrite: true,
  912. containProtocol: false,
  913. urlDisplayMethod: 1
  914. }
  915. ],
  916. 'gmx': [
  917. {
  918. selector: 'div.eMd a.eMdhl'
  919. },
  920. {
  921. selector: 'div.eMd a.eMdu',
  922. childSelector: 'span',
  923. updateChildText: true,
  924. containProtocol: true,
  925. multiElementsForUrlDisplay: 2
  926. },
  927. ],
  928. 'youcare': [
  929. {
  930. selector: 'div.search-result-item-text a.search-result-item-text__title'
  931. },
  932. {
  933. selector: 'div.search-result-item-text div div a.search-result-item-text-sitename'
  934. },
  935. {
  936. selector: 'div.search-result-item-text div div a.search-result-item-text__header-url',
  937. updateTextWithoutOverwrite: true,
  938. containProtocol: true,
  939. urlDisplayMethod: 1
  940. },
  941. {
  942. selector: "div.search-results-view__side a"
  943. }
  944. ],
  945. 'spot': [
  946. {
  947. selector: 'div.result h4 a'
  948. },
  949. {
  950. selector: 'div.result a.external-link',
  951. updateTextByOverwrite: true,
  952. urlDisplayMethod: 2
  953. },
  954. {
  955. selector: 'div.infobox div.footer div.links a'
  956. }
  957. ],
  958. 'nona': [
  959. {
  960. selector: 'section.result-section article.teaser div.teaser__container a.teaser__topline',
  961. updateTextByOverwrite: true,
  962. urlDisplayMethod: 2
  963. },
  964. {
  965. selector: 'section.result-section article.teaser div.teaser__container a.teaser__link'
  966. },
  967. {
  968. selector: 'section.result-section article.entity-teaser div.entity-teaser__wrapper a'
  969. }
  970. ],
  971. 'exalead': [
  972. {
  973. selector: 'li.media div.media-body a.ellipsis',
  974. updateTextByOverwrite: true,
  975. urlDisplayMethod: 3
  976. },
  977. {
  978. selector: 'li.media div.media-body a'
  979. }
  980. ],
  981. 'seznam': [
  982. {
  983. selector: 'div.f2c528 h3 a'
  984. },
  985. {
  986. selector: 'div.f2c528 a.d5e75c',
  987. updateTextByOverwrite: true,
  988. urlDisplayMethod: 3
  989. },
  990. ],
  991. 'gibiru': [
  992. {
  993. parentSelector: 'div.gs-webResult.gs-result',
  994. linkNodeSelector: 'a.gs-title',
  995. textNodeSelector: 'div.gsc-url-top div.gs-visibleUrl-breadcrumb',
  996. childSelector: 'span',
  997. updateChildText: true,
  998. containProtocol: false,
  999. multiElementsForUrlDisplay: 1
  1000. }
  1001. ],
  1002. 'lukol': [
  1003. {
  1004. parentSelector: 'div.gsc-webResult.gsc-result',
  1005. linkNodeSelector: 'a.gs-title',
  1006. textNodeSelector: 'div.gsc-url-bottom div.gs-visibleUrl-long',
  1007. updateTextByOverwrite: true,
  1008. urlDisplayMethod: 2
  1009. }
  1010. ],
  1011. 'givewater': [
  1012. {
  1013. parentSelector: 'div.web-bing__result',
  1014. linkNodeSelector: 'a.web-bing__title',
  1015. textNodeSelector: 'span.web-bing__url',
  1016. updateTextByOverwrite: true,
  1017. urlDisplayMethod: 2
  1018. }
  1019. ],
  1020. 'excite': [
  1021. {
  1022. parentSelector: 'div.web-bing__result',
  1023. linkNodeSelector: 'a.web-bing__title',
  1024. textNodeSelector: 'span.web-bing__url',
  1025. updateTextByOverwrite: true,
  1026. urlDisplayMethod: 2
  1027. }
  1028. ],
  1029. 'webcrawler': [
  1030. {
  1031. parentSelector: 'div.web-bing__result',
  1032. linkNodeSelector: 'a.web-bing__title',
  1033. textNodeSelector: 'span.web-bing__url',
  1034. updateTextByOverwrite: true,
  1035. urlDisplayMethod: 2
  1036. }
  1037. ],
  1038. 'metacrawler': [
  1039. {
  1040. parentSelector: 'div.web-bing__result',
  1041. linkNodeSelector: 'a.web-bing__title',
  1042. textNodeSelector: 'span.web-bing__url',
  1043. updateTextByOverwrite: true,
  1044. urlDisplayMethod: 2
  1045. }
  1046. ],
  1047. 'dogpile': [
  1048. {
  1049. parentSelector: 'div.web-bing__result',
  1050. linkNodeSelector: 'a.web-bing__title',
  1051. textNodeSelector: 'span.web-bing__url',
  1052. updateTextByOverwrite: true,
  1053. urlDisplayMethod: 2
  1054. }
  1055. ]
  1056. // Additional search engines can be defined here...
  1057. };
  1058.  
  1059. // User-defined list of search engine instance URLs
  1060. const searchEngines = {
  1061. 'google': {
  1062. hosts: ['google.com'],
  1063. // search results container
  1064. // you can ignore this parameter if you don't want to set it, just delete it
  1065. // defult value is 'body'
  1066. resultContainerSelectors: ['div.GyAeWb#rcnt']
  1067. },
  1068. 'yahoo': {
  1069. hosts: ['search.yahoo.com'],
  1070. resultContainerSelectors: ['div#results div#cols']
  1071. },
  1072. 'yahoojp': {
  1073. hosts: ['search.yahoo.co.jp'],
  1074. resultContainerSelectors: ['div#contents div#contents__wrap']
  1075. },
  1076. 'yandex': {
  1077. hosts: [
  1078. 'yandex.com',
  1079. 'yandex.ru'
  1080. ],
  1081. resultContainerSelectors: ['div.main__container']
  1082. },
  1083. 'searx': {
  1084. hosts: [
  1085. 'search.disroot.org',
  1086. 'searx.tiekoetter.com',
  1087. 'search.bus-hit.me',
  1088. 'search.inetol.net',
  1089. 'priv.au',
  1090. 'searx.be',
  1091. 'searxng.site',
  1092. 'search.hbubli.cc',
  1093. 'search.im-in.space',
  1094. 'opnxng.com',
  1095. 'search.upinmars.com',
  1096. 'search.sapti.me',
  1097. 'freesearch.club',
  1098. 'xo.wtf',
  1099. 'www.gruble.de',
  1100. 'searx.tuxcloud.net',
  1101. 'baresearch.org',
  1102. 'searx.daetalytica.io',
  1103. 'etsi.me',
  1104. 'search.leptons.xyz',
  1105. 'search.rowie.at',
  1106. 'search.mdosch.de',
  1107. 'searx.catfluori.de',
  1108. 'searx.si',
  1109. 'searx.namejeff.xyz',
  1110. 'search.itstechtime.com',
  1111. 's.mble.dk',
  1112. 'searx.kutay.dev',
  1113. 'ooglester.com',
  1114. 'searx.ox2.fr',
  1115. 'searx.techsaviours.org',
  1116. 'searx.perennialte.ch',
  1117. 's.trung.fun',
  1118. 'search.in.projectsegfau.lt',
  1119. 'search.projectsegfau.lt',
  1120. 'darmarit.org',
  1121. 'searx.lunar.icu',
  1122. 'nyc1.sx.ggtyler.dev',
  1123. 'search.rhscz.eu',
  1124. 'paulgo.io',
  1125. 'northboot.xyz',
  1126. 'searx.zhenyapav.com',
  1127. 'searxng.ch',
  1128. 'copp.gg',
  1129. 'searx.sev.monster',
  1130. 'searx.oakleycord.dev',
  1131. 'searx.juancord.xyz',
  1132. 'searx.work',
  1133. 'search.ononoki.org',
  1134. 'search.demoniak.ch',
  1135. 'searx.cthd.icu',
  1136. 'searx.fmhy.net',
  1137. 'searx.headpat.exchange',
  1138. 'sex.finaltek.net',
  1139. 'search.gcomm.ch',
  1140. 'search.smnz.de',
  1141. 'searx.ankha.ac',
  1142. 'search.lvkaszus.pl',
  1143. 'searx.nobulart.com',
  1144. 'sx.t-1.org',
  1145. 'www.jabber-germany.de',
  1146. 'sx.catgirl.cloud'
  1147. ],
  1148. resultContainerSelectors: [
  1149. 'main#main_results'
  1150. // 'maindiv#main_results div#urls'
  1151. // 'div#sidebar div#infoboxes'
  1152. ]
  1153. },
  1154. 'startpage': {
  1155. hosts: ['startpage.com'],
  1156. resultContainerSelectors: [
  1157. 'div.show-results',
  1158. ]
  1159. },
  1160. 'brave': {
  1161. hosts: ['search.brave.com'],
  1162. resultContainerSelectors: [
  1163. 'main.main-column',
  1164. 'aside.sidebar'
  1165. ]
  1166. },
  1167. 'duckduckgo': {
  1168. hosts: ['duckduckgo.com'],
  1169. resultContainerSelectors: [
  1170. 'section[data-testid="mainline"][data-area="mainline"]',
  1171. 'section[data-testid="sidebar"][data-area="sidebar"]'
  1172. ]
  1173. },
  1174. 'ghostery': {
  1175. hosts: ['ghosterysearch.com'],
  1176. resultContainerSelectors: ['section.results']
  1177. },
  1178. 'presearch': {
  1179. hosts: ['presearch.com'],
  1180. resultContainerSelectors: ['div.w-full']
  1181. },
  1182. 'metager': {
  1183. hosts: [
  1184. 'metager.org',
  1185. 'metager.de'
  1186. ],
  1187. resultContainerSelectors: [
  1188. 'div#results',
  1189. 'div#additions-container'
  1190. ]
  1191. },
  1192. '4get': {
  1193. hosts: [
  1194. '4get.ca',
  1195. '4get.silly.computer',
  1196. '4get.plunked.party',
  1197. '4get.konakona.moe',
  1198. '4get.sijh.net',
  1199. '4get.hbubli.cc',
  1200. '4get.perennialte.ch',
  1201. '4get.zzls.xyz',
  1202. '4getus.zzls.xyz',
  1203. '4get.seitan-ayoub.lol',
  1204. '4get.dcs0.hu',
  1205. '4get.psily.garden',
  1206. '4get.lvkaszus.pl',
  1207. '4get.kizuki.lol'
  1208. ],
  1209. resultContainerSelectors: ['div#overflow']
  1210. },
  1211. 'librey': {
  1212. hosts: [
  1213. 'search.ahwx.org',
  1214. 'search2.ahwx.org',
  1215. 'search3.ahwx.org',
  1216. 'ly.owo.si',
  1217. 'librey.franklyflawless.org',
  1218. 'librey.org',
  1219. 'search.davidovski.xyz',
  1220. 'search.milivojevic.in.rs',
  1221. 'glass.prpl.wtf',
  1222. 'librex.uk.to',
  1223. 'librey.ix.tc',
  1224. 'search.funami.tech',
  1225. 'librex.retro-hax.net',
  1226. 'librex.nohost.network',
  1227. 'search.pabloferreiro.es',
  1228. 'librey.baczek.me',
  1229. 'lx.benike.me',
  1230. 'search.seitan-ayoub.lol',
  1231. 'librey.myroware.net',
  1232. 'librey.nezumi.party',
  1233. 'search.zeroish.xyz',
  1234. 'search.zeroish.xyz'
  1235. ],
  1236. resultContainerSelectors: [
  1237. 'div.text-result-container',
  1238. 'p.special-result-container'
  1239. ]
  1240. },
  1241. 'stract': {
  1242. hosts: ['stract.com'],
  1243. resultContainerSelectors: [
  1244. 'div.col-start-1',
  1245. 'div.row-start-2'
  1246. ]
  1247. },
  1248. 'etools': {
  1249. hosts: ['etools.ch'],
  1250. // resultContainerSelectors: ['table.result']
  1251. },
  1252. 'mojeek': {
  1253. hosts: ['mojeek.com'],
  1254. resultContainerSelectors: ['div.container.serp-results']
  1255. },
  1256. 'yep': {
  1257. hosts: ['yep.com']
  1258. },
  1259. 'torry': {
  1260. hosts: ['torry.io'],
  1261. resultContainerSelectors: ['div.searpListouterappend'],
  1262. attribute: 'data-target'
  1263. },
  1264. 'qwant': {
  1265. hosts: ['qwant.com'],
  1266. resultContainerSelectors: ['div._35zId']
  1267. },
  1268. 'ecosia': {
  1269. hosts: ['ecosia.org'],
  1270. resultContainerSelectors: [
  1271. 'section.mainline.web__mainline',
  1272. 'aside.sidebar.web__sidebar'
  1273. ]
  1274. },
  1275. 'alltheinternet': {
  1276. hosts: ['alltheinternet.com']
  1277. },
  1278. 'aol': {
  1279. hosts: ['search.aol.com'],
  1280. resultContainerSelectors: ['div#results div#cols']
  1281. },
  1282. 'oceanhero': {
  1283. hosts: ['oceanhero.today']
  1284. },
  1285. 'swisscows': {
  1286. hosts: ['swisscows.com'],
  1287. resultContainerSelectors: ['section.container.page-results']
  1288. },
  1289. 'lilo': {
  1290. hosts: ['search.lilo.org'],
  1291. resultContainerSelectors: ['div.container#content']
  1292. },
  1293. 'entireweb': {
  1294. hosts: ['search.entireweb.com'],
  1295. resultContainerSelectors: ['div.container.search-container']
  1296. },
  1297. 'gmx': {
  1298. hosts: ['search.gmx.com']
  1299. },
  1300. 'youcare': {
  1301. hosts: ['youcare.world']
  1302. },
  1303. 'spot': {
  1304. hosts: ['spot.ecloud.global'],
  1305. resultContainerSelectors: ['div.container.contents']
  1306. },
  1307. 'nona': {
  1308. hosts: ['nona.de'],
  1309. resultContainerSelectors: ['main.search-results div.container']
  1310. },
  1311. 'exalead': {
  1312. hosts: ['exalead.com'],
  1313. resultContainerSelectors: ['ul.media-list']
  1314. },
  1315. 'seznam': {
  1316. hosts: ['search.seznam.cz'],
  1317. resultContainerSelectors: ['div.PageWrapper.SearchPage#searchpage-root'],
  1318. },
  1319. 'gibiru': {
  1320. hosts: ['gibiru.com'],
  1321. resultContainerSelectors: ['div.container#web-results'],
  1322. },
  1323. 'lukol': {
  1324. hosts: ['lukol.com']
  1325. },
  1326. 'givewater': {
  1327. hosts: ['search.givewater.com'],
  1328. resultContainerSelectors: ['div.mainline-results']
  1329. },
  1330. 'excite': {
  1331. hosts: ['results.excite.com'],
  1332. resultContainerSelectors: ['div.mainline-results']
  1333. },
  1334. 'webcrawler': {
  1335. hosts: ['webcrawler.com'],
  1336. resultContainerSelectors: ['div.web-bing'],
  1337. },
  1338. 'metacrawler': {
  1339. hosts: ['metacrawler.com'],
  1340. resultContainerSelectors: ['div.web-bing'],
  1341. },
  1342. 'dogpile': {
  1343. hosts: ['dogpile.com'],
  1344. resultContainerSelectors: ['div.web-bing'],
  1345. }
  1346. // ... more search engines
  1347. };
  1348.  
  1349. // Function to modify URLs and optionally text
  1350. const modifyUrls = (engine, observer, resultContainer, engineInfo) => {
  1351. try {
  1352. const selectors = selectorRules[engine];
  1353. if (selectors) {
  1354. // Disconnect the observer to prevent recursive triggering
  1355. observer.disconnect();
  1356.  
  1357. // Modify results
  1358. selectors.forEach(rule => {
  1359. if (rule.selector) {
  1360. processElements(rule.selector, rule, engineInfo);
  1361. } else if (rule.parentSelector) {
  1362. processParentElements(rule.parentSelector, rule, engineInfo);
  1363. }
  1364. });
  1365.  
  1366. // Reconnect the observer after DOM modifications are done
  1367. observer.observe(resultContainer, { childList: true, subtree: true });
  1368. }
  1369. } catch (error) {
  1370. console.error("URL Modification Error: ", error);
  1371. }
  1372. };
  1373.  
  1374. // Function to process elements specified by `selector`
  1375. const processElements = (selector, rule, engineInfo) => {
  1376. const elements = document.querySelectorAll(selector);
  1377. const additionalAttribute = engineInfo.attribute; // Get the additional attribute if specified
  1378. if (elements.length > 0) {
  1379. elements.forEach(element => {
  1380. for (let i = 0; i < urlModificationRules.length; i++) {
  1381. try {
  1382. const urlRule = urlModificationRules[i];
  1383. let urlToModify = additionalAttribute ? element.getAttribute(additionalAttribute) : element.href;
  1384. urlToModify = decodeURIComponent(urlToModify);
  1385. // update attribute
  1386. if (urlToModify && urlRule.matchRegex.test(urlToModify)) {
  1387. // Generate redirected URL
  1388. let newUrl = urlToModify.replace(urlRule.matchRegex, urlRule.replaceWith);
  1389. newUrl = rule.useTopLevelDomain ? extractTopLevelDomain(newUrl) : newUrl;
  1390. if (element.href) {
  1391. element.href = newUrl;
  1392. } else if (additionalAttribute) {
  1393. element.setAttribute(additionalAttribute, newUrl);
  1394. }
  1395. updateTextContent(element, rule, removeTailingSlash(removeParameters(newUrl)));
  1396. break;
  1397. }
  1398. } catch (error) {
  1399. console.error("Update Link/Text Error: ", error);
  1400. }
  1401. }
  1402. });
  1403. }
  1404. };
  1405.  
  1406. // Function to process elements specified by `parentSelector`
  1407. const processParentElements = (selector, rule, engineInfo) => {
  1408. const elements = document.querySelectorAll(selector);
  1409. const additionalAttribute = engineInfo.attribute; // Get the additional attribute if specified
  1410. if (elements.length > 0) {
  1411. elements.forEach(element => {
  1412. const linkElement = element.querySelector(rule.linkNodeSelector);
  1413. const textElement = element.querySelector(rule.textNodeSelector);
  1414.  
  1415. for (let i = 0; i < urlModificationRules.length; i++) {
  1416. try {
  1417. const urlRule = urlModificationRules[i];
  1418. let urlToModify = additionalAttribute ? element.getAttribute(additionalAttribute) : linkElement.href;
  1419. urlToModify = decodeURIComponent(urlToModify);
  1420. // update attribute
  1421. if (urlToModify && urlRule.matchRegex.test(urlToModify)) {
  1422. // Generate redirected URL
  1423. let newUrl = urlToModify.replace(urlRule.matchRegex, urlRule.replaceWith);
  1424. newUrl = rule.useTopLevelDomain ? extractTopLevelDomain(newUrl) : newUrl;
  1425. if (linkElement.href) {
  1426. linkElement.href = newUrl;
  1427. } else if (additionalAttribute) {
  1428. linkElement.setAttribute(additionalAttribute, newUrl);
  1429. }
  1430. updateTextContent(textElement, rule, removeTailingSlash(removeParameters(newUrl)));
  1431. break;
  1432. }
  1433. } catch (error) {
  1434. console.error("Update Link/Text Error: ", error);
  1435. }
  1436. }
  1437. });
  1438. }
  1439. };
  1440.  
  1441. // Function to update text content (displayed URL)
  1442. const updateTextContent = (element, rule, newUrl) => {
  1443. if ((rule.updateChildText && rule.childSelector) ||
  1444. rule.updateTextWithoutOverwrite || rule.updateTextByOverwrite) {
  1445. try {
  1446. if (rule.multiElementsForUrlDisplay) {
  1447. updateMultiElementContent(element, rule, newUrl);
  1448. } else {
  1449. const targetElement = rule.childSelector ? element.querySelector(rule.childSelector) : element;
  1450. updateSingleElementText(targetElement, rule, newUrl);
  1451. }
  1452. } catch (error) {
  1453. console.error("Update Displayed URL Error: ", error);
  1454. }
  1455. }
  1456. };
  1457.  
  1458. // Function to update text for multi elements (e.g. DuckDuckGo, Brave)
  1459. const updateMultiElementContent = (targetElement, rule, newUrl) => {
  1460. if (!targetElement) {
  1461. console.error("Target DOM Element not found for Multi-Element Text update!");
  1462. return;
  1463. }
  1464. // Remove the "https://" protocol if containProtocol is false
  1465. newUrl = rule.containProtocol ? newUrl : removeProtocol(newUrl);
  1466. let formattedUrl = breadCumbFormat(newUrl, rule.containProtocol);
  1467. let urlParts = formattedUrl.split(' › ');
  1468.  
  1469. const spans = targetElement.querySelectorAll(rule.childSelector)
  1470.  
  1471. switch (rule.multiElementsForUrlDisplay) {
  1472. case 1:
  1473. parallelElements(urlParts, spans);
  1474. break;
  1475. case 2:
  1476. mixedElements(urlParts, spans, targetElement);
  1477. break;
  1478. case 3:
  1479. mixedElementsWithoutClear(urlParts, spans, targetElement);
  1480. break;
  1481. }
  1482. };
  1483.  
  1484. const parallelElements = (urlParts, elements) => {
  1485. if (elements && elements.length >= 2) {
  1486. elements.forEach(clearElementContent);
  1487. elements[0].textContent = urlParts[0]; // Update the first part
  1488. elements[1].textContent = ' › ' + urlParts.slice(1).join(' › '); // Update the second part
  1489. } else {
  1490. console.error("Script: Expected structure not found for Multi-Element (parallel elements) URL update!");
  1491. }
  1492. };
  1493.  
  1494. const mixedElements = (urlParts, elements, parent) => {
  1495. if (elements && elements.length >= 1) {
  1496. elements.forEach(clearElementContent);
  1497. updateTextWithoutOverwriteChildNodes(parent, urlParts[0]); // Update the first part
  1498. elements[0].textContent = ' › ' + urlParts.slice(1).join(' › '); // Update the second part
  1499. } else {
  1500. console.error("Script: Expected structure not found for Multi-Element (mixed elements) URL update!");
  1501. }
  1502. };
  1503.  
  1504. const mixedElementsWithoutClear = (urlParts, elements, parent) => {
  1505. if (elements && elements.length >= 1) {
  1506. updateTextWithoutOverwriteChildNodes(parent, urlParts[0]); // Update the first part
  1507. elements[0].textContent = ' › ' + urlParts.slice(1).join(' › '); // Update the second part
  1508. } else {
  1509. console.error("Script: Expected structure not found for Multi-Element (mixed elements with clear) URL update!");
  1510. }
  1511. };
  1512.  
  1513. // Function to update text for a single element
  1514. const updateSingleElementText = (targetElement, rule, newUrl) => {
  1515. if (!targetElement) {
  1516. console.error("Target DOM Element not found for Single-Element Text update!");
  1517. return;
  1518. }
  1519. let formattedUrl = '';
  1520. switch (rule.urlDisplayMethod) {
  1521. case 1:
  1522. formattedUrl = breadCumbFormat(newUrl, rule.containProtocol);
  1523. break;
  1524. case 2:
  1525. formattedUrl = newUrl; // Full URL with protocol
  1526. break;
  1527. case 3:
  1528. formattedUrl = decodeURIComponent(removeProtocol(newUrl)); // Full URL without protocol
  1529. break;
  1530. }
  1531. if (rule.updateTextWithoutOverwrite) {
  1532. updateTextWithoutOverwriteChildNodes(targetElement, formattedUrl);
  1533. } else if (rule.updateTextByOverwrite) {
  1534. updateTextByOverwriteEverything(targetElement, formattedUrl);
  1535. } else {
  1536. targetElement.textContent = formattedUrl;
  1537. }
  1538. };
  1539.  
  1540. // Function for Method 1 (Breadcrumb style URLs), leaving 'https://' intact
  1541. const breadCumbFormat = (url, containProtocol) => {
  1542. if (!containProtocol) {
  1543. url = removeProtocol(url);
  1544. }
  1545. // Split the URL while keeping 'https://' intact; Replace the second occurrence of 'https://' with 'https', if exists
  1546. // Replace the first occurrence of 'https://' with a placeholder
  1547. url = url.replace('https://', 'https › ');
  1548. // Deal with the second 'https://'
  1549. let secondHttpsIndex = url.indexOf('https://');
  1550. if (secondHttpsIndex !== -1) {
  1551. url = url.substring(0, secondHttpsIndex) + 'https › ' + url.substring(secondHttpsIndex + 8);
  1552. }
  1553. // Split the URL with '/'
  1554. let parts = url.split('/');
  1555. // Restore the first 'https://' in the URL
  1556. parts[0] = parts[0].replace('https › ', 'https://');
  1557.  
  1558. // Join the URL parts with ' › '
  1559. let joinedUrl = parts.join(' › ');
  1560.  
  1561. // Decode the URL to convert encoded characters to their original form
  1562. return decodeURIComponent(joinedUrl);
  1563. };
  1564.  
  1565. // Function to update only the text node within an element, leave the child elements, if exist, intact
  1566. const updateTextWithoutOverwriteChildNodes = (element, newContent) => {
  1567. let currentIndex = 0;
  1568. const indexObject = { currentIndex };
  1569. collectNodes(element, node => {
  1570. if (currentIndex >= newContent.length) return; // Stop if we've used all the new content
  1571. replaceTextContent(node, oldText => replaceTextBasedOnIndex(oldText, newContent, indexObject));
  1572. });
  1573. };
  1574.  
  1575. const collectNodes = (node, callback) => {
  1576. // View these elements as text node
  1577. const elementsToIncludeAsText = ['B'];
  1578. // Do not view these elements as text node
  1579. const elementsToExcludeAsText = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'DIV', 'P'];
  1580.  
  1581. if (node.nodeType === Node.TEXT_NODE) {
  1582. callback(node);
  1583. } else if (node.nodeType === Node.ELEMENT_NODE && elementsToIncludeAsText.includes(node.tagName.toUpperCase())) {
  1584. callback(node);
  1585. } else if (node.nodeType === Node.ELEMENT_NODE && !elementsToExcludeAsText.includes(node.tagName.toUpperCase())) {
  1586. node.childNodes.forEach(child => collectNodes(child, callback));
  1587. }
  1588. };
  1589.  
  1590. const replaceTextContent = (node, textUpdater) => {
  1591. if (node.nodeType === Node.TEXT_NODE) {
  1592. node.nodeValue = textUpdater(node.nodeValue);
  1593. } else if (node.innerHTML) { // For elements treated as text, like <b>
  1594. node.innerHTML = textUpdater(node.innerHTML);
  1595. }
  1596. };
  1597.  
  1598. const replaceTextBasedOnIndex = (oldText, newContent, indexObject) => {
  1599. const newText = newContent.slice(indexObject.currentIndex, indexObject.currentIndex + oldText.length);
  1600. indexObject.currentIndex += oldText.length;
  1601. return newText;
  1602. };
  1603.  
  1604. // Function to update the content by overwriting everything
  1605. const updateTextByOverwriteEverything = (element, newContent) => {
  1606. clearElementContent(element);
  1607. element.textContent = newContent;
  1608. };
  1609.  
  1610. // Extract the top level domain from URL link
  1611. const extractTopLevelDomain = (url) => {
  1612. const parsedUrl = new URL(url);
  1613. return `${parsedUrl.protocol}//${parsedUrl.hostname}/`;
  1614. };
  1615.  
  1616. // Remove 'https://' from the URL link
  1617. const removeProtocol = (url) => {
  1618. return url.replace(/^https?:\/\//, '');
  1619. };
  1620.  
  1621. // Remove parameters (the part behind ?) in the URL link
  1622. const removeParameters = (url) => {
  1623. return url.split('?')[0];
  1624. };
  1625.  
  1626. // Remove tailing slash '/'
  1627. const removeTailingSlash = (url) => {
  1628. // Check if the URL ends with a slash and remove it if present
  1629. return url.endsWith('/') ? url.slice(0, -1) : url;
  1630. };
  1631.  
  1632. // Function to clear existing content of an element
  1633. const clearElementContent = (element) => {
  1634. element.textContent = '';
  1635. };
  1636.  
  1637. // Improved function to determine the search engine
  1638. const getSearchEngineInfo = () => {
  1639. try {
  1640. const host = window.location.host;
  1641. for (const engine in searchEngines) {
  1642. if (searchEngines[engine].hosts.some(instanceHost => host.includes(instanceHost))) {
  1643. // Default to 'body' if not specified
  1644. const selectors = searchEngines[engine].resultContainerSelectors || ['body'];
  1645. // Get the attribute if specified
  1646. const attribute = searchEngines[engine].attribute;
  1647. return {
  1648. engine,
  1649. selectors: selectors,
  1650. attribute: attribute
  1651. };
  1652. }
  1653. }
  1654. } catch (error) {
  1655. console.error("Error determining search engine: ", error);
  1656. }
  1657. };
  1658.  
  1659. const observeToExecute = (engine, selector, engineInfo) => {
  1660. const resultContainers = document.querySelectorAll(selector);
  1661. if (resultContainers) {
  1662. resultContainers.forEach(resultContainer => {
  1663. // Observe changes in each result container
  1664. const observer = new MutationObserver(() => modifyUrls(engine, observer, resultContainer, engineInfo));
  1665. observer.observe(resultContainer, { childList: true, subtree: true });
  1666. modifyUrls(engine, observer, resultContainer, engineInfo);
  1667. });
  1668. }
  1669. };
  1670.  
  1671. // Run the script for the current search engine
  1672. try {
  1673. const engineInfo = getSearchEngineInfo();
  1674. if (engineInfo) {
  1675. engineInfo.selectors.forEach(containerSelector => {
  1676. observeToExecute(engineInfo.engine, containerSelector, engineInfo);
  1677. });
  1678. }
  1679. } catch (error) {
  1680. console.error("Error executing URL Modifier Script: ", error);
  1681. }
  1682. })();