115 Download Helper

115 Download Helper

当前为 2015-01-29 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name				115 Download Helper
// @authuer			ted423
// @description	115 Download	Helper
// @include			http://115.com/?ct=pickcode*
// @include			http://115.com/?ct=file*
// @version			2015.01.29.1
// @grant				GM_xmlhttpRequest
// @run-at			document-end
// @namespace https://greasyfork.org/users/85
// ==/UserScript==
if(self.document.URL.indexOf('http://115.com/?ct=')!=-1){
	var	callback = function(records){
		records.map(function(record){
			if(record.addedNodes[0]){
				if(record.addedNodes[0].baseURI.indexOf('http://115.com/?ct=pickcode')!=-1){
					self.document.getElementsByTagName('a')[1].removeAttribute('target');
					self.document.getElementsByTagName('a')[1].click();
			}
				if(record.target.id=='js_operate_box'){
					
				var selected = document.querySelectorAll('li.selected');
				[].forEach.call(selected,function(oneSelected){
					URL="http://web.api.115.com/files/download?pickcode="+oneSelected.getAttribute('pick_code');
					console.log(URL);
					getDownloadUrl(URL);
					})
			}
			}
		})
	}

	var	option = {
		'childList': true,
		'subtree': true,
	};
	function getDownloadUrl(URL){
		console.log(URL);
	GM_xmlhttpRequest({
		method:'GET',
		url:URL,
		header:{
		"Referer":'http://web.api.115.com/bridge_2.0.html?namespace=Core.DataAccess&api=UDataAPI&_t=v5',
		"Range": "bytes=0-1",
		},
		onload:function(response){
		console.log(response.responseText);
		geturl=JSON.parse(response.responseText).file_url;
		console.log(geturl);
		},
		});
	}

	if(self.document.URL.indexOf('http://115.com/?ct=pickcode')!=-1)
	{
		var	click	=	new	MutationObserver(callback);

		click.observe(document,	option);
	}
	else{
		var	Firstload	=	new	MutationObserver(callback);
		Firstload.observe(document,	option);
		//console.log(self.document.URL);
	}
}