// ==UserScript== // @name MyDouban_movie // @namespace https://HeawerCher // @description // @author Che. // @version 0.1 // @include http://movie.douban.com/subject/* // @grunt none // @description A better way .! // @downloadURL none // ==/UserScript== //工具类函数 function unique(data) { data = data || []; var a = {}; for (var i = 0; i < data.length; i++) { var v = data[i]; if (typeof(a[v]) == 'undefined') { a[v] = 1; } }; data.length = 0; for (var i in a) { data[data.length] = i; } return data; } function getDoc(url, callback, data, a, b, c) { 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) { // For Firefox, Chrome 30+ Supported doc = new DOMParser().parseFromString(responseDetail.responseText, 'text/html'); if (doc == undefined) { doc = document.implementation.createHTMLDocument(""); doc.querySelector('html').innerHTML = responseText; } } callback(doc, a, b, c); } }); } //界面清理 function cleaner() { //$("#s_btn_wr").remove() $("#content > div > div.aside > div.get_douban_app").remove() $("#footer").remove() $("[href='http://www.douban.com/doubanapp/app?channel=top-nav']").remove() $("div.section-ebooks").remove() //ad $("#dale_book_subject_middle_right").remove() $("#dale_book_subject_top_right").remove() $("#dale_book_subject_bottom_super_banner").remove() } cleaner() //q网页标题 var title = document.title title = title.split("(")[0].trim() var title_ori = ''; //$.get("https://www.baidu.com", function(data, status) {console.log(data + "|" + status)}) // title_ori { url = $("[href^='http://www.imdb.com/title/']").attr("href") getDoc(url, function(doc) { //The Little Prince title_ori = $($(doc).find("span[class='itemprop']")[0]).text(); console.log(title_ori) addMore() if (title_ori !== "") { title_ori = title } }) } // function addMore() { var table1 = $("
").attr("id", "link_table").append("下载链接:") var table2 = $("
").attr("id", "download_table").append("资源链接:") $("#info").append(table1).append(table2) var download_table = [{ name: "龙部落", href: "http://www.lbldy.com/search/" + title, len: function(doc) { return $(doc).find("[id^='post-']").length } }, { name: "mp4ba", href: "http://www.mp4ba.com/search.php?keyword=" + title, len: function(doc) { return $(doc).find("h2.title").text().match(/\d+/g) } }, { name: "kickass", href: "https://kat.cr/usearch/ category:movies " + title_ori, len: function(doc) { return $(doc).find("#mainSearchTable table tbody tr").find("a[data-download]").length } }, { name: "edmag", href: "http://edmag.net/search-"+title+".html" , len: function(doc) { return $(doc).find("a[href^='/detail-']").length }}] for (var i = 0; i < download_table.length; i++) { function fu(doc, a, b, c) { len = a(doc) hr = b na = c var item = $("").html(na + '(' + len + ')').attr({ href: hr, target: "_blank" }) $("#download_table").append(item) $("#download_table").append(" / ") } getDoc(download_table[i]['href'], fu, false, download_table[i]['len'], download_table[i]['href'], download_table[i]['name']) } //直接加链接 var link_table = [{ html: "Google_直接搜", href: "https://www.google.com/search?ie=UTF-8&q=" + title }, { html: "Google_百度盘", href: "https://www.google.com/search?q=" + title + " site:pan.baidu.com" }, { html: "VeryCD", href: "http://www.verycd.com/search/folders/" + title }, { html: "Donkey4u", href: "http://donkey4u.com/search/" + title }, { html: "Torrent Project", href: "http://torrentproject.com/?&btnG=Torrent+Search&num=20&start=0&s=" + title }, ]; link_table.forEach( function(item, i) { var item = $("") .html(item.html) .attr({ href: item.href, target: "_blank", style: "display:none;" }) $("#link_table").append(item) $("#link_table").append(" / "); }) function showAll() { items = $("#link_table").find("a") for (var i = 0; i < items.length; i++) { $(items[i]).fadeIn(3000) } } showAll() } // 加入网页 // $("#buyinfo-ebook").attr("id", 'info-ebook') // $("#info-ebook").find(".ebook-tag").remove() // $("#info-ebook").find("ul li").html("") // len = mlook_li.length // if (len >= 3){ // len = 3 // } // var item = $("") // for (i = 0; i < len; i++) { // absurl = 'https://www.mlook.mobi' + mlook_li[i] // item = $("").attr({ // href: absurl, // target: "_blank" // }).html(""+title+"" + "mlook" ) // $("#info-ebook").find("ul li").append(item) function dc_ready(event) { console.log("Che.") } $(document).ready(dc_ready);