🏠 返回首頁 

Greasy Fork is available in English.

配合网盘密码自动提取,融合链接与提取码

自动处理网盘链接及其提取码变成支持自动填充密码的方式的链接(百度云、360pan等)


ติดตั้งสคริปต์นี้?
  1. // ==UserScript==
  2. // @name 配合网盘密码自动提取,融合链接与提取码
  3. // @author jasonshaw,jasake
  4. // @namespace panlink.jasonshaw
  5. // @version 0.6.1.4
  6. // @description 自动处理网盘链接及其提取码变成支持自动填充密码的方式的链接(百度云、360pan等)
  7. // @include *
  8. // @note 支持微云地址【感谢jixun大的更新】
  9. // @note 解决部分网站百度盘提取密码在第二行时出现的问题【感谢卡饭会员“jasake”的修改支持】
  10. // @note 添加支持文本状态的网盘地址【感谢卡饭会员“jasake”的修改支持】
  11. // @note 添加支持云盘https地址
  12. // @note 添加支持微盘地址
  13. // @note 添加支持zd423博客,runningman-fan,wenlei.ys168.com【感谢卡饭会员“jasake”的修改支持】
  14. // @note 修复一个手误bug
  15. // @note 改变程序逻辑以适应一些特殊环境
  16. // @note 修复一个bug,彻底解决重复后缀密码问题
  17. // @note 增加脚本运行判断的设定,默认自动运行,对于类似##微博类网址,才执行判断后执行
  18. // @note 改变程序逻辑对更多的情况进行支持
  19. // @note 增加处理盘密码就在链接的文本本身上
  20. // @note 增加脚本运行判断,解决个别页面动态加载问题,比如##微博
  21. // @note 增加百度贴吧跳转和##微博短网址的支持,两条配置一样存在“误#”,不常用的可以注释掉这两条规则
  22. // @note 优化代码,将任意单条正则变为可选配置,一般由默认正则处理,有利于自定义扩展和维护
  23. // @note 增加支持自动更新
  24. // @note 修正配置,支持单页面多云盘链接
  25. // @note 避免重复后缀密码
  26. // @note 支持百度网盘/贴吧/360云
  27. // @note 支持加密百度网盘https
  28. // @note 支持uAutoPagerize2.uc.js的自动翻页
  29. // @run-at document-end
  30. // @copyright 2014+, jasonshaw
  31. // ==/UserScript==
  32. (function(){
  33. //runningman-fan 免点击显示下载地址
  34. if (/^http:\/\/www\.runningman-fan\.com\/.+\.html/.test(location.href) && document.querySelector('.content-main #down')) document.querySelector('.content-main #down').outerHTML=document.querySelector('#button_box .buttons').outerHTML;
  35. var common_reg = /\s*([百度云盘提取密码码访问码]+|360yun|yun|\d{3,4}[pP])[::]?\s*(<[^>]+>)?\s*([0-9a-zA-Z]{4,})\s*/;
  36. var pw_reg = /#[0-9a-zA-Z]{4,}/;
  37. var standBy = false,standByList = [/http:\/\/weibo\.com\/.*/i];//将需要等待js运行之后再运行本代码的,将href正则写入数组
  38. var prefs = {
  39. tieba:['http://jump.bdimg.com/safecheck'],//这个有大量的误操作,因为这只是##的短网址,而不一定是网盘,自选使用
  40. pan:['http://pan.baidu.com/s/'],//第一个参数定义链接类型,第二个可选参数:后续紧跟着的提取码之类的前缀提示符
  41. yunpan:['http://yunpan.cn/'],
  42. yunpans:['https://yunpan.cn/'],
  43. pans:['https://pan.baidu.com/s/'],
  44. pan2:['http://pan.baidu.com/share/'],
  45. pan2s:['https://pan.baidu.com/share/'],
  46. tpan:['http://t.cn/'],//这个有大量的误操作,因为这只是##的短网址,而不一定是网盘,自选使用
  47. wpan:['http://vdisk.weibo.com/lc/'],
  48. weiyunpan:['http://share.weiyun.com/'],
  49. };
  50. function panlinkWithPw(){
  51. var href = window.location.href,site = null,i = 0;
  52. while (standByList[i]) if(standByList[i++].test(href)) {standBy = true; break;}
  53. var panlinks,r = null,reg,i,nC,nN,pN,pos,subS;
  54. for (var key in prefs) {
  55. reg = prefs[key][1] || common_reg;
  56. //添加支持文本状态的网盘地址
  57. var textPanLink = new RegExp(prefs[key][0].replace(/\./g,'\\.')+'\\w+(?=\\s|[^\\x00-\\xff])','g');
  58. if (textPanLink.test(document.body.innerHTML)) document.body.innerHTML = document.body.innerHTML.replace(textPanLink, '$&'.link('$&'));
  59. panlinks = document.querySelectorAll('a[href^="'+prefs[key][0]+'"]'),i=0;
  60. while(panlinks[i]){
  61. if(pw_reg.test(panlinks[i].href)) {i++;continue;}
  62. nN = panlinks[i].nextSibling;
  63. if(nN!=null) {
  64. if(nN.nodeType===1)nC=nN.innerHTML;
  65. else if(nN.nodeType===3) nC=document.all?nN.innerText:nN.textContent;
  66. r = nC.match(reg);
  67. if(r!=null) panlinks[i].href += '#'+r[3];
  68. }
  69. if(nN==null||r==null) {
  70. //处理盘密码就在链接的文本本身上
  71. r = panlinks[i].innerHTML.match(reg);
  72. if(r!=null) panlinks[i].href += '#'+r[3];
  73. else {
  74. pN = panlinks[i].parentNode.parentNode.textContent;
  75. pos = pN.indexOf(panlinks[i].href);
  76. subS = pN.substr(pN.indexOf(panlinks[i].href)+1);
  77. var pos_end = subS.length,temp;
  78. for (var key1 in prefs) {
  79. temp = pN.indexOf(prefs[key1][0]);
  80. if(temp==-1) continue;
  81. if(temp!=pos&&temp<pos_end) pos_end = temp;
  82. }
  83. subS = subS.substr(0,pos_end-1);
  84. r = subS.match(reg) || panlinks[i].parentNode.textContent.match(reg) || pN.match(reg);
  85. if(r!=null) panlinks[i].href += '#'+r[3];
  86. }
  87. }
  88. i++;
  89. }
  90. }
  91. }
  92. function addMutationObserver(selector, callback) {
  93. var watch = document.querySelector(selector);
  94. if (!watch) return;
  95. var observer = new MutationObserver(function(mutations){
  96. var nodeAdded = mutations.some(function(x){ return x.addedNodes.length > 0; });
  97. if (nodeAdded) {
  98. callback();
  99. }
  100. });
  101. observer.observe(watch, {childList: true, subtree: true });
  102. }
  103. // 添加下一页和不刷新页面的支持
  104. if (location.host.indexOf('.ys168.com') > 0) addMutationObserver('#mainMenu', function(){panlinkWithPw();});
  105. addMutationObserver('#ct', function(){
  106. panlinkWithPw();
  107. });
  108. if(standBy) {document.onreadystatechange = function () { if(document.readyState == "complete") panlinkWithPw(); }}
  109. else panlinkWithPw();
  110. })();