首先安装油猴脚本(tampermonkey)
chrome:【油猴脚本(tampermonkey)插件】。chrome或者其他浏览器也可以去【油猴脚本(tampermonkey)官网】下载。
代码首先在greasyfork上的分享
其次在吾爱油猴上的分享
最后我直接贴上代码:
1 // ==UserScript== 2 // @name 百度网盘搜索引擎聚合 3 // @version 1.4 4 // @description 在百度云盘页面中新增百度网盘搜索引擎聚合 5 // @match *://pan.baidu.com/* 6 // @match *://yun.baidu.com/* 7 // @grant 来自各个网盘搜索引擎开发者 8 // @author 太史子义慈 9 // @namespace [email protected] 10 // ==/UserScript== 11 12 !(function() { 13 bseg(); 14 })(); 15 16 function bseg() { 17 //确定显示点是否存在 18 if(document.querySelector(".find-light-icon") !== null || document.querySelector("#hgejgNaM") !== null) { 19 20 //搜索引擎网址目录,%sv%为替换符 21 var dirall = { 22 "id_opt_00": { 23 0: "爱搜资源", 24 1: "https://www.aisouziyuan.com/?name=%sv%", 25 }, 26 "id_opt_01": { 27 0: "云盘精灵", 28 1: "https://www.yunpanjingling.com/search/%sv%", 29 }, 30 "id_opt_02": { 31 0: "云盘恶魔a", 32 1: "https://yunpanem.com/search/a/%sv%/1.html", 33 }, 34 "id_opt_03": { 35 0: "云盘恶魔c", 36 1: "https://yunpanem.com/search/c/%sv%/1.html", 37 }, 38 "id_opt_04": { 39 0: "云盘恶魔f", 40 1: "https://yunpanem.com/search/f/%sv%/1.html", 41 }, 42 "id_opt_05": { 43 0: "磁力猫", 44 1: "https://www.cilimao.me/search?word=%sv%", 45 }, 46 "id_opt_06": { 47 0: "小不点搜索", 48 1: "https://www.xiaobd.net/m/search?wd=%sv%", 49 }, 50 "id_opt_07": { 51 0: "胖次搜索", 52 1: "https://www.panc.cc/s/%sv%/td_0", 53 }, 54 "id_opt_08": { 55 0: "去转盘", 56 1: "http://www.quzhuanpan.com/source/search.action?q=%sv%", 57 }, 58 "id_opt_09": { 59 0: "天天云搜", 60 1: "https://www.ttyunsou.com/s?keyword=%sv%", 61 }, 62 "id_opt_10": { 63 0: "猪猪盘1", 64 1: "http://www.zhuzhupan.com/search?s=1&query=%sv%", 65 }, 66 "id_opt_11": { 67 0: "猪猪盘2", 68 1: "http://www.zhuzhupan.com/search?s=2&query=%sv%", 69 }, 70 "id_opt_12": { 71 0: "猪猪盘3", 72 1: "http://www.zhuzhupan.com/search?s=3&query=%sv%", 73 }, 74 "id_opt_13": { 75 0: "猪猪盘4", 76 1: "http://www.zhuzhupan.com/search?s=4&query=%sv%", 77 }, 78 "id_opt_14": { 79 0: "猪猪盘5", 80 1: "http://www.zhuzhupan.com/search?s=5&query=%sv%", 81 }, 82 "id_opt_15": { 83 0: "猪猪盘6", 84 1: "http://www.zhuzhupan.com/search?s=6&query=%sv%", 85 }, 86 "id_opt_16": { 87 0: "猪猪盘7", 88 1: "http://www.zhuzhupan.com/search?s=7&query=%sv%", 89 }, 90 "id_opt_17": { 91 0: "猪猪盘8", 92 1: "http://www.zhuzhupan.com/search?s=8&query=%sv%", 93 }, 94 "id_opt_18": { 95 0: "猪猪盘总线", 96 1: "http://www.zhuzhupan.com/search?s=100&query=%sv%", 97 }, 98 "id_opt_19": { 99 0: "云搜全量", 100 1: "http://www.daysou.com/s?q=%sv%&start=0&isget=1&tp=all&cl=0&line=4", 101 }, 102 "id_opt_20": { 103 0: "云搜加密", 104 1: "http://www.daysou.com/s?q=%sv%&start=0&isget=1&tp=all&cl=0&line=3", 105 }, 106 "id_opt_21": { 107 0: "云搜引擎1", 108 1: "http://www.daysou.com/s?q=%sv%&start=0&isget=1&tp=all&cl=0&line=0", 109 }, 110 "id_opt_22": { 111 0: "云搜引擎3", 112 1: "http://www.daysou.com/s?q=%sv%&start=0&isget=1&tp=all&cl=0&line=2", 113 }, 114 "id_opt_23": { 115 0: "云搜引擎2", 116 1: "http://www.daysou.com/s?q=%sv%&start=0&isget=1&tp=all&cl=0&line=1", 117 }, 118 "id_opt_24": { 119 0: "网盘007", 120 1: "https://wangpan007.com/share/kw%sv%", 121 }, 122 "id_opt_25": { 123 0: "鸵鸟搜索", 124 1: "http://www.tuoniao.me/search/%sv%/list", 125 }, 126 "id_opt_26": { 127 0: "盘找找", 128 1: "http://www.13910.com/s/?kw=%sv%", 129 }, 130 "id_opt_27": { 131 0: "搜云盘", 132 1: "http://www.soyunpan.com/search/%sv%-0-全部-0.html", 133 }, 134 "id_opt_28": { 135 0: "verypan", 136 1: "http://www.verypan.com/index/index/baidusearch?keyword=%sv%", 137 }, 138 "id_opt_29": { 139 0: "西林街搜索", 140 1: "http://www.xilinjie.com/s?q=%sv%&t=pan", 141 }, 142 "id_opt_30": { 143 0: "小白盘", 144 1: "http://www.xiaobaipan.com/list-%svh%", 145 }, 146 "id_opt_31": { 147 0: "盘多多", 148 1: "http://www.panduoduo.net/s/name/%sv%", 149 }, 150 "id_opt_32": { 151 0: "图书盘", 152 1: "http://www.tushupan.com/search?query=%sv%", 153 }, 154 "id_opt_33": { 155 0: "史莱姆搜索", 156 1: "http://www.slimego.cn/search.html?q=%sv%", 157 }, 158 "id_opt_34": { 159 0: "云铺子", 160 1: "http://www.yunpuzi.net/all/s-%sv%.html", 161 }, 162 "id_opt_35": { 163 0: "sola资源站", 164 1: "http://www.3134.cc/search.php?kw=%sv%", 165 }, 166 "id_opt_36": { 167 0: "盘115", 168 1: "http://www.guanggua.com/search?key=%sv%", 169 }, 170 "id_opt_37": { 171 0: "58网盘", 172 1: "http://www.58wangpan.com/search/kw%sv%", 173 }, 174 "id_opt_38": { 175 0: "56网盘", 176 1: "http://www.56wangpan.com/search/kw%sv%", 177 }, 178 "id_opt_39": { 179 0: "58网盘2", 180 1: "http://wx01.51caichang.com/so?keyword=%sv%", 181 }, 182 "id_opt_40": { 183 0: "我的盘", 184 1: "http://www.wodepan.com/list/%sv%-1.html", 185 }, 186 "id_opt_41": { 187 0: "及搜盘", 188 1: "http://www.jisoupan.com/search/%sv%.html", 189 }, 190 "id_opt_42": { 191 0: "哎呦喂啊", 192 1: "http://www.aiyoweia.com/search/%sv%", 193 }, 194 "id_opt_43": { 195 0: "爱挖盘", 196 1: "http://www.iwapan.com/so.aspx?wd=%sv%", 197 }, 198 "id_opt_44": { 199 0: "盘搜", 200 1: "http://www.pansou.com/?q=%sv%", 201 }, 202 "id_opt_45": { 203 0: "云搜一下", 204 1: "http://sou.wolfbe.com/s?q=%sv%", 205 }, 206 "id_opt_46": { 207 0: "麦库搜索", 208 1: "http://www.huisou.me/index.php?k=%sv%", 209 }, 210 "id_opt_47": { 211 0: "探索云盘", 212 1: "http://tansuo233.com/?search=%sv%", 213 }, 214 "id_opt_48": { 215 0: "坑搜网", 216 1: "http://www.kengso.com/s?wd=%sv%", 217 }, 218 "id_opt_49": { 219 0: "喵搜", 220 1: "https://nyaso.com/dong/%sv%.html", 221 }, 222 "id_opt_50": { 223 0: "西边云", 224 1: "http://www.xibianyun.com/wp/search?q=%sv%", 225 }, 226 "id_opt_51": { 227 0: "网盘搜索BT", 228 1: "http://www.sosobta.cn/search/%sv%", 229 }, 230 "id_opt_52": { 231 0: "百度盘资源", 232 1: "http://www.friok.com/?s=%sv%", 233 }, 234 "id_opt_53": { 235 0: "325搜", 236 1: "http://pan.here325.com/s?q=%sv%", 237 }, 238 "id_opt_54": { 239 0: "6miu", 240 1: "http://baiduyun.6miu.com/word.html?kw=%sv%", 241 }, 242 "id_opt_55": { 243 0: "90网盘", 244 1: "https://pan.90xz.com/search/%sv%", 245 }, 246 "id_opt_56": { 247 0: "fastsoso", 248 1: "https://www.fastsoso.cn/search?k=%sv%", 249 }, 250 "id_opt_57": { 251 0: "v搜索", 252 1: "http://www.v1248.com/index.htm?kw=%sv%", 253 }, 254 "id_opt_58": { 255 0: "搜盘", 256 1: "http://www.soupan.info/search.php?q=%sv%", 257 }, 258 "id_opt_59": { 259 0: "特多盘", 260 1: "http://so.hzbslp.com/api.php?pn=1&sr=%sv%", 261 }, 262 "id_opt_60": { 263 0: "网盘资源网", 264 1: "http://www.0933.me/search.html?wd=%sv%", 265 }, 266 "id_opt_61": { 267 0: "百度网盘搜", 268 1: "https://www.xalssy.com.cn/search/kw%sv%", 269 }, 270 "id_opt_62": { 271 0: "特百度", 272 1: "http://www.tebaidu.com/search.asp?wd=%sv%", 273 }, 274 "id_opt_63": { 275 0: "搜搜云盘", 276 1: "http://www.sosoyunpan.com/search.asp?wd=%sv%", 277 }, 278 "id_opt_64": { 279 0: "云网盘之家", 280 1: "http://www.wowenda.com/search?wd=%sv%", 281 }, 282 "id_opt_65": { 283 0: "盘优搜", 284 1: "http://www.panuso.com/s/%sv%.html", 285 }, 286 "id_opt_66": { 287 0: "麦库搜索", 288 1: "http://huisou.me/index.php?k=%sv%", 289 }, 290 "id_opt_67": { 291 0: "网盘传奇", 292 1: "https://www.jidanso.com/index.php/search/?q=%sv%", 293 }, 294 "id_opt_68": { 295 0: "SoV5", 296 1: "https://www.sov5.cn/search?q=%sv%", 297 }, 298 "id_opt_69": { 299 0: "下载搜", 300 1: "https://www.xiazaisou.com/wangpan?s=%sv%", 301 }, 302 "id_opt_70": { 303 0: "优质吧", 304 1: "http://uzi8.cn/search/kw%sv%", 305 }, 306 "id_opt_71": { 307 0: "网盘之家", 308 1: "http://www.wangpanzhijia.net/search.html?wd=%sv%", 309 }, 310 "id_opt_72": { 311 0: "众人搜网盘", 312 1: "http://wangpan.renrensousuo.com/jieguo?sa=网盘搜索&q=%sv%", 313 }, 314 "id_opt_73": { 315 0: "乐依分享", 316 1: "https://www.dyroy.com/html/search.html?q=%sv%", 317 }, 318 319 }; 320 321 //找到父亲节点 322 var father = document.getElementsByClassName("vyQHNyb")[0]; 323 var father2 = document.getElementsByClassName("pickpw")[0]; 324 325 //新建span子节点 326 var new_span = document.createElement('span'); 327 new_span.setAttribute("id", "id_new_span"); 328 if(father) { 329 father.appendChild(new_span); 330 } else if(father2) { 331 father2.appendChild(new_span); 332 } 333 334 //span节点再建【选择框】子节点 335 var new_select = document.createElement('select'); 336 new_span.appendChild(new_select); 337 if(father) { 338 new_select.style.cssText = "font-size: 15px;height: 30px;color: black;"; 339 } else if(father2) { 340 new_select.style.cssText = "font-size: 15px;height: 30px;color: black;display:inline-block;margin:5px 0 0 0;"; 341 } 342 343 //选择框子节点下面要建立大量【选项】子节点 344 for(var i in dirall) { 345 var v = dirall[i][0]; 346 new_option(v, i, new_select); 347 } 348 349 //span节点再建【输入框】子节点 350 var new_input = document.createElement('input'); 351 new_input.setAttribute("id", "scont"); 352 new_input.setAttribute("class", "scont"); 353 new_input.setAttribute("placeholder", "请输入要搜索的内容"); 354 new_span.appendChild(new_input); 355 if(father) { 356 new_input.style.cssText = "font-size:15px;width:180px;height: 22px;color:black;padding:2px;"; 357 new_input.focus(); 358 } else if(father2) { 359 new_input.style.cssText = "font-size:15px;width:231px;height: 22px;color:black;padding:2px;"; 360 } 361 362 //span节点再建【按钮】子节点 363 var new_btn = document.createElement('button'); 364 new_btn.innerHTML = "搜索"; 365 new_span.appendChild(new_btn); 366 new_btn.style.cssText = "font-size: 14px;width: 52px;height: 29px;color: black;"; 367 368 //按钮点击事件 369 new_btn.onclick = function() { 370 //获得输入框数据 371 var new_input_val = new_input.value; 372 //计算输入框数据长度 373 var new_input_val_len = new_input_val.length; 374 //如果输入框有数据 375 if(new_input_val_len > 0) { 376 //获得选择框里被选中的选项索引 377 var option_index = new_select.selectedIndex; 378 //根据索引获得获得选择框里被选中的选项id 379 var option_select_id = new_select.options[option_index].id; 380 //根据id和网址目录获得网址 381 var pcsearch = dirall[option_select_id][1]; 382 //用输入框的数据替换掉网址内的替换符 383 var dti = pcsearch.replace("%sv%", new_input_val); 384 //网址跳转 385 window.open(dti); 386 } else { 387 alert("请在前面的输入框输入要搜索的内容。"); 388 new_input.focus(); 389 } 390 } 391 392 //清除广告,腾位置 393 var zzy = father.childNodes[2]; 394 zzy.style.cssText = "display: none!important;"; 395 } else { 396 console.log("失败一次"); 397 //显示点不存在,50毫秒后再次执行 398 setTimeout(function() { 399 bseg(); 400 }, 50); 401 } 402 403 //新建option 404 function new_option(ih, aid, ns) { 405 var new_opt = document.createElement('option'); 406 new_opt.innerHTML = ih; 407 new_opt.setAttribute("id", aid); 408 ns.appendChild(new_opt); 409 } 410 }