Skip to content

Instantly share code, notes, and snippets.

@acgotaku acgotaku/baidupan
Last active Feb 10, 2019

Embed
What would you like to do?
新版百度云盘aria2c导出下载 ,目前只实现了核心功能.
// ==UserScript==
// @name 百度网盘aria2导出工具
// @author acgotaku311
// @description 一个方便吧百度网盘的Aria2rpc导出的脚本。
// @encoding utf-8
// @include http://*n.baidu.com/s/*
// @include http://*n.baidu.com/disk/home*
// @include http://*n.baidu.com/share/link*
// @include https://*n.baidu.com/s/*
// @include https://*n.baidu.com/disk/home*
// @include https://*n.baidu.com/share/link*
// @run-at document-end
// @version 0.0.1
// ==/UserScript==
var version = "0.0.1";
var thedate_update = "2014/07/01";
var baidupan = (function() {
var SetMessage = function(msg, type) {
var Toast = require("common:widget/toast/toast.js");
Toast.obtain.useToast({
toastMode: Toast.obtain[type],
msg: msg,
sticky: false
});
}
var combination = {
header: function() {
var addheader = [];
var UA="netdisk;4.4.0.6;PC;PC-Windows;6.2.9200;WindowsBaiduYunGuanJia";
var cookies = "BDUSS=WlGQTBqenNHMnU4cmQzcFd0T3hjOTlXQ2tYRUNLYkszZ2pXSkFESzNUTS1wNFpUQVFBQUFBJCQAAAAAAAAAAAEAAADGtAcR0anUwsfvy64AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4aX1M-Gl9TT";
addheader.push("User-Agent: " + UA);
addheader.push("Cookie: " + cookies);
return addheader;
}
};
var url="http://localhost:6800/jsonrpc"+"?tm="+(new Date().getTime().toString())
return {
init: function() {
var self = this;
var aria2_btn = $("<a>").addClass("icon-btn-download").text("RPC下载");
$(".icon-btn-device").after(aria2_btn);
aria2_btn.click(function() {
self.get_dlink();
});
SetMessage("初始化成功!", "MODE_SUCCESS");
},
get_info: function() {
var File = require("common:widget/data-center/data-center.js");
return File.get("selectedList");
},
get_config: function() {
},
get_dlink: function() {
var self = this;
var Service = require("common:widget/commonService/commonService.js");
Service.getDlink(JSON.stringify(self.get_info()), "dlink", self.aria2_rpc.bind(self));
},
aria2_rpc: function(data) {
var self=this;
var obj = $.parseJSON(data);
var length = obj.dlink.length;
for (var i = 0; i < length; i++) {
var rpc_data = [{
"jsonrpc": "2.0",
"method": "aria2.addUri",
"id": new Date().getTime(),
"params": [[obj.dlink[i].dlink], {
// "out": name,
"header": combination.header()
}
]
}];
self.aria2send_data(rpc_data);
}
},
aria2send_data: function(data) {
$.ajax({'url': url, 'dataType': 'json',type:'POST',data:JSON.stringify(data)})
.done(function(xml, textStatus, jqXHR) {
SetMessage("下载成功!赶紧去看看吧~", "MODE_SUCCESS");
})
.fail(function(jqXHR, textStatus, errorThrown) {
SetMessage("下载失败!是不是没有开启aria2?", "MODE_FAILURE");
});
}
}
})();
baidupan.init();
@fantouch

This comment has been minimized.

Copy link

fantouch commented Mar 4, 2016

如何使用?

@dreampiggy

This comment has been minimized.

Copy link

dreampiggy commented Jun 4, 2016

心疼作者……更心疼国内这些无良厂商对待*nix系统的态度,不给出客户端,网页版不允许下载(呵呵),还找这种不侵犯商业利益的社区开发者的事情,真是有趣

@zelda0079

This comment has been minimized.

Copy link

zelda0079 commented Jun 10, 2016

这是用在tampermonkey???
作者也辛苦了

@songxing10000

This comment has been minimized.

Copy link

songxing10000 commented Oct 27, 2016

期待,使用教程,辛苦了,大侠

@FradSer

This comment has been minimized.

Copy link

FradSer commented Apr 9, 2018

好想不能工作了,我我看看能不能修好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.