【已经不能用了】发个html+javascript做的工具:狗狗 版权方声明保护内容 链接地址分析器

上图先

【已经不能用了】发个html+javascript做的工具:狗狗 版权方声明保护内容 链接地址分析器_第1张图片
页面工具代码:
<!DOCTYPE html>
<html lang="zh_CN">
    <head>
		<TITLE>狗狗 版权方声明保护内容 链接地址分析器</TITLE>		
        <meta http-equiv="Content-Type" content="text/html;charset=GBK">
		<META NAME="Generator" CONTENT="EditPlus">
		<META NAME="Author" CONTENT="陈小稳(Shone)">
		<META NAME="Keywords" CONTENT="">
		<META NAME="Description" CONTENT="">
		<script src="http://hi.csdn.net/js/jquery-1.4.2.min.js"
			type="text/javascript"></script>
		<script type="text/javascript">
	function doit() {
		var url = document.getElementById("gougouPageUrl").value;
		$.get(url, function(data) {
			var beginstr = "var g_downUrlList=[\"";
			var endstr = "\"]";
			var begin = data.indexOf(beginstr);
			var end = data.indexOf(endstr, begin);
			var encodeDownloadUrl = data.substring(begin + beginstr.length, end);
			document.getElementById("encodeDownloadUrl").value = encodeDownloadUrl;
			var plainDownloadUrl = decode(encodeDownloadUrl);
			document.getElementById("plainDownloadUrl").value = plainDownloadUrl;
			copyToClipboard(plainDownloadUrl);
		});
	}
		
	/**
	 * Url编码
	 **/
	function encode(inputStr) {
		var resultArr = [];
		var chars = "!\"#$%&'()*+,/:;<=>?[]^`{|}~%";
		for ( var i = 0; i < inputStr.length; i++) {
			var tmpChar = inputStr.charAt(i);
			var c = inputStr.charCodeAt(i);
			if (c > 0x7E) {
				resultArr[i] = encodeURI(tmpChar);
			} else {
				if (tmpChar == " ")
					resultArr[i] = "+";
				else if (chars.indexOf(tmpChar) != -1)
					resultArr[i] = "%" + c.toString(16);
				else
					resultArr[i] = tmpChar;
			}
		}
		return resultArr.join("");
	}

	/**
	 * Url解码
	 **/
	function decode(inputStr) {
		var resultArr = [];
		for ( var i = 0; i < inputStr.length; i++) {
			var chr = inputStr.charAt(i);
			if (chr == "+") {
				resultArr[resultArr.length] = " ";
			} else if (chr == "%") {
				var asc = inputStr.substring(i + 1, i + 3);
				if (parseInt("0x" + asc) > 0x7f) {
					resultArr[resultArr.length] = decodeURI(inputStr.substring(
							i, i + 9));
					i += 8;
				} else {
					resultArr[resultArr.length] = String
							.fromCharCode(parseInt("0x" + asc));
					i += 2;
				}
			} else {
				resultArr[resultArr.length] = chr;
			}
		}
		return resultArr.join("");
	}

	function copyToClipboard(txt) {
		if (window.clipboardData) {
			window.clipboardData.clearData();
			window.clipboardData.setData("Text", txt);
		} else if (navigator.userAgent.indexOf("Opera") != -1) {
			window.location = txt;
		} else if (window.netscape) {
			try {
				netscape.security.PrivilegeManager
						.enablePrivilege("UniversalXPConnect");
			} catch (e) {
				alert("您的firefox安全限制限制您进行剪贴板操作,请打开’about:config’将signed.applets.codebase_principal_support’设置为true’之后重试");
				return false;
			}
			var clip = Components.classes['@mozilla.org/widget/clipboard;1']
					.createInstance(Components.interfaces.nsIClipboard);
			if (!clip)
				return;
			var trans = Components.classes['@mozilla.org/widget/transferable;1']
					.createInstance(Components.interfaces.nsITransferable);
			if (!trans)
				return;
			trans.addDataFlavor('text/unicode');
			var str = new Object();
			var len = new Object();
			var str = Components.classes["@mozilla.org/supports-string;1"]
					.createInstance(Components.interfaces.nsISupportsString);
			var copytext = txt;
			str.data = copytext;
			trans.setTransferData("text/unicode", str, copytext.length * 2);
			var clipid = Components.interfaces.nsIClipboard;
			if (!clip)
				return false;
			clip.setData(trans, null, clipid.kGlobalClipboard);
		}
	}
</script>
	</HEAD>

	<BODY>
		<pre>
使用方法:
0.首先打开迅雷下载软件,不要修改迅雷监视粘贴板的设置
1.复制狗狗已屏蔽下载的页面的url到第一个输入框
2.点此页仅有的一个按钮,稍候数秒,分析结果显示在最下面2文本框中
</pre>
		<br>
		<br>
		有提示“来源:该资源为版权方声明保护内容,狗狗已屏蔽其下载。”的页面的URL(gougouPageUrl):
		<br>
		<textarea id=gougouPageUrl rows=2 cols=80></textarea>
		<br>
		如:
		<input type=text size=78
			value="http://down.gougou.com/down?cid=589EF9DE82F465A07F3F555E175741067D1D20B3">
		<br>
		<input type=button value=分析迅雷资源下载地址 onclick="doit()"
			style="display: nonex;">
		<br>
		<br>
		<br>
		url编码(encodeDownloadUrl):
		<br>
		<textarea id=encodeDownloadUrl rows=2 cols=80></textarea>

		<br>
		解码后链接(plainDownloadUrl):
		<br>
		<textarea id=plainDownloadUrl rows=5 cols=80></textarea>
	</BODY>
</HTML>


你可能感兴趣的:(JavaScript,html,c,Opera,firefox)