百度网盘分享

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

目前為 2015-09-03 提交的版本,檢視 最新版本

  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 03/09/2015
  12. // @include http://pan.baidu.com/disk/*
  13. // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
  14. // @grant unsafeWindow
  15. // @grant GM_setClipboard
  16. // @run-at document-end
  17. // @version 1.4.1
  18. // ==/UserScript==
  19.  
  20. var baidushares = function(){
  21. this.pass = localStorage.getItem('qs_psss') || "8888"; //密码
  22. this.timeout = 10000; //间隔时间 (毫秒)
  23. this.linktype = localStorage.getItem('qs_linktype') || "link"; //输出链接格式: ubb = ubb代码 | link = 链接 | html = html代码
  24. this.index = 0;
  25. this.arrId = [];
  26. this.arrName = [];
  27. this.setTime = null;
  28. this.stbtn = '<a node-type="btn-quicksharest" data-key="quicksharest" class="icon-btn-download" style="display: inline-block;"><span class="ico"></span><span class="btn-val">分享设置</span></a>';
  29. 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>';
  30. };
  31. baidushares.prototype = {
  32. init: function(){
  33. var that = this;
  34. $(".module-list-toolbar").find('[data-key="download"]').after(that.btn);
  35. $(".module-toolbar").find('[node-type="btn-offline-download"]').after(that.stbtn);
  36. $(".module-toolbar").find('[data-key="quicksharest"]').on("click", function(){
  37. that.setting();
  38. });
  39. $(".module-list-toolbar").find('[data-key="quickshare"]').on("click", function(){
  40. that.arrId = [];
  41. that.arrName = [];
  42. that.index = 0;
  43. var dom = $(".module-list-view").css("display") == "none" ? $(".module-grid-view") : $(".module-list-view");
  44. dom.find('[node-type="list"]').children(".item-active").each(function(){
  45. dataid = $(this).data("id");
  46. dataname = $(this).find('[node-type="name"]').attr("title");
  47. that.arrId.push(dataid);
  48. that.arrName.push(dataname);
  49. });
  50. that.dialog();
  51. that.post();
  52. });
  53. $("body").on("click", '#qs_setting', function(){
  54. var qs_pass = $("#qs_pass").val(),
  55. qs_linktype = $("#qs_linktype").val();
  56. var reg = /^([a-zA-Z0-9]{4,4})$/;
  57. if(!reg.test(qs_pass)){
  58. $("#qs_pass").val(that.pass);
  59. alert("请输入正确的密码。");
  60. return;
  61. } else {
  62. localStorage.setItem("qs_psss", qs_pass);
  63. localStorage.setItem("qs_linktype", qs_linktype);
  64. that.pass = qs_pass;
  65. that.linktype = qs_linktype;
  66. $(this).parents(".b-dialog").remove();
  67. }
  68. });
  69. },
  70. post: function(){
  71. var that = this,
  72. index = this.index;
  73. if (index >= this.arrId.length) {
  74. return false;
  75. }
  76. var id = this.arrId[index],
  77. name = this.arrName[index],
  78. text = "",
  79. request = $.ajax({
  80. url: "/share/set?channel=chunlei&clienttype=0&web=1&bdstoken=" + yunData.MYBDSTOKEN + "&app_id=25052",
  81. method: "POST",
  82. data: {
  83. fid_list : "["+id+"]",
  84. schannel: 4,
  85. channel_list: "[]",
  86. pwd: that.pass
  87. },
  88. dataType: "json"
  89. });
  90.  
  91. request.done(function(json) {
  92. if (json.errno == 0) {
  93. if (that.linktype == "ubb") {
  94. text = "[url="+json.shorturl+"]百度网盘下载: "+name+"[/url] 提取密码:"+that.pass;
  95. } else if (that.linktype == "html") {
  96. text = "<a href='"+json.shorturl+"'>百度网盘下载: "+name+"</a> 提取密码:"+that.pass;
  97. } else {
  98. text = json.shorturl +" 提取密码:"+that.pass;
  99. }
  100. } else {
  101. text = name+" 分享失败, 错误代码: "+json.errno;
  102. }
  103. var old = $("#shareresult").val();
  104. if (old=="") {
  105. old = text;
  106. } else {
  107. old = old+"\r\n"+text;
  108. }
  109. $("#shareresult").val(old);
  110. that.count();
  111. that.index++;
  112. that.setTime = setTimeout(function(){
  113. that.post();
  114. }, that.timeout);
  115. });
  116. },
  117. count: function(){
  118. var ok = parseInt($("#ok").text()) + 1;
  119. var all = parseInt($("#all").text());
  120. var no = all - ok;
  121. $("#ok").text(ok);
  122. $("#no").text(no);
  123. },
  124. dialog: function() {
  125. var that = this,
  126. html = "",
  127. w = 576,
  128. h = 514,
  129. ww = $(window).width(),
  130. hh = $(window).height();
  131. var l = (ww - w) / 2,
  132. t = (hh - h) / 2,
  133. length = this.arrId.length;
  134. 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;">';
  135. html+=' <div class="dlg-hd b-rlv"><span class="dlg-cnr dlg-cnr-l"></span>';
  136. html+=' <a href="javascript:void(0);" title="关闭" id="closeQuickShareDailog" class="dlg-cnr dlg-cnr-r"></a>';
  137. html+=' <h3><em></em>分享结果</h3>';
  138. html+=' </div>';
  139. html+=' <div class="dlg-bd global-clearfix __dlgBd" style="visibility: visible;">';
  140. html+=' <div class="add-yun-device-list">';
  141. html+=' <p style="margin-bottom: 10px;">共 <b id="all">'+length+'</b> 条, 已完成 <b id="ok">0</b> 条, 剩余 <b id="no">'+length+'</b> 条</p>';
  142. html+=' <textarea style="width:100%; height:400px;" id="shareresult"></textarea>';
  143. html+=' </div>';
  144. html+=' </div>';
  145. html+='</div>';
  146. $("body").append(html).find("#closeQuickShareDailog").click(function(){
  147. window.clearTimeout(that.setTime);
  148. $(this).parents(".b-dialog").remove();
  149. });
  150. },
  151. setting: function() {
  152. var that = this,
  153. html = "",
  154. w = 576,
  155. h = 218,
  156. ww = $(window).width(),
  157. hh = $(window).height();
  158. var l = (ww - w) / 2,
  159. t = (hh - h) / 2,
  160. length = this.arrId.length;
  161. 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;">';
  162. html+=' <div class="dlg-hd b-rlv"><span class="dlg-cnr dlg-cnr-l"></span>';
  163. html+=' <a href="javascript:void(0);" title="关闭" id="closeQuickShareSettingDailog" class="dlg-cnr dlg-cnr-r"></a>';
  164. html+=' <h3><em></em>设置</h3>';
  165. html+=' </div>';
  166. html+=' <div class="dlg-bd global-clearfix __dlgBd" style="visibility: visible;">';
  167. html+=' <div class="add-yun-device-list">';
  168. html+=' <table border="0" cellpadding="5" cellspacing="0">';
  169. html+=' <tr><td style="padding:10px;">链接类型: </td><td style="padding:10px;"><select id="qs_linktype"><option value="ubb">ubb代码</option><option value="html">html代码</option><option value="link">链接</option></select></td></tr>';
  170. html+=' <tr><td style="padding:10px;">分享密码: </td><td style="padding:10px;"><input id="qs_pass" class="input-text" type="text" maxlength="4" pattern="/([a-zA-Z0-9]{4,4})/" value="'+ that.pass +'" required /></td></tr>';
  171. html+=' <tr><td style="padding:10px;">&nbsp;</td><td style="padding:10px;"><a id="qs_setting" class="sbtn create-public"><b>设置</b></a></td></tr>';
  172. html+=' </table>';
  173. html+=' </div>';
  174. html+=' </div>';
  175. html+='</div>';
  176. $("body").append(html).find("#closeQuickShareSettingDailog").click(function(){
  177. $(this).parents(".b-dialog").remove();
  178. });
  179. $("#qs_linktype").val(that.linktype);
  180. }
  181. };
  182. var bs = new baidushares();
  183. bs.init();

QingJ © 2025

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