百度网盘分享

百度网盘批量分享, 每个勾勾都生成一个分享链接, 可以自定义访问密码

目前為 2015-08-13 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 百度网盘分享
  3. // @author 林岑影
  4. // @website http://www.cyxiaowu.com
  5. // @description 百度网盘批量分享, 每个勾勾都生成一个分享链接, 可以自定义访问密码
  6. // @namespace
  7. // @icon http://disk.yun.uc.cn/favicon.ico
  8. // @license GPL version 3
  9. // @encoding utf-8
  10. // @date 13/08/2015
  11. // @modified 13/08/2015
  12. // @include http://pan.baidu.com/disk/*
  13. // @require http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
  14. // @grant unsafeWindow
  15. // @grant GM_setClipboard
  16. // @run-at document-end
  17. // @version 1.1.0
  18. // ==/UserScript==
  19.  
  20. var baidushares = function(){
  21. this.pass = "8888"; //密码
  22. this.timeout = 10000; //间隔时间 (毫秒)
  23. this.linktype = "ubb"; //输出链接格式: ubb = ubb代码 | link = 链接 | html = html代码
  24. this.index = 0;
  25. this.arrId = [];
  26. this.arrName = [];
  27. this.setTime = null;
  28. this.btn = '<a node-type="btn-quickshare" data-key="quickshare" class="btn share-btn" style="display: inline-block;"><span class="ico"></span><span class="btn-val">快速分享</span></a>';
  29. };
  30. baidushares.prototype = {
  31. init: function(){
  32. var that = this;
  33. $('[data-key="download"]').after(that.btn);
  34. $('[data-key="quickshare"]').on("click", function(){
  35. that.arrId = [];
  36. that.arrName = [];
  37. that.index = 0;
  38. $(".list").children(".item-active").each(function(){
  39. dataid = $(this).data("id");
  40. dataname = $(this).find(".name").attr("title");
  41. that.arrId.push(dataid);
  42. that.arrName.push(dataname);
  43. });
  44. that.dialog();
  45. that.post();
  46. });
  47. },
  48. post: function(){
  49. var that = this,
  50. index = this.index;
  51. if (index >= this.arrId.length) {
  52. return false;
  53. }
  54. var id = this.arrId[index],
  55. name = this.arrName[index],
  56. text = "",
  57. request = $.ajax({
  58. url: "/share/set?channel=chunlei&clienttype=0&web=1&bdstoken=" + yunData.MYBDSTOKEN + "&app_id=25052",
  59. method: "POST",
  60. data: {
  61. fid_list : "["+id+"]",
  62. schannel: 4,
  63. channel_list: "[]",
  64. pwd: that.pass
  65. },
  66. dataType: "json"
  67. });
  68.  
  69. request.done(function(json) {
  70. if (json.errno == 0) {
  71. if (that.linktype == "ubb") {
  72. text = "[url="+json.shorturl+"]"+name+"[/url] 提取密码:"+that.pass;
  73. } else if (that.linktype == "html") {
  74. text = "<a href='"+json.shorturl+"'>"+name+"</a> 提取密码:"+that.pass;
  75. } else {
  76. text = json.shorturl +" 提取密码:"+that.pass;
  77. }
  78. } else {
  79. text = name+" 分享失败, 错误代码: "+json.errno;
  80. }
  81. var old = $("#shareresult").val();
  82. if (old=="") {
  83. old = text;
  84. } else {
  85. old = old+"\r\n"+text;
  86. }
  87. $("#shareresult").val(old);
  88. that.count();
  89. that.index++;
  90. that.setTime = setTimeout(function(){
  91. that.post();
  92. }, that.timeout);
  93. });
  94. },
  95. count: function(){
  96. var ok = parseInt($("#ok").text()) + 1;
  97. var all = parseInt($("#all").text());
  98. var no = all - ok;
  99. $("#ok").text(ok);
  100. $("#no").text(no);
  101. },
  102. dialog: function() {
  103. var that = this,
  104. html = "",
  105. w = 576,
  106. h = 514,
  107. ww = $(window).width(),
  108. hh = $(window).height();
  109. var l = (ww - w) / 2,
  110. t = (hh - h) / 2,
  111. length = this.arrId.length;
  112. html+='<div class="b-panel b-dialog box-shadow4 bdr-rnd-3 add-yun-device-dialog common-dialog" style="display: block; left: '+l+'px; top: '+t+'px;">';
  113. html+=' <div class="dlg-hd b-rlv"><span class="dlg-cnr dlg-cnr-l"></span>';
  114. html+=' <a href="javascript:void(0);" title="关闭" id="closeQuickShareDailog" class="dlg-cnr dlg-cnr-r"></a>';
  115. html+=' <h3><em></em>分享结果</h3>';
  116. html+=' </div>';
  117. html+=' <div class="dlg-bd global-clearfix __dlgBd" style="visibility: visible;">';
  118. html+=' <div class="add-yun-device-list">';
  119. html+=' <p style="margin-bottom: 10px;">共 <b id="all">'+length+'</b> 条, 已完成 <b id="ok">0</b> 条, 剩余 <b id="no">'+length+'</b> 条</p>';
  120. html+=' <textarea style="width:100%; height:400px;" id="shareresult"></textarea>';
  121. html+=' </div>';
  122. html+=' </div>';
  123. html+='</div>';
  124. $("body").append(html).find("#closeQuickShareDailog").click(function(){
  125. window.clearTimeout(that.setTime);
  126. $(this).parents(".b-dialog").remove();
  127. });
  128. }
  129. };
  130. var bs = new baidushares();
  131. bs.init();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址