您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
在 movie.douban.com 网站下直接显示下载链接,可通过多个站点获取。
当前为
// ==UserScript== // @id [email protected] // @name 豆瓣电影C+|MyDoubanMovieHelper|豆瓣|豆瓣电影|douban.movie.com // @namespace Chang_way_enjoying // @version 0.6_2016-05-19 // @description 在 movie.douban.com 网站下直接显示下载链接,可通过多个站点获取。 // @author c wt U r // @match https://movie.douban.com/subject/* // @connect mp4ba.com // @connect edmag.net // @connect tl95.com // @connect kat.cr // @require https://cdn.bootcss.com/jquery/2.2.3/jquery.min.js // @require https://cdn.bootcss.com/jBox/0.3.2/jBox.min.js // @grant GM_xmlhttpRequest // @grant GM_setClipboard // ==/UserScript== /** * Created by c wt U r on 2016/5/18. * QQ 3099891314 * * node{detailURL,downloadURL,date,type[0,1,2],title} * type[0 , // mag * 1 , // ed2k * 2 , // thunder * 3 // netdisk * ] * TODO 加入book.douban.com的支持 * TODO baidu网盘的链接有效性检测函数 * TODO baidu网盘加密链接的搜索 * TODO baidu网盘非加密的链接的搜索 * TODO baidu网盘已登录用户一键保持 * */ addCSSfile("https://cdn.bootcss.com/jBox/0.3.2/jBox.min.css"); function addCSSfile(url) { $("<link>").attr({ rel: "stylesheet", type: "text/css", href: url }).appendTo("head") } function getDoc(url, callback, data) { GM_xmlhttpRequest({ method: data ? 'POST' : 'GET', url: url, headers: { 'User-agent': window.navigator.userAgent, 'Content-type': (data) ? 'application/x-www-form-urlencoded' : null }, onload: function(responseDetail) { var doc = ''; if (responseDetail.status == 200) { doc = new DOMParser().parseFromString(responseDetail.responseText, 'text/html'); if (doc === undefined) { doc = document.implementation.createHTMLDocument(""); doc.querySelector('html').innerHTML = responseText } } callback(doc, url) } }) } function timeago(stime) { var publishTime = new Date(stime); var d_minutes, d_hours, d_days; var timeNow = parseInt(new Date().getTime() / 1000); var d; d = timeNow - publishTime; d_days = parseInt(d / 86400); d_hours = parseInt(d / 3600); d_minutes = parseInt(d / 60); if (d_days > 0 && d_days < 4) { return d_days + "天前" } else if (d_days <= 0 && d_hours > 0) { return d_hours + "小时前" } else if (d_hours <= 0 && d_minutes > 0) { return d_minutes + "分钟前" } else { var s = new Date(publishTime * 1000); return (s.getMonth() + 1) + "月" + s.getDate() + "日" } } function msg_info(msg) { new jBox('Notice', { content: msg, position: { x: 15, y: 65 }, zIndex: 12000, onInit: function() { this.options.color = 'blue' }, }) } function msg_warning(msg) { console.log(msg); var color = 'yellow'; new jBox('Notice', { attributes: { x: 'left', y: 'bottom' }, delayClose: 1000 * 30, theme: 'NoticeBorder', color: color, animation: { open: 'slide:bottom', close: 'slide:left' }, onInit: function() { this.options.color = color; this.options.title = "提示"; this.options.content = msg }, }) } function msg_error(msg) { var color = 'red'; new jBox('Notice', { attributes: { x: 'left', y: 'bottom' }, theme: 'NoticeBorder', color: color, animation: { open: 'slide:bottom', close: 'slide:left' }, onInit: function() { this.options.color = color; this.options.title = "错误警告"; this.options.content = msg }, }); console.error(msg) } imdb = $("#info").find("a[href^='http://www.imdb.com/title/tt']").text(); title_cn = $("#content").children()[0].firstElementChild.textContent.split(" ")[0]; title_en = undefined; if (!imdb) { msg_error('imdb is null') } else { if (imdb.startsWith('tt')) { imdb = imdb.slice(2) } } var linksTable = { table: undefined, nodes: [], init: function() { var div, h2 = undefined; div = $("<div>").attr({ id: "dtable" }); h2 = $("<h2>"); h2 = h2.html("下载地址"); div.append(h2); $($("div.related-info")[0]).after(div); var tr, th = undefined; this.table = $("<table>").attr({ id: "dlinks", class: "table table-condensed table-hover table-striped" }); thead = $("<thead>"); tr = $("<tr>"); th = $("<th>").attr({ "data-column-id": "copy", style: "width:33px" }); th = th.html(" "); tr.append(th); th = $("<th>").attr({ "data-column-id": "detail", style: "width:33px" }); th = th.html(" "); tr.append(th); th = $("<th>").attr({ "data-column-id": "date", style: "width:80px" }); th = th.html("日期"); tr.append(th); th = $("<th>").attr({ "data-column-id": "type", style: "width:55px" }); th = th.html("类型"); tr.append(th); th = $("<th>").attr({ "data-column-id": "title" }); th = th.html("名字"); tr.append(th); thead.append(tr); this.table.append(thead); this.table.appendTo($("#dtable")) }, clean: function() { $("#dtable").remove(); this.init() }, _add: function(data) { thead = $($("#dlinks")[0].firstElementChild); types = { 0: "mag", 1: "ed2k", 2: 'thunder', 3: 'netdisk' }; var tr, th = undefined; tr = $("<tr>"); th = $("<th>"); th = th.html('<a href="' + data.detailURL + '" target="_blank" rel="nofollow">详情</a>'); tr.append(th); if (data.type === 3) { th = $("<th>"); th = th.html('<a href="' + data.downloadURL + '" target="_blank" rel="nofollow">打开</a>'); tr.append(th) } else { th = $("<th>"); th = th.html('<a onclick="" class="j" data-src="' + data.downloadURL + '" rel="nofollow">复制</a>'); th.click(function() { url = $(this.firstElementChild).attr("data-src"); GM_setClipboard(url, "{ type: 'text', mimetype: 'text/plain'}"); msg_info("链接已复制") }); tr.append(th) } th = $("<th>"); th = th.html(data.date); tr.append(th); th = $("<th>"); th = th.html(types[data.type]); tr.append(th); th = $("<th>"); th = th.html(data.title); tr.append(th); thead.append(tr) }, print: function() { this.clean(); var mag = []; var ed2k = []; var thunder = []; var netdisk = []; for (i = 0; i < this.nodes.length; i++) { var node = this.nodes[i]; if (node.type === 0) { mag.push(node) } else if (node.type === 1) { ed2k.push(node) } else if (node.type === 2) { thunder.push(node) } else if (node.type === 3) { netdisk.push(node) } else { msg_warning("code:1001 msg:不支持当前链接格式.") } } if (netdisk.length) { for (i = 0; i < 3; i++) { var node = netdisk[i]; if (node) { this._add(node) } } } if (ed2k.length) { for (i = 0; i < 3; i++) { var node = ed2k[i]; if (node) { this._add(node) } } } if (mag.length) { for (i = 0; i < 3; i++) { var node = mag[i]; if (node) { this._add(node) } } } if (thunder.length) { for (i = 0; i < 3; i++) { var node = thunder[i]; if (node) { this._add(node) } } } }, refresh: function() { this.nodes = []; for (i = 0; i < dmovie.sites.length; i++) { this.nodes = this.nodes.concat(dmovie.sites[i].nodes) } this.print() }, act: function() { $("#dtable").bootgrid() } }; edmag = { s: title_cn, nodes: [], init: function() { if (!title_cn) { return } this.url = "http://edmag.net/movie-search-" + this.s + ".html"; getDoc(this.url, function(doc, url) { var trs = $("tr", doc); var nodes = []; for (i = 1; i < trs.length; i++) { var tr = trs[i]; var title = tr.getElementsByClassName("magTitle")[0].getElementsByTagName("a")[0]; var dURL = title.getAttribute("href"); dURL = "http://edmag.net" + dURL.slice(1); title = title.getAttribute("title"); var time = tr.getElementsByClassName("time")[0].textContent; var dow = tr.getElementsByClassName("dow")[0]; var ed2k, mag = undefined; try { mag = dow.getElementsByClassName("magDown")[0].getAttribute("href") } catch (e) {} try { ed2k = dow.getElementsByClassName("ed2kDown")[0].getAttribute("ed2k") } catch (e) {} if (mag) { var node = { detailURL: dURL, downloadURL: mag, date: time, type: 0, title: title }; edmag.nodes.push(node) } if (ed2k) { var node = { detailURL: dURL, downloadURL: ed2k, date: time, type: 1, title: title }; edmag.nodes.push(node) } } edmag.over() }) }, over: function() { var msg = "并入\t" + this.nodes.length + "\tedmag链接"; msg_info(msg); linksTable.refresh() } }; mp4ba = { s: title_cn, count: 0, nodes: [], init: function() { if (!title_cn) { return } var url = "http://www.mp4ba.com/search.php?keyword=" + this.s; getDoc(url, function(doc) { var urls = $("a[href^='show.php?hash=']", doc); mp4ba.count = urls.length; for (i = 0; i < urls.length; i++) { var url = "http://www.mp4ba.com/" + urls[i].getAttribute("href"); getDoc(url, function(doc, url) { var mag = $("#magnet", doc)[0].getAttribute("href"); var title = $("div.location", doc)[0].textContent.split("»").pop(); title = title.trim(); var ps = $("p", doc); var date = undefined; for (i = 0; i < ps.length; i++) { if (ps[i].textContent.startsWith("发布时间")) { date = ps[i] } } date = date.textContent.slice(5).trim(); var node = { detailURL: url, downloadURL: mag, date: date, type: 0, title: title }; mp4ba.nodes.push(node); if (mp4ba.nodes.length >= mp4ba.count) { mp4ba.over() } }) } if (!urls.length) { mp4ba.over() } }) }, over: function() { var msg = "并入\t" + this.nodes.length + "\t\tmp4ba链接"; msg_info(msg); linksTable.refresh() } }; tl95_com = { s: title_cn, count: 0, nodes: [], init: function() { if (!title_cn) { return } url = "http://www.tl95.com/?s=" + this.s; getDoc(url, function(doc, url) { var urls = $($("#main", doc)[0]).find("a[rel='bookmark'][href]"); tl95_com.count = urls.length; for (i = 0; i < urls.length; i++) { var title = $(urls[i]).text(); if (title.indexOf(tl95_com.s) === -1) { urls[i] = undefined; --tl95_com.count } } for (i = 0; i < urls.length; i++) { if (!urls[i]) { continue } url = urls[i].getAttribute("href"); getDoc(url, function(doc, url) { var date = $("div.single-cat", doc)[0].textContent.split(" ")[0].slice(5); var ed2k = $("a[href^='ed2k']", doc); if (ed2k) { for (i = 0; i < ed2k.length; i++) { n = ed2k[i]; n = $(n); var node = { detailURL: url, downloadURL: n.attr("href"), date: date, type: 1, title: n.text() }; tl95_com.nodes.push(node) } } var thunder = $("a[href^='thunder']", doc); if (thunder) { for (i = 0; i < thunder.length; i++) { n = thunder[i]; n = $(n); var node = { detailURL: url, downloadURL: n.attr("href"), date: date, type: 2, title: n.text() }; tl95_com.nodes.push(node) } } var re = /(pan.baidu.com\/s\/[a-zA-Z0-9]+)\s*.+\s*.([a-zA-Z0-9]{4})/g; var m; while ((m = re.exec(doc.body.outerText)) !== null) { if (m.index === re.lastIndex) { re.lastIndex++ } var u = m[1] + "#" + m[2]; var node = { detailURL: url, downloadURL: "http://" + u, date: date, type: 3, title: "百度网盘,密码已并入链接里。有脚本支持自动填入。" }; tl95_com.nodes.push(node) } if (tl95_com.nodes.length >= tl95_com.count) { tl95_com.over() } }) } if (!urls.length) { tl95_com.over() } }) }, over: function() { var msg = "并入\t" + this.nodes.length + "\t\ttl95_cpm链接"; msg_info(msg); linksTable.refresh() } }; kickass = { s: imdb, nodes: [], init: function() { if (!imdb) { return } var url = "https://kat.cr/usearch/imdb:" + this.s; getDoc(url, function(doc, url) { var s01 = "https://kat.cr"; var trs = $("tbody > tr.odd,tbody > tr.even", doc); for (i = 0; i < trs.length; i++) { var tr = trs[i]; tr = $(tr); var cellMainLink = tr.find("a.cellMainLink"); var node = { detailURL: s01 + cellMainLink.attr("href"), downloadURL: tr.find("a[href^='magnet']").attr("href"), date: $(tr.find("td[title]")[0]).attr("title"), type: 0, title: cellMainLink.text() }; kickass.nodes.push(node) } kickass.over() }) }, over: function() { var msg = "并入\t" + this.nodes.length + "\t\tkickass链接"; msg_info(msg); linksTable.refresh() } }; var dmovie = { init: function() { msg_warning("进入查询逻辑"); for (i = 0; i < dmovie.sites.length; i++) { this.sites[i].init() } }, sites: [edmag, kickass, mp4ba, tl95_com] }; linksTable.init(); if (!title_cn) { msg_error('title is null') } msg = ["IMDB:\t" + imdb, "TITLE:\t" + title_cn].join("\n"); msg_info(msg); dmovie.init();