NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name BT天堂快速下载 // @namespace http://tampermonkey.net/ // @version 0.1 // @description bt天堂网站(https://www.bttt.la/)电影快速下载按钮 `` // @author Chaoqun Yang // @match https://www.bttt.la/* // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest // @grant GM_openInTab // @grant GM.openInTab // @run-at document-end // @require https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js // @copyright 2018, xue1007 (https://openuserjs.org/users/xue1007) // @license MIT // ==/UserScript== (function() { 'use strict'; /** 获取url 参数*/ function getQueryString(search,name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = decodeURI(search).substr(1).match(reg); if (r != null) return unescape(r[2]); return null;//unescape 若不适用与中文 可用 decodeURI } /**form post提交窗口 用于post下载*/ function postDownload(data){ var form = $("<form action='https://www.bttt.la/download2.php' method='post' ></form>"); var htmlStr = ""; for(var key in data){ htmlStr += "<input type='hide' name='" + key + "' value='" + data[key] + "'> "; } form.append(htmlStr); $("body").append(form); form.submit(); form.remove(); } function down(id, uhash){ postDownload({ "action":"download", "imageField.x":"104", "imageField.y":"25", "id":id, "uhash":uhash }); } $(function(){ /**遍历电影 查询详情页面 获取下载按钮*/ $(".item.cl .title>.tt>a").each(function(i, item){ var $this = $(this); var href = $this.attr("href"); var id = /(\d{4,6}).html/.exec(href)[0]; $.ajax({ url: href, dataType:'text', success:function(data){ var tinfoArr = data.match(/temp=yes&id=\d{4,6}&uhash=([\d\w]{20,30}).+title="([^"]+).+<em>.+<\/em>/g); var htmlStr = ""; for(var i = 0; i < tinfoArr.length; i ++){ var tinfo = tinfoArr[i].match(/uhash=([\d\w]{20,30}).+title="((【[^】]+】)[^"]+).+<em>(.+)<\/em>/); htmlStr += "<button class='fastDown' _id='"+id+"' _uhash="+tinfo[1]+"') title='"+tinfo[2]+"'>"+tinfo[3]+tinfo[4]+"</button>"; } $this.closest(".title").append(htmlStr); } }); }); $(".tinfo a").click(function(){ down(getQueryString(this.href,"id"),getQueryString(this.href,"uhash")); return false; }); $(document).on("click","button.fastDown", function(){ down(this.getAttribute("_id"),this.getAttribute("_uhash")); }); }); // Your code here... })();