豆瓣资源下载大师

聚合数百家资源网站,通过右侧边栏1秒告诉你哪些网站能下载豆瓣页面上的电影|电视剧|纪录片|综艺|动画|音乐|图书等。

  1. // ==UserScript==
  2. // @name 豆瓣资源下载大师
  3. // @description 聚合数百家资源网站,通过右侧边栏1秒告诉你哪些网站能下载豆瓣页面上的电影|电视剧|纪录片|综艺|动画|音乐|图书等。
  4. // @author Noir夜祀
  5. // @contributor Rhilip
  6. // @connect *
  7. // @grant GM_xmlhttpRequest
  8. // @grant GM_setClipboard
  9. // @grant GM_addStyle
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // @grant GM_listValues
  13. // @grant GM_deleteValue
  14. // @grant GM_registerMenuCommand
  15. // @grant GM_getResourceText
  16. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
  17. // @require https://gf.qytechs.cn/scripts/368137-encodeToGb2312/code/encodeToGb2312.js?version=601683
  18. // @include https://movie.douban.com/*
  19. // @include https://music.douban.com/*
  20. // @include https://book.douban.com/*
  21. // @include https://bangumi.moe/search/title*
  22. // @include https://desitorrents.tv/*
  23. // @include https://v.dsb.ink/*
  24. // @include http://www.x5v.net/*
  25. // @resource top250_css https://img1.doubanio.com/f/movie/5986ab7176af54744e71209c6afb5e1d8d1191cf/dist/movie/charts/top250.css
  26. // @license Zlib/Libpng License
  27. // @version 1.0.1
  28. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAGWmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuYTg3MzFiOSwgMjAyMS8wOS8wOS0wMDozNzozOCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjAgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyMi0wOS0yM1QxMzo0NjoxOSswODowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjItMDktMjNUMTM6NDY6NDIrMDg6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjItMDktMjNUMTM6NDY6NDIrMDg6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiBwaG90b3Nob3A6SUNDUHJvZmlsZT0ic1JHQiBJRUM2MTk2Ni0yLjEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NjZiMzcwOTAtM2M4Mi01ODRlLWI4ODItZjhkYTY0YTkyMDVlIiB4bXBNTTpEb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YWI2MmY2NmUtZWViYi03YTQxLTkxODYtZmQwYzYxMWQ1YzU1IiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6Y2FkZDFhNzItNTY0ZC04YjQ0LTkyMGMtNjAyMzNmMTdmYjlmIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjYWRkMWE3Mi01NjRkLThiNDQtOTIwYy02MDIzM2YxN2ZiOWYiIHN0RXZ0OndoZW49IjIwMjItMDktMjNUMTM6NDY6MTkrMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyMy4wIChXaW5kb3dzKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY29udmVydGVkIiBzdEV2dDpwYXJhbWV0ZXJzPSJmcm9tIGFwcGxpY2F0aW9uL3ZuZC5hZG9iZS5waG90b3Nob3AgdG8gaW1hZ2UvcG5nIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2NmIzNzA5MC0zYzgyLTU4NGUtYjg4Mi1mOGRhNjRhOTIwNWUiIHN0RXZ0OndoZW49IjIwMjItMDktMjNUMTM6NDY6NDIrMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyMy4wIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7XAPwHAAABgklEQVRYhe2Wv0tCURTHP0+00EUM3mAiJYjPodDZQSGMksYamrOhrfG15ZhjW0vNDTY0RAbW4F+QGJLiUPjrgVD4F9ik+St9mnUd/E7v3nvO+X645zzek1BtEeASsPO/qgFRCdVWFWDehjAINAewGwSaA2Ds3XhTM6zYnH9i9v5ZYjXu69oTfgPCASRUW1MkgPAb6BvClp6P0/jsa1MxydRe8J8HB57N7g10Kl8vcp25Gavwvm8XRXZPB+C1XiCWio8F4F9e1wUgvAVzAF0z4JU9xMLqWIW9smd6AIrs5nRMAL0S3oKR34LkQYItzwYApUaF4MXO0ILpozucVgcAD4Untq/2hsaPbEEie9sGcFodLBoXyNeLA2MV2d02b+WO0sgWJAuPXeuIsvljbO9Zb+5EAOVGlayW6zAJDwH4PstqOcqN6u8BAO7zqfZzyBXAYjL3xVhMZkKuwMCcYeobwubZh67ESSWdLHWthb+GwgHm/4QzAVAT6K8ZgENAE2BeAaJfBA5av5nlEvoAAAAASUVORK5CYII=
  29. // @run-at document-end
  30. // @namespace doveboy_js
  31. // ==/UserScript==
  32.  
  33. /* global $, jQuery, encodeToGb2312 */
  34.  
  35. // This Userscirpt can't run under Greasemonkey 4.x platform
  36. if (typeof GM_xmlhttpRequest === "undefined") {
  37. alert("不支持Greasemonkey 4.x,请换用暴力猴或Tampermonkey");
  38. return;
  39. }
  40.  
  41. // 不属于豆瓣的页面
  42. if (!/douban.com/.test(location.host)) {
  43. function AutoSearch(host, zInputSelector, btnSelector, dict) {
  44. if (location.host === host) {
  45. let match = location.href.match(/#search_(.+)/); // 从url的hash部分获取搜索关键词
  46. if (match) {
  47. history.pushState("", document.title, window.location.pathname + window.location.search); // 清空hash
  48. window.addEventListener("load", function () { // 等待页面完全加载完成
  49. let zInput = $(zInputSelector);
  50. zInput.val(decodeURIComponent(match[1])); // 填入搜索值
  51. dict = $.extend({}, dict);
  52. if (dict.ang) { // 补加Event,防止Angular绑定失效。 From: https://stackoverflow.com/questions/34360739/automate-form-submission-on-an-angularjs-website-using-tampermonkey
  53. let changeEvent = document.createEvent("HTMLEvents");
  54. changeEvent.initEvent("change", true, true);
  55. zInput[0].dispatchEvent(changeEvent);
  56. }
  57. if (dict.notarget) { // 取消form的提交跳转
  58. $(btnSelector).parents("form").attr("target", "_self");
  59. }
  60. $(btnSelector).click(); // 模拟点击
  61. });
  62. }
  63. }
  64. }
  65.  
  66. AutoSearch("bangumi.moe", '#filter-tag-list div.torrent-title-search > md-input-group > input', '#filter-tag-list > div.torrent-search > div:nth-child(3) > button:nth-child(4)', { ang: true });
  67. AutoSearch("v.dsb.ink", '.search__input', '.icon-search', {});
  68. AutoSearch("www.x5v.net", '#searchText', '#btnSearch', {});
  69. AutoSearch("desitorrents.tv", 'input.search_string_input', 'input.search_string_input+img', {});
  70.  
  71. return; // 终止脚本运行,防止豆瓣的css以及js片段等污染页面
  72. }
  73.  
  74. // 阻止其他豆瓣同类脚本加载
  75. var seBwhA = document.createElement("a");
  76. seBwhA.id = "seBwhA";
  77. document.getElementsByTagName("html")[0].appendChild(seBwhA);
  78.  
  79. // 注入脚本相关的CSS,包括:隐藏、调整豆瓣原先的元素,脚本页面样式
  80. GM_addStyle(`
  81. .c-aside{margin-bottom:30px}.c-aside-body a{border-radius:6px;color:#37a;display:inline-block;letter-spacing:normal;margin:0 8px 8px 0;padding:0 8px;text-align:center;width:65px}.c-aside-body a:link,.c-aside-body a:visited{background-color:#f5f5f5;color:#37a}.c-aside-body a:active,.c-aside-body a:hover{background-color:#e8e8e8;color:#37a}.c-aside-body a.available{background-color:#5ccccc;color:#006363}.c-aside-body a.available:active,.c-aside-body a.available:hover{background-color:#3cc}.c-aside-body a.sites_r0{text-decoration:line-through}
  82. #c_dialog li{margin:10px}#c_dialog{text-align:center}
  83. #interest_sectl .rating_imdb{border-top:1px solid #eaeaea;border-bottom:1px solid #eaeaea;padding-bottom:0}#interest_sectl .rating_wrap{padding-top:15px}#interest_sectl .rating_more{border-bottom:1px solid #eaeaea;color:#9b9b9b;margin:0;padding:15px 0;position:relative}#interest_sectl .rating_more a{left:80px;position:absolute}#interest_sectl .rating_more .titleOverviewSprite{background:url(https://coding.net/u/Changhw/p/MyDoubanMovieHelper/git/raw/master/title_overview_sprite.png) no-repeat;display:inline-block;vertical-align:middle}#interest_sectl .rating_more .popularityImageUp{background-position:-14px -478px;height:8px;width:8px}#interest_sectl .rating_more .popularityImageDown{background-position:-34px -478px;height:8px;width:8px}#interest_sectl .rating_more .popularityUpOrFlat{color:#83c40b}#interest_sectl .rating_more .popularityDown{color:#930e02}
  84. .more{display:block;height:34px;line-height:34px;text-align:center;font-size:14px;background:#f7f7f7}
  85. div#drdm_setting input[type=checkbox]{display:none}div#drdm_setting input[type=checkbox]+label{display:inline-block;width:40px;height:20px;position:relative;transition:.3s;margin:0 20px;box-sizing:border-box;background:#ddd;border-radius:20px;box-shadow:1px 1px 3px #aaa}div#drdm_setting input[type=checkbox]+label:after,div#drdm_setting input[type=checkbox]+label:before{content:'';display:block;position:absolute;left:0;top:0;width:20px;height:20px;transition:.3s;cursor:pointer}div#drdm_setting input[type=checkbox]+label:after{background:#fff;border-radius:50%;box-shadow:1px 1px 3px #aaa}div#drdm_setting input[type=checkbox]:checked+label{background:#aedcae}div#drdm_setting input[type=checkbox]:checked+label:after{background:#5cb85c;left:calc(100% - 20px)}
  86. .drdm-dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.drdm-dl-horizontal dd{margin-left:180px}
  87. `);
  88.  
  89.  
  90. if (GM_getValue('enable_extra_stylesheet', true)) {
  91. GM_addStyle('#dale_movie_chart_top_right,#dale_movie_home_bottom_right,#dale_movie_home_bottom_right_down,#dale_movie_home_download_bottom,#dale_movie_home_inner_bottom,#dale_movie_home_side_top,#dale_movie_home_top_right,#dale_movie_subject_bottom_super_banner,#dale_movie_subject_download_middle,#dale_movie_subject_inner_middle,#dale_movie_subject_middle_right,#dale_movie_subject_top_midle,#dale_movie_subject_top_right,#dale_movie_tags_top_right,#dale_movie_towhome_explore_right,#dale_review_best_top_right,#footer,#movie_home_left_bottom,.extra,.mobile-app-entrance.block5.app-movie,.qrcode-app,.top-nav-doubanapp,div.gray_ad,div.ticket{display:none}');
  92. }
  93.  
  94. // -- 定义基础方法 --
  95.  
  96. // 对使用GM_xmlhttpRequest返回的html文本进行处理并返回DOM树
  97. function page_parser(responseText) {
  98. // 替换一些信息防止图片和页面脚本的加载,同时可能加快页面解析速度
  99. // responseText = responseText.replace(/s+src=/ig, ' data-src='); // 图片,部分外源脚本
  100. // responseText = responseText.replace(/<script[^>]*?>[\S\s]*?<\/script>/ig, ''); //页面脚本
  101. return (new DOMParser()).parseFromString(responseText, 'text/html');
  102. }
  103.  
  104. function getDoc(url, meta, callback) {
  105. GM_xmlhttpRequest({
  106. method: 'GET',
  107. url: url,
  108. onload: function (responseDetail) {
  109. if (responseDetail.status === 200) {
  110. let doc = page_parser(responseDetail.responseText);
  111. callback(doc, responseDetail, meta);
  112. }
  113. }
  114. });
  115. }
  116.  
  117. function getJSON(url, callback) {
  118. GM_xmlhttpRequest({
  119. method: 'GET',
  120. url: url,
  121. headers: {
  122. 'Accept': 'application/json'
  123. },
  124. onload: function (response) {
  125. if (response.status >= 200 && response.status < 400) {
  126. callback(JSON.parse(response.responseText), url);
  127. } else {
  128. callback(false, url);
  129. }
  130. }
  131. });
  132. }
  133.  
  134. // 缓存相关方法
  135. function CacheStorage(name, expire = null) {
  136. let now = Date.now();
  137. let cache_name = "drdm_cache_" + (name ? name : 'default');
  138.  
  139. if (localStorage[cache_name + "_exp"]) {
  140. if (now > localStorage[cache_name + "_exp"]) {
  141. localStorage.removeItem(cache_name);
  142. }
  143. }
  144.  
  145. let cache = localStorage[cache_name] ? JSON.parse(localStorage[cache_name]) : {};
  146. localStorage.setItem(cache_name + "_exp", now + expire);
  147.  
  148. return {
  149. flush: function () {
  150. localStorage.setItem(cache_name, JSON.stringify(cache));
  151. },
  152.  
  153. add: function (name, value) {
  154. cache[name] = value;
  155. this.flush();
  156. },
  157.  
  158. del: function (name) {
  159. if (name) {
  160. delete cache[name];
  161. this.flush;
  162. } else {
  163. localStorage.removeItem(cache_name);
  164. }
  165. },
  166.  
  167. get: function (name, def = null) {
  168. if (name) {
  169. return cache[name] ? cache[name] : def;
  170. } else {
  171. return cache;
  172. }
  173. }
  174. }
  175. }
  176.  
  177. function clearExpiredCacheValue(force) {
  178. let StorageKey = [];
  179. for (let i = 0, len = localStorage.length; i < len; ++i) { // 先从里面取出所有的key
  180. StorageKey.push(localStorage.key(i));
  181. }
  182.  
  183. let CacheKey = StorageKey.filter(function (x) {
  184. return x && x.match(/(drdm_cache_.+)_exp/);
  185. }); // 再从中提取出本脚本缓存的键值
  186.  
  187. for (let i = 0, len = CacheKey.length; i < len; ++i) {
  188. let key_name = CacheKey[i];
  189. let exp_at = localStorage.getItem(key_name);
  190. if (force || exp_at < Date.now()) {
  191. localStorage.removeItem(key_name);
  192. localStorage.removeItem(key_name.slice(0, -4)); // 移除 _exp 后缀
  193. }
  194. }
  195. }
  196.  
  197. let _version = GM_getValue("version", "轻量版");
  198. let delete_site_prefix = "delete_site_";
  199.  
  200. if (typeof GM_registerMenuCommand !== "undefined") {
  201.  
  202. function changeVersionConfirm() {
  203. if (confirm(`你当前版本是 ${_version},是否进行切换?`)) {
  204. GM_setValue("version", _version === "完整版" ? "轻量版" : "完整版");
  205. }
  206. }
  207. GM_registerMenuCommand("脚本功能切换", changeVersionConfirm);
  208.  
  209. function changeTagBColor() {
  210. let now_bcolor_list = [GM_getValue("tag_bcolor_exist", "#e3f1ed"), GM_getValue("tag_bcolor_not_exist", "#f4eac2"), GM_getValue("tag_bcolor_need_login", ""), GM_getValue("tag_bcolor_error", "")];
  211. let name = prompt("请依次输入代表'资源存在','资源不存在','站点需要登陆','站点解析错误'颜色的Hex值,并用英文逗号分割。当前值为:", `${now_bcolor_list.join(',')}`);
  212. if (name != null && name !== "") {
  213. try {
  214. let bcolor_list = name.split(",");
  215. GM_setValue("tag_bcolor_exist", bcolor_list[0] || "#e3f1ed");
  216. GM_setValue("tag_bcolor_not_exist", bcolor_list[1] || "#f4eac2");
  217. GM_setValue("tag_bcolor_need_login", bcolor_list[2] || "");
  218. GM_setValue("tag_bcolor_error", bcolor_list[3] || "");
  219. } catch (e) {
  220. alert("解析输入出错");
  221. }
  222. }
  223. }
  224. GM_registerMenuCommand("更改标签背景色", changeTagBColor);
  225.  
  226. function changeTagFColor() {
  227. let now_fcolor_list = [GM_getValue("tag_fcolor_exist", "#3377aa"), GM_getValue("tag_fcolor_not_exist", "#3377aa"), GM_getValue("tag_fcolor_need_login", "#3377aa"), GM_getValue("tag_fcolor_error", "#3377aa")];
  228. let name = prompt("请依次输入代表'资源存在','资源不存在','站点需要登陆','站点解析错误'颜色的Hex值,并用英文逗号分割。当前值为:", `${now_fcolor_list.join(',')}`);
  229. if (name != null && name !== "") {
  230. try {
  231. let fcolor_list = name.split(",");
  232. GM_setValue("tag_fcolor_exist", fcolor_list[0] || "#3377aa");
  233. GM_setValue("tag_fcolor_not_exist", fcolor_list[1] || "#3377aa");
  234. GM_setValue("tag_fcolor_need_login", fcolor_list[2] || "#3377aa");
  235. GM_setValue("tag_fcolor_error", fcolor_list[3] || "#3377aa");
  236. } catch (e) {
  237. alert("解析输入出错");
  238. }
  239. }
  240. }
  241. GM_registerMenuCommand("更改标签文字色", changeTagFColor);
  242.  
  243. function forceCacheClear() {
  244. if (confirm("清空所有缓存信息(包括资源存在情况、登陆情况等)")) {
  245. clearExpiredCacheValue(true);
  246. }
  247. }
  248. GM_registerMenuCommand("清空脚本缓存", forceCacheClear);
  249. }
  250.  
  251.  
  252. let fetch_anchor = function (anchor) {
  253. return anchor[0].nextSibling.nodeValue.trim();
  254. };
  255.  
  256. function starBlock(source, source_link, _rating, _vote, max = 10) {
  257. let starValue = parseFloat(_rating) / 2;
  258. starValue = starValue % 1 > 0.5 ? Math.floor(starValue) + 0.5 : Math.floor(starValue);
  259. starValue *= (100 / max);
  260.  
  261. return `<div class=rating_logo >${source} 评分</div><div class="rating_self clearfix" typeof="v:Rating"><strong class="ll rating_num" property="v:average">${parseFloat(_rating).toFixed(1)}</strong><span property="v:best" content=10.0 ></span><div class="rating_right "><div class="ll bigstar ${'bigstar' + starValue}"></div><div class="rating_sum"> <a href=${source_link} class=rating_people target="_blank"><span property="v:votes">${_vote}</span>人${source === "MAL" ? "观看" : "评价"}</a> </div> </div> </div>`
  262. }
  263.  
  264. function parseLdJson(raw) {
  265. return JSON.parse(raw.replace(/\n/ig, ''));
  266. }
  267.  
  268.  
  269. $(document).ready(function () {
  270. let douban_link, douban_id;
  271.  
  272. douban_link = 'https://' + location.href.match(/douban.com\/subject\/\d+\//); //豆瓣链接
  273. douban_id = location.href.match(/(\d{7,8})/g);
  274.  
  275. let site_map = [];
  276.  
  277. /** label对象键值说明:
  278. * name: String 站点名称,请注意该站点名称在不同的site_map中也应该唯一,以免脚本后续判断出错
  279. * method: String 搜索请求方式,默认值为 "GET"
  280. * link: String 构造好的请求页面链接,作为label的href属性填入,用户应该能直接点开这个页面。
  281. * ajax: String 如果站点使用ajax的形式加载页面,则需要传入该值作为实际请求的链接,即优先级比link更高。
  282. * type: String 返回结果类型,脚本默认按html页面解析;只有当传入值为"json"时,脚本按JSON格式解析
  283. * selector: String 搜索成功判断结果,默认值为 "table.torrents:last > tbody > tr:gt(0)" (适用于国内多数NexusPHP构架的站点)
  284. * 如果type为"page"(默认)时,为一个(jQuery)CSS选择器,
  285. * 如果type为"json"或"jsonp"时,为一个具体的判断式。
  286. * selector_need_login 搜索需要登录(不可用)的选择器,仅在type为默认时有用,其余用法同Selector一致。
  287. * data: String 作为请求的主体发送的内容,默认为空即可
  288. * headers: Object 修改默认请求头,(防止某些站点有referrer等请求头检查
  289. * rewrite_href: Boolean 如果站点最终搜索显示的页面与实际使用搜索页面(特别是使用post进行交互的站点)不一致,
  290. * 设置为true能让脚本存储最终url,并改写label使用的href属性
  291. * csrf: Object 一个类似这样的字典 { name: "_csrf", update: "link"}
  292. * 其中key为站点csrf防护的名称,update为需要更新的字段(一般为link或data)
  293. *
  294. * 注意: 1. 如果某键有默认值,则传入值均会覆盖默认值
  295. * 2. 关于请求方法请参考:https://github.com/scriptish/scriptish/wiki/GM_xmlhttpRequest
  296. * */
  297. if (douban_id) {
  298. clearExpiredCacheValue(false); // 清理缓存
  299. let cache = CacheStorage(douban_id, 86400 * 7 * 1e3);
  300. let need_login_cache = CacheStorage("need_login", 86400 * 1e3);
  301.  
  302. $("#content div.aside").prepend(`<div id="drdm_req_status" style="color: #C65E24;background: #F4F4EC; padding: 10px; margin-bottom: 20px; word-wrap: break-word;display: none;">
  303. <div style="text-align: center;">豆瓣资源下载大师 - 资源搜索情况 <a href="javascript:void();" id="drdm_req_status_hide">(隐藏)</a> <hr></div>
  304. <p id="drdm_dep_notice" style="color: #C65E24;display:none;">脚本未完全加载,部分站点将受影响。请确保网络稳定或尝试重新刷新页面。</p>
  305. <table>
  306. <tr><td width="50%">存在:<span id="drdm_req_success"></span></td><td width="50%">不存在:<span id="drdm_req_noexist"></span></td></tr>
  307. <tr><td width="50%">请求中:<span id="drdm_req_asking"></span></td><td width="50%">失败或需要登陆:<span id="drdm_req_fail"></span></td></tr>
  308. </table>
  309. <span id="drdm_req_help"><hr>
  310. <span>是否隐藏当前未成功的搜索项? <a href="javascript:void();" id="drdm_hide_fail"> </a> / <a href="javascript:void();" id="drdm_show_all"> </a></span>
  311. </span>
  312. </div>
  313. <div id='drdm_sites'></div>`);
  314. $("#drdm_req_status_hide").click(function () { $("#drdm_req_status").hide(); });
  315. $("#drdm_hide_fail").click(function () {
  316. $("#drdm_sites a[title!=\"资源存在\"]").hide();
  317. $('#drdm_sites > div.c-aside.name-offline').each(function () { let that = $(this); if (that.find('> div > ul > a:visible').length == 0) { that.hide() } });
  318. });
  319. $("#drdm_show_all").click(function () { $("#drdm_sites a:hidden").show(); $('#drdm_sites > div.c-aside.name-offline').show(); });
  320.  
  321. let update_status_interval;
  322.  
  323. function update_req_status() {
  324. let asking_length = $("#drdm_sites a[title=\"正在请求信息中\"]").length;
  325.  
  326. $("#drdm_req_success").text($("#drdm_sites a[title=\"资源存在\"]").length);
  327. $("#drdm_req_asking").text(asking_length);
  328. $("#drdm_req_noexist").text($("#drdm_sites a[title=\"资源不存在\"]").length);
  329. $("#drdm_req_fail").text($("#drdm_sites a[title=\"站点需要登陆\"]").length + $("#drdm_sites a[title=\"遇到问题\"]").length);
  330.  
  331. if (asking_length === 0) {
  332. clearInterval(update_status_interval); // 当所有请求完成后清除定时器
  333. if (GM_getValue('enalbe_adv_auto_tip_hide', false)) {
  334. $("#drdm_req_status_hide").click();
  335. }
  336. }
  337. }
  338.  
  339. function _encodeToGb2312(str, opt) {
  340. let ret = "";
  341. try {
  342. ret = encodeToGb2312(str, opt);
  343. } catch (e) {
  344. ret = Math.random() * 1e6;
  345. $("#drdm_dep_notice").show();
  346. }
  347. return ret;
  348. }
  349.  
  350. if (location.host === "movie.douban.com") {
  351. // 查看原图
  352. if ($('#mainpic p.gact').length === 0) { // 在未登录(不可用)的情况下添加空白元素以方便查看原图交互按钮的定位
  353. $("#mainpic").append("<p class=\"gact\"></p>");
  354. }
  355. let posterAnchor = document.querySelector('#mainpic > a > img');
  356. let postersUrl, rawUrl;
  357. if (posterAnchor) {
  358. postersUrl = posterAnchor.getAttribute("src");
  359. rawUrl = postersUrl.replace(/photo\/[sl](_ratio_poster|pic)\/public\/(p\d+).+$/, "photo/raw/public/$2.jpg");
  360. $('#mainpic p.gact').after(`<a target="_blank" rel="nofollow" href="${rawUrl}">查看原图</a>`);
  361. }
  362.  
  363. // 调整底下剧情简介的位置
  364. let interest_sectl_selector = $('#interest_sectl');
  365. interest_sectl_selector.after($('div.grid-16-8 div.related-info'));
  366. interest_sectl_selector.attr('style', 'float:right');
  367. $('div.related-info').attr('style', 'width:480px;float:left');
  368.  
  369. // Movieinfo信息生成相关
  370. let this_title, trans_title, aka;
  371. let year, region, genre, language, playdate;
  372. let imdb_link, imdb_id, imdb_average_rating, imdb_votes, imdb_rating;
  373. let douban_average_rating, douban_votes, douban_rating;
  374. let episodes, duration;
  375. let director, writer, cast;
  376. let tags, introduction, awards;
  377.  
  378. // 获得 <script type="application/ld+json" /> 里面的信息,这里面的东西和API返回需要的东西差不多
  379. let ld_json;
  380. try {
  381. ld_json = parseLdJson($('head > script[type="application/ld+json"]').text());
  382. } catch (e) { }
  383.  
  384. // 增加Mediainfo的交互按钮与监听
  385. if (GM_getValue("enable_mediainfo_gen", false)) {
  386. $("div#info").append("<br><span class=\"pl\">生成信息: </span><a id='movieinfogen' href='javascript:void(0);'>movieinfo</a>");
  387. $("div.related-info").before("<div class='c-aside' style='float:left;margin-top:20px;width: 470px;display: none' id='movieinfo_div'><h2><i>电影简介</i>· · · · · · </h2><a href='javascript:void(0);' id='copy_movieinfo'>点击复制</a><div class=\"c-aside-body\" style=\"padding: 0 12px;\" id='movieinfo'></div></div>");
  388. $("a#movieinfogen").click(function () {
  389. let descr = "";
  390. descr += poster ? `[img]${poster}[/img]\n\n` : "";
  391. descr += trans_title ? `◎译  名 ${trans_title}\n` : "";
  392. descr += this_title ? `◎片  名 ${this_title}\n` : "";
  393. descr += year ? `◎年  代 ${year.trim()}\n` : "";
  394. descr += region ? `◎产  地 ${region}\n` : "";
  395. descr += genre ? `◎类  别 ${genre}\n` : "";
  396. descr += language ? `◎语  言 ${language}\n` : "";
  397. descr += playdate ? `◎上映日期 ${playdate}\n` : "";
  398. descr += imdb_rating ? `◎IMDb评分 ${imdb_rating}\n` : ""; // 注意如果长时间没能请求完成imdb信息,则该条不显示
  399. descr += imdb_link ? `◎IMDb链接 ${imdb_link}\n` : "";
  400. descr += douban_rating ? `◎豆瓣评分 ${douban_rating}\n` : "";
  401. descr += douban_link ? `◎豆瓣链接 ${douban_link}\n` : "";
  402. descr += episodes ? `◎集  数 ${episodes}\n` : "";
  403. descr += duration ? `◎片  长 ${duration}\n` : "";
  404. descr += director ? `◎导  演 ${director}\n` : "";
  405. descr += writer ? `◎编  剧 ${writer}\n` : "";
  406. descr += cast ? `◎主  演 ${cast.replace(/\n/g, '\n' + ' '.repeat(4) + '  ').trim()}\n` : "";
  407. descr += tags ? `\n◎标  签 ${tags}\n` : "";
  408. descr += introduction ? `\n◎简  介\n\n  ${introduction.replace(/\n/g, '\n' + ' '.repeat(2))}\n` : "";
  409. descr += awards ? `\n◎获奖情况\n\n  ${awards.replace(/\n/g, '\n' + ' '.repeat(2))}\n` : "";
  410. $("div#movieinfo").html(descr.replace(/\n/ig, "<br>"));
  411. $("#movieinfo_div").toggle();
  412. });
  413. $("a#copy_movieinfo").click(function () {
  414. let movieclip = $("#movieinfo").html().replace(/<br>/ig, "\n").replace(/<a [^>]*>/g, "").replace(/<\/a>/g, "");
  415. GM_setClipboard(movieclip);
  416. $(this).text("复制成功");
  417. });
  418. }
  419.  
  420. // 先对一些关键信息进行判断
  421. let aka_anchor = $('#info span.pl:contains("又名")');
  422. let has_aka = aka_anchor.length > 0;
  423. let is_movie = $("a.bn-sharing[data-type='电影']").length > 0;
  424. let is_series = $("a.bn-sharing[data-type='电视剧']").length > 0;
  425. let is_anime = $('span[property="v:genre"]:contains("动画")').length > 0;
  426. let is_document = $('span[property="v:genre"]:contains("纪录片")').length > 0;
  427.  
  428. // 页面元素定位
  429. let regions_anchor = $('#info span.pl:contains("制片国家/地区")'); //产地
  430. let language_anchor = $('#info span.pl:contains("语言")'); //语言
  431. let episodes_anchor = $('#info span.pl:contains("集数")'); //集数
  432. let duration_anchor = $('#info span.pl:contains("单集片长")'); //片长
  433.  
  434. let imdb_anchor = $('#info span.pl:contains("IMDb")'); // IMDb
  435. let has_imdb = imdb_anchor.length > 0;
  436.  
  437. // 基础Movieinfo信息
  438. let chinese_title = document.title.replace('(豆瓣)', '').trim();
  439. let foreign_title = $('#content h1>span[property="v:itemreviewed"]').text().replace(chinese_title, '').trim();
  440. let poster = rawUrl ? rawUrl.replace('raw', 'l_ratio_poster').replace('img3', 'img1') : '';
  441.  
  442. if (has_aka) {
  443. aka = fetch_anchor(aka_anchor).split(' / ').sort(function (a, b) { //首字(母)排序
  444. return a.localeCompare(b);
  445. }).join('/');
  446. }
  447.  
  448. if (foreign_title) {
  449. trans_title = chinese_title + (aka ? ('/' + aka) : '');
  450. this_title = foreign_title;
  451. } else {
  452. trans_title = aka ? aka : '';
  453. this_title = chinese_title;
  454. }
  455.  
  456. playdate = $('#info span[property="v:initialReleaseDate"]').map(function () { //上映日期
  457. return $(this).text().trim();
  458. }).toArray().sort(function (a, b) {//按上映日期升序排列
  459. return new Date(a) - new Date(b);
  460. }).join('/');
  461.  
  462. year = ' ' + $('#content > h1 > span.year').text().substr(1, 4);
  463. region = regions_anchor[0] ? fetch_anchor(regions_anchor).split(' / ').join('/') : '';
  464. language = language_anchor[0] ? fetch_anchor(language_anchor).split(' / ').join('/') : '';
  465. episodes = episodes_anchor[0] ? fetch_anchor(episodes_anchor) : '';
  466. duration = duration_anchor[0] ? fetch_anchor(duration_anchor) : $('#info span[property="v:runtime"]').text().trim();
  467.  
  468. let is_europe = region.match(/美国|英国|加拿大|丹麦/);
  469. let is_japan = region.match(/日本/);
  470. let is_korea = region.match(/韩国/);
  471. let is_thai = region.match(/泰国/);
  472. let is_india = region.match(/印度/);
  473. let is_pakistan = region.match(/巴基斯坦|Pakistan/)
  474. let is_mainland = region.match(/中国大陆/);
  475. let is_mandarine = language.match(/汉语普通话/);
  476. let is_otherlan = language.match(/\//);
  477.  
  478. genre = $('#info span[property="v:genre"]').map(function () { //类别
  479. return $(this).text().trim();
  480. }).toArray().join('/');
  481.  
  482. // 获取电影名
  483. let title = $('#content > h1 > span')[0].textContent.split(' ').shift().replace(/[,]/g, " ").replace(/:.*$/, "");
  484. let eng_title = [this_title, trans_title].join("/").split("/").filter(function (arr) {
  485. return /([a-zA-Z]){2,}/.test(arr);
  486. })[0] || "";
  487. let is_chinese = title.match(/[^\x00-\xff]/);
  488. let unititle = is_chinese ? title : eng_title;
  489.  
  490. // 剧集修正季数名
  491. eng_title = eng_title.match(/Season\s\d\d/) ? eng_title.replace(/Season\s/, "S") : eng_title.replace(/Season\s/, "S0");
  492. eng_title = eng_title.replace(/[:,!\-]/g, "").replace(/ [^a-z0-9]+$/, "").replace(/ +/g, " ");
  493. let eng_title_clean = eng_title.replace(/ S\d\d*$/, "");
  494. let has_entitle = eng_title_clean;
  495.  
  496. // 日剧春夏秋冬解析
  497. let playdate_pro = new Date(playdate.split('/')[0]);
  498. let release_year = playdate.replace(/-.*$/, "").replace(/^\d{2}/, "");
  499. let release_month = playdate_pro.getMonth() + 1;
  500. let drama_season;
  501. if ([4, 5, 6].includes(release_month)) { drama_season = "spring"; }
  502. else if ([7, 8, 9].includes(release_month)) { drama_season = "summer"; }
  503. else if ([10, 11, 12].includes(release_month)) { drama_season = "autumn"; }
  504. else { drama_season = "winter"; }
  505.  
  506. // 电影+年份 (只有电影才搜索并赋值年份)
  507. let encode_year = is_movie ? year.replace(/ /, "_") : "";
  508. let nian = is_movie ? year : "";
  509. let encode_this_title = (this_title || "").replace(/:/, "").replace(/ /g, "_");
  510. let ptzimu = encode_this_title + encode_year;
  511. chinese_title = chinese_title.replace(/[:,]/, " ");
  512. let gunititle = _encodeToGb2312(unititle, true);
  513. let punititle = encodeURI(unititle).replace(/%/g, "%25");
  514. let uunititle = encodeURI(unititle).replace(/%/g, "_");
  515. let ywm = eng_title + nian;
  516. let zwm = chinese_title + nian;
  517. let entitle = eng_title_clean + nian
  518. let is_ywm = ywm.match(/[A-Z]/);
  519.  
  520. // Add top rank tag
  521. if (GM_getValue("enable_top_rang_tag", true)) {
  522. GM_xmlhttpRequest({
  523. method: 'GET',
  524. url: "https://bimzcy.github.io/rank4douban/data.json",
  525. onload: function (response) {
  526. let rank_json = JSON.parse(response.responseText);
  527. let insert_html_list = [];
  528. for (let i in rank_json) {
  529. let top_list = rank_json[i];
  530. let list_num = top_list.list[douban_id];
  531. if (list_num) {
  532. let list_order = top_list.top;
  533. insert_html_list[list_order] = `<div class="top250"><span class="top250-no">${top_list.prefix ? top_list.prefix : "No."}${list_num}</span><span class="top250-link"><a href="${top_list.href}" title="${top_list.title}">${top_list.short_title}</a></span></div>`;
  534. }
  535. }
  536. if (insert_html_list) {
  537. if ($('link[href*="top250.css"]').length === 0) {
  538. GM_addStyle(GM_getResourceText("top250_css"));
  539. }
  540. insert_html_list.push("<div style=\"display: none;\" id='rank_toggle' data-toggle='show'><a href=\"javascript::\">展示剩余 →</a></div>");
  541. let after = $("#content > h1");
  542. after.before(insert_html_list.join(' '));
  543. let top_selector = $(".top250");
  544. top_selector.css("display", "inline-block");
  545. if (top_selector.length > 4) {
  546. $(".top250:gt(3)").hide();
  547. $("#rank_toggle").show().css("display", "inline-block").click(function () {
  548. if ($(this).attr("data-toggle") === "show") {
  549. top_selector.show();
  550. $(this).attr("data-toggle", "hide").html("<a href=\"javascript::\">隐藏剩余 ←</a>");
  551. } else {
  552. $(".top250:gt(3)").hide();
  553. $(this).attr("data-toggle", "show").css("display", "inline-block").html("<a href=\"javascript::\">展示剩余 →</a>");
  554. }
  555. })
  556. }
  557. }
  558. }
  559. });
  560. }
  561.  
  562. // 从中栏中先获取豆瓣评分信息(此时还没有imdb等第三方评价信息)
  563. let douban_vote_another = $('div[typeof="v:Rating"]:eq(0)');
  564. if (douban_vote_another.length > 0) {
  565. douban_average_rating = douban_vote_another.find('[property="v:average"]').length > 0 ? douban_vote_another.find('[property="v:average"]').text() : 0;
  566. douban_votes = douban_vote_another.find('[property="v:votes"]').length > 0 ? douban_vote_another.find('[property="v:votes"]').text() : 0;
  567. douban_rating = douban_average_rating + '/10 from ' + douban_votes + ' users';
  568. }
  569.  
  570. // 中栏加强
  571. $("div#interest_sectl").append(`<div class='rating_wrap clearbox' id='loading_more_rate'>加载第三方评价信息中.......</div>
  572. <div class="rating_wrap clearbox rating_imdb" style="display:none"></div>
  573. <div class="rating_wrap clearbox rating_rott" style="display:none"></div>
  574. <div class="rating_wrap clearbox rating_anidb" style="border-top: 1px solid #eaeaea; display:none"></div>
  575. <div class="rating_more" style="display:none"></div>`); // 修复部分情况$("div.rating_betterthan")不存在情况
  576.  
  577. // put on more ratings
  578. let rating_more_data = [ /** {name, link || `${imdb_link}`, text} */];
  579.  
  580. function update_rating_more(data) {
  581. rating_more_data.push(data);
  582.  
  583. let rating_more = $('#interest_sectl .rating_more');
  584. let rating_more_html = '';
  585. for (let i = 0; i < rating_more_data.length; i++) {
  586. let rating_data = rating_more_data[i];
  587. rating_more_html += `<div>${rating_data['name']} <a href='${rating_data['link'] || imdb_link}' style="${rating_data['name'].length <= 4 ? 'margin-left:-20px' : ''} " target="_blank" title="${rating_data['data']}">${rating_data['data']}</a></div>`;
  588. }
  589. rating_more.html(rating_more_html);
  590. rating_more.show();
  591. $("#loading_more_rate").hide();
  592. }
  593.  
  594. // 请求IMDb信息(最慢,最先且单独请求)
  595. if (has_imdb) {
  596. imdb_id = fetch_anchor(imdb_anchor);
  597. imdb_link = `https://www.imdb.com/title/${imdb_id}/`
  598.  
  599. // 把豆瓣删除的超链接给加回去
  600. $(imdb_anchor[0].nextSibling).replaceWith(`&nbsp;<a href="${imdb_link}" target="_blank">${imdb_id}</a>`);
  601.  
  602. getDoc(imdb_link, null, function (doc) {
  603. // 判断是不是新版界面
  604. let new_another = $('script#__NEXT_DATA__', doc);
  605. let is_new = new_another.length > 0;
  606. let ld_json_imdb;
  607.  
  608. try {
  609. // IMDb 评分 (评分信息直接从 ld_json 中获取算了)
  610. ld_json_imdb = parseLdJson($('head > script[type="application/ld+json"]', doc).text());
  611. imdb_average_rating = ld_json_imdb["aggregateRating"]["ratingValue"];
  612. imdb_votes = ld_json_imdb["aggregateRating"]["ratingCount"];
  613. imdb_rating = imdb_votes ? imdb_average_rating + '/10 from ' + imdb_votes + ' users' : ''; // MovieinfoGen 相关
  614. $('#interest_sectl div.rating_imdb').html(starBlock("IMDB", imdb_link + 'ratings?ref_=tt_ov_rt', imdb_average_rating, imdb_votes)).show();
  615.  
  616. // 分级信息 可以从 ld_json 中获取
  617. if (ld_json_imdb['contentRating']) {
  618. const contentRatingMap = {
  619. 'G': '大众级 | 全年龄',
  620. 'PG': '指导级 | ≥6岁',
  621. 'PG-13': '特指级 | ≥13岁',
  622. 'NC-17': '限定级 | ≥17岁',
  623. 'R': '限制级 | ≥18岁',
  624. 'Not Rated': '未分级'
  625. };
  626. update_rating_more({
  627. name: '分级', // MPAA
  628. link: imdb_link + 'parentalguide#certification',
  629. data: contentRatingMap[ld_json_imdb['contentRating']] || ld_json_imdb['contentRating']
  630. });
  631. }
  632.  
  633. // Metascore
  634. let metascore_selector = is_new ? 'a[href*="criticreviews"] span.score' : 'a[href^=criticreviews] span';
  635. if ($(metascore_selector, doc).length > 0) {
  636. update_rating_more({
  637. name: 'Metascore',
  638. link: imdb_link + 'criticreviews?ref_=tt_ov_rt',
  639. data: $(metascore_selector, doc).text()
  640. });
  641. }
  642.  
  643. // 流行度
  644. let popularity_selector = is_new
  645. ? 'div[class^="TitleBlockButtonBase__ButtonContentWrap"]:has( > div[class^="TrendingButton__ContentWrap"])'
  646. : 'div:contains("Popularity") + div > span.subText';
  647. if ($(popularity_selector, doc).length > 0) {
  648. let popularity_another = $(popularity_selector, doc);
  649. let pop_score, pop_delta, pop_up;
  650. if (is_new) {
  651. pop_score = popularity_another.find('div[class^="TrendingButton__TrendingScore"]').text();
  652. pop_delta = popularity_another.find('div[class^="TrendingButton__TrendingDelta"]').text();
  653. pop_up = popularity_another.find('svg.ipc-icon--arrow-drop-up').length > 0;
  654. } else {
  655. let pop_text_match = popularity_another.text().match(/(\d+)\n.+?(\d+)/i);
  656. if (pop_text_match && pop_text_match.length >= 3) {
  657. pop_score = pop_text_match[1];
  658. pop_delta = pop_text_match[2];
  659. pop_up = popularity_another.find('span.popularityImageUp').length > 0;
  660. }
  661. }
  662.  
  663. if (pop_score) {
  664. update_rating_more({
  665. name: '流行度',
  666. link: imdb_link + 'criticreviews?ref_=tt_ov_rt',
  667. data: `${pop_score} (${pop_up ? '∧' : '∨'}${pop_delta})`
  668. });
  669. }
  670. }
  671.  
  672. // TODO let reviews;
  673.  
  674. // 从网页中获取的部分信息,要区分是否新版页面
  675. if (GM_getValue("enable_imdb_ext_info", true)) {
  676. if (is_new) {
  677. if ($("li.ipc-metadata-list__item.fJEELB:contains('Budget')", doc).length > 0) {
  678. update_rating_more({
  679. name: '总成本',
  680. data: $("li.ipc-metadata-list__item.fJEELB:contains('Budget')", doc).text().replace(/^Budget/, '').replace(/\(estimated\)/, '')
  681. });
  682. }
  683. if ($("li.ipc-metadata-list__item.fJEELB:contains('Opening weekend US & Canada')", doc).length > 0) {
  684. update_rating_more({
  685. name: '美首周',
  686. data: $("li.ipc-metadata-list__item.fJEELB:contains('Opening weekend US & Canada')", doc).text().replace(/^Opening weekend US & Canada/, '').replace(/[a-zA-Z]+ \d+, \d+$/, '')
  687. });
  688. }
  689. if ($("li.ipc-metadata-list__item.fJEELB:contains('Gross US & Canada')", doc).length > 0) {
  690. update_rating_more({
  691. name: '美票房',
  692. data: $("li.ipc-metadata-list__item.fJEELB:contains('Gross US & Canada')", doc).text().replace(/^Gross US & Canada/, '')
  693. });
  694. }
  695. if ($("li.ipc-metadata-list__item.fJEELB:contains('Gross worldwide')", doc).length > 0) {
  696. update_rating_more({
  697. name: '总票房',
  698. data: $("li.ipc-metadata-list__item.fJEELB:contains('Gross worldwide')", doc).text().replace(/^Gross worldwide/, '')
  699. });
  700. }
  701. if ($("li.ipc-metadata-list__item:contains('Aspect ratio')", doc).length > 0) {
  702. update_rating_more({
  703. name: '宽高比',
  704. data: $("li.ipc-metadata-list__item:contains('Aspect ratio')", doc).text().replace(/^Aspect ratio/, '')
  705. });
  706. }
  707. } else { // 旧版代码
  708. if ($("div.txt-block:contains('Budget:')", doc).length > 0) {
  709. update_rating_more({
  710. name: '总成本',
  711. data: $("div.txt-block:contains('Budget:')", doc).text().trim().replace(/\n/g, '').replace(/ .*$/, '').replace(/^Budget:/, '').replace(/CNY./, '¥').replace(/KRW./, '₩').replace(/JPY./, '円').replace(/HKD./, '港')
  712. });
  713. }
  714. if ($("div.txt-block:contains('Opening Weekend:'):not(:contains('USA:'))", doc).text().length > 0) {
  715. update_rating_more({
  716. name: '本首周',
  717. data: $("div.txt-block:contains('Opening Weekend:'):not(:contains('USA:'))", doc).text().trim().replace(/\n/g, '').replace(/^Opening Weekend:/, '').replace(/ \(.*$/, '').replace(/CNY./, '¥').replace(/KRW./, '₩').replace(/JPY./, '円').replace(/HKD./, '港')
  718. });
  719. }
  720. if ($("div.txt-block:contains('Opening Weekend USA:')", doc).text().length > 0) {
  721. update_rating_more({
  722. name: '美首周',
  723. data: $("div.txt-block:contains('Opening Weekend USA:')", doc).text().trim().replace(/\n/g, '').replace(/^Opening Weekend USA:/, '').replace(/,\d+ .*$/, '')
  724. });
  725. }
  726. if ($("div.txt-block:contains('Gross USA:')", doc).text().length > 0) {
  727. update_rating_more({
  728. name: '美票房',
  729. data: $("div.txt-block:contains('Gross USA:')", doc).text().trim().replace(/\n/g, '').replace(/^Gross USA:/, '').replace(/\, \d+ .*$/, '')
  730. });
  731. }
  732. if ($("div.txt-block:contains('Cumulative Worldwide Gross:')", doc).text().length > 0) {
  733. update_rating_more({
  734. name: '总票房',
  735. data: $("div.txt-block:contains('Cumulative Worldwide Gross:')", doc).text().trim().replace(/\n/g, '').replace(/^Cumulative Worldwide Gross:/, '').replace(/\, \d+ .*$/, '')
  736. });
  737. }
  738. if ($("div.txt-block:contains('Aspect Ratio:')", doc).text().length > 0) {
  739. update_rating_more({
  740. name: '宽高比',
  741. link: imdb_link + 'technical?ref_=tt_dt_spec',
  742. data: $("div.txt-block:contains('Aspect Ratio:')", doc).text().trim().replace(/\n/g, '').replace(/^Aspect Ratio:/, '')
  743. });
  744. }
  745. }
  746. }
  747. } catch (e) {
  748. // throw e;
  749. };
  750.  
  751. if (GM_getValue("enable_tomato_rate", true)) { //烂番茄评分显示功能
  752. // 添加烂番茄区块
  753. let movieTitle = ld_json_imdb['name'].trim();
  754. let rottURL = 'https://www.rottentomatoes.com/m/' + movieTitle.replace(/:|-/, "").replace(/\s+/g, "_").replace(/\W+/g, "").replace(/_+/g, "_").toLowerCase();
  755. getDoc(rottURL, null, function (rotdoc) {
  756. $('#interest_sectl div.rating_rott').html(`<span class="rating_logo ll">烂番茄评分</span><br><div id="rottValue" class="rating_self clearfix"></div></div>`).show();
  757. if ($('script#score-details-json', rotdoc).length > 0) {
  758. let rottJson = JSON.parse($('#score-details-json', rotdoc).text());
  759. if (rottJson.modal && rottJson.modal.tomatometerScoreAll) {
  760. let tomatometerScoreAll = rottJson.modal.tomatometerScoreAll || {};
  761. let rating_rott_value = tomatometerScoreAll.score || 0;
  762. let fresh_rott_value = tomatometerScoreAll.likedCount || 0;
  763. let rotten_rott_value = tomatometerScoreAll.notLikedCount || 0;
  764. $('#interest_sectl .rating_rott #rottValue').append(`<strong class="ll rating_num"><a target="_blank" href="${rottURL}">${rating_rott_value}%</a></strong><div class="rating_right" style="line-height: 16px;"><span>鲜:&nbsp;&nbsp;${fresh_rott_value}</span><br><span>烂:&nbsp;&nbsp;${rotten_rott_value}</span></div>`);
  765. }
  766. }
  767. else {
  768. $('#interest_sectl div.rating_rott').append(`<br>手动搜索: <a target='_blank' href='${'https://www.rottentomatoes.com/search/?search=' + encodeURI(movieTitle)}'>${movieTitle}</a>`);
  769. }
  770. });
  771. }
  772. $("#loading_more_rate").hide();
  773. });
  774. }
  775.  
  776. if (GM_getValue("enable_blue_date", true)) { //蓝光发售日期显示功能
  777. let ywm = eng_title.replace(/[:,!\-]/g, "").replace(/ /g, '-');
  778. let blueURL = 'https://www.releases.com/p/' + ywm.toLowerCase() + '/blu-ray/';
  779. getDoc(blueURL, null, function (bluedoc) {
  780. let result_0 = $('span[title*="Blu-ray"][title*="release date"]:not(:contains("TBA")):first', bluedoc);
  781. if (result_0.length > 0) {
  782. let blueDate = new Date(result_0.text());
  783. update_rating_more({ // 这种写法可能会导致 蓝光发售日期显示顺序飘忽不定,不过没有太大关系
  784. name: '蓝光发售',
  785. link: blueURL,
  786. data: `${blueDate.getFullYear()}年${blueDate.getMonth() + 1}月${blueDate.getDate()}日`
  787. });
  788. }
  789. });
  790. }
  791.  
  792. if (GM_getValue("enable_anime_rate", true)) { //开启动漫评分显示功能
  793. // 如果是动漫,请求anydb的anidb、bgm、mal信息
  794. if (is_anime) {
  795. getJSON("https://anydb.depar.cc/anime/query?_cf_cache=1&douban=" + douban_id, function (data1) {
  796. let _anydb_html = "";
  797. if (data1.success) {
  798. let source_list = ["AniDB", "Bgm", "MAL"];
  799. for (let i = 0; i < source_list.length; i++) {
  800. let source = source_list[i];
  801. let _data = data1.matched[source.toLowerCase()];
  802. if (_data) {
  803. let _group = _data.rate.match(/([\d.]+?) \((\d+)\)/);
  804. let _rating = _group[1];
  805. let _vote = _group[2];
  806. _anydb_html += starBlock(source, _data.url, _rating, _vote);
  807. }
  808. }
  809. if (_anydb_html.trim().length > 0) {
  810. $('#interest_sectl > div.rating_anidb').html(_anydb_html).show();
  811. }
  812. }
  813. $("#loading_more_rate").hide();
  814. });
  815. }
  816. }
  817.  
  818. if (GM_getValue("enable_mediainfo_gen", false)) { // 请求豆瓣附属信息用于Mediainfo生成
  819. GM_xmlhttpRequest({
  820. method: 'GET',
  821. url: douban_link + 'awards/',
  822. headers: {
  823. 'Host': 'movie.douban.com',
  824. // 'Referer' : location.href,
  825. },
  826. onload: function (responseDetail) {
  827. if (responseDetail.status === 200) {
  828. let doc = page_parser(responseDetail.responseText);
  829. awards = $('#content>div>div.article', doc).html()
  830. .replace(/[ \n]/g, '')
  831. .replace(/<\/li><li>/g, '</li> <li>')
  832. .replace(/<\/a><span/g, '</a> <span')
  833. .replace(/<(div|ul)[^>]*>/g, '\n')
  834. .replace(/<[^>]+>/g, '')
  835. .replace(/&nbsp;/g, ' ')
  836. .replace(/ +\n/g, '\n')
  837. .trim();
  838. }
  839. }
  840. }); // 该影片的评奖信息
  841.  
  842. // 简介 (首先检查是不是有隐藏的,如果有,则直接使用隐藏span的内容作为简介,不然则用 span[property="v:summary"] 的内容)
  843. introduction = $('#link-report > span.all.hidden').length > 0 ? $('#link-report > span.all.hidden').text() : // 隐藏部分
  844. ($('[property="v:summary"]').length > 0 ? $('[property="v:summary"]').text() : '暂无相关剧情介绍');
  845. introduction = introduction.split('\n').map(function (a) { return a.trim() }).join('\n'); // 处理简介缩进
  846. // 导演,编剧,演员 (只能获取到显示的,没API丰富)
  847. let director_another = $('span > span:contains("导演")').parent('span'); // 往上回溯一级
  848. let writer_another = $('span > span:contains("编剧")').parent('span');
  849. let cast_another = $('span.actor');
  850. if (ld_json) { // 优先使用ld_json中内容,没有则做页面解析
  851. if (ld_json['director']) director = ld_json['director'].map(function (d) { return d['name'] }).join(' / ');
  852. if (ld_json['author']) writer = ld_json['author'].map(function (d) { return d['name'] }).join(' / ');
  853. if (ld_json['actor']) cast = ld_json['actor'].map(function (d) { return d['name'] }).join('\n');
  854. }
  855. if (typeof director == 'undefined' && director_another.length > 0) director = director_another.find('a[href^="/celebrity"]').map(function () { return $(this).text() }).get().join(' / ');
  856. if (typeof writer == 'undefined' && writer_another.length > 0) writer = writer_another.find('a[href^="/celebrity"]').map(function () { return $(this).text() }).get().join(' / ');
  857. if (typeof cast == 'undefined' && cast_another.length > 0) cast = cast_another.find('a[href^="/celebrity"]').map(function () { return $(this).text() }).get().join('\n');
  858.  
  859. // 标签
  860. let tag_another = $('div.tags-body > a[href^="/tag"]');
  861. if (tag_another.length > 0) tags = tag_another.map(function () { return $(this).text() }).get().join(' | ');
  862. }
  863.  
  864. // 资源名称
  865. let zwzy = (unititle.replace(/ /g, ".").replace(":", ".").replace(/\.\./g, ".") + "." + eng_title.replace(": ", ".").replace(/ /g, ".") + "." + year.replace(/ /, "")).replace(/\.{2,}/g, ".");
  866. let imdbzy = has_imdb ? "." + imdb_id : "";
  867. $("div#info").append(`<br><span class=\"pl\">资源名称: </span>${zwzy}${imdbzy}`);
  868.  
  869. let neizhan = has_imdb ? imdb_id : ('/subject/' + douban_id); // PT内站 智能判定是用IMDB ID还是豆瓣ID
  870. let gongwang = has_imdb ? imdb_id : douban_id;
  871. let jingzhun = has_imdb ? imdb_id : ywm;
  872. let dbzw = has_imdb ? imdb_id : unititle + nian;
  873. let unit3d = has_imdb ? "imdb=" + imdb_id.slice(2) : "search=" + ywm;
  874. let movieright = is_movie ? "movies" : "tv-shows";
  875.  
  876. if (_version === "完整版") {
  877. let npid = has_imdb ? ('imdb=' + imdb_id) : ('douban=' + douban_id); // NPUBITS 智能判定是用IMDB ID还是豆瓣ID
  878. let ttgid = has_imdb ? ('IMDB' + imdb_id.slice(2)) : zwm; // TTG 智能判定是用IMDB ID还是中文名
  879. let ptfriend = has_imdb ? (imdb_id + '&search_area=4') : (douban_id + '&search_area=5'); // PT之友 智能判定是用IMDB ID还是豆瓣ID
  880. let zxid = has_imdb ? imdb_id : zwm; // ZX 智能判定是用IMDB ID还是中文名
  881. let monid = has_imdb ? ('imdbId=' + imdb_id) : ('name=' + zwm); // MONIKA智能判定是IMDB ID还是中文名
  882. let spid = has_imdb ? (imdb_id + '&search_area=4') : (unititle + '&search_area=0'); // Spring、天空、馒头 智能判定是用IMDB ID还是中文名
  883. let leid = has_imdb ? (imdb_id + '&search_area=imdb') : (douban_id + '&search_area=douban'); // Lemon 智能判定是用IMDB ID还是豆瓣ID
  884. site_map.push({
  885. name: "20万+种PT内站",
  886. label: [
  887. { name: "HDSky", link: 'https://hdsky.me/torrents.php?incldead=1&notnewword=1&search=' + spid, },
  888. { name: "MTeam", link: 'https://kp.m-team.cc/torrents.php?incldead=1&notnewword=1&search=' + spid, },
  889. { name: "PT之友", link: 'https://pterclub.com/torrents.php?incldead=1&notnewword=1&search=' + ptfriend, selector: "table.torrents table.torrentname" },
  890. { name: "TTG", link: 'https://totheglory.im/browse.php?c=M&notnewword=1&search_field=' + ttgid, selector: "table#torrent_table:last > tbody > tr:gt(0)" },
  891. ]
  892. });
  893. site_map.push({
  894. name: "10万+种PT内站",
  895. label: [
  896. { name: "Audience", link: 'https://audiences.me/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  897. { name: "BTSchool", link: 'http://pt.btschool.club/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan,/* selector: "table.torrents:last > tbody > tr:gt(0)"}, */ },
  898. { name: "CHDBits", link: 'https://chdbits.co/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  899. { name: "HDChina", link: 'https://hdchina.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrent_list:last > tbody > tr:gt(0)" },
  900. { name: "HDHome", link: 'https://hdhome.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  901. { name: "OurBits", link: 'https://ourbits.club/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  902. { name: "PTHOME", link: 'https://www.pthome.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  903. { name: "SJTU", link: 'https://pt.sjtu.edu.cn/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrents:last > tbody > tr" },
  904. { name: "TJUPT", link: 'https://www.tjupt.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrents table.torrentname" },
  905. ]
  906. });
  907. site_map.push({
  908. name: "5万+种PT内站",
  909. label: [
  910. { name: "HDArea", link: 'https://www.hdarea.co/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrents table.torrentname", selector_need_login: "h1 span:contains('Checking your browser before accessing')" },
  911. { name: "HDDolby", link: 'https://www.hddolby.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  912. { name: "HDTime", link: 'https://hdtime.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  913. { name: "Spring", link: 'https://springsunday.net/torrents.php?incldead=1&notnewword=1&search=' + spid, },
  914. { name: "红叶", link: 'http://leaves.red/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  915. { name: "聆音Club", link: 'https://pt.soulvoice.club/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  916. ]
  917. });
  918. site_map.push({
  919. name: "2万+种PT内站",
  920. label: [
  921. { name: "CarPT", link: 'https://carpt.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  922. { name: "DiscFan", link: 'http://discfan.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  923. { name: "GHTT", link: 'https://www.hitpt.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrents table.torrentname" },
  924. { name: "GPW", link: 'https://greatposterwall.com/torrents.php?searchstr=' + unititle, selector: ".TableTorrent-movieInfoBody .TableTorrent-movieInfoTitle" },
  925. { name: "HD4FANS", link: 'https://pt.hd4fans.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  926. { name: "HDAtmos", link: 'https://hdatmos.club/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  927. { name: "HDFans", link: 'https://hdfans.org/torrents.php?incldead=1&search_area=1&newword=1&search=' + neizhan, },
  928. { name: "HDU", link: 'http://pt.upxin.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  929. { name: "HHCLUB", link: 'https://hhanclub.top/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  930. { name: "NYPT", link: 'https://nanyangpt.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrents:last > tbody > tr" },
  931. { name: "PT时间", link: 'https://www.pttime.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  932. { name: "TCCF", link: 'https://et8.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  933. { name: "TLFBits", link: 'http://pt.eastgame.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  934. { name: "海胆之家", link: 'https://www.haidan.video/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "div.name_col.table_cell" },
  935. { name: "明教", link: 'https://hdpt.xyz/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  936. { name: "烧包乐园", link: 'https://ptsbao.club/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  937. ]
  938. });
  939. site_map.push({
  940. name: "1万+种PT内站",
  941. label: [
  942. { name: "52PT", link: 'https://52pt.site/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan,/* selector: "table.torrents:last > tbody > tr:gt(0)"}, */ },
  943. { name: "FRDS", link: 'https://pt.keepfrds.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "table.torrents table.torrentname" },
  944. { name: "JoyHD", link: 'https://www.joyhd.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "tr table.torrentname" },
  945. { name: "Hares", link: 'https://club.hares.top/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, selector: "div.layui-torrents-title" },
  946. { name: "HDCity", link: 'https://hdcity.city/pt?incldead=1&search_area=1&notnewword=1&iwannaseethis=' + neizhan, selector: "center > div > div > div.text" },
  947. { name: "HDVIDEO", link: 'https://hdvideo.one/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  948. { name: "HDZone", link: 'http://hdzone.me/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  949. { name: "龙之家", link: 'https://www.dragonhd.xyz/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  950. { name: "小蚂蚁", link: 'http://hdmayi.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  951. { name: "壹PT吧", link: 'https://1ptba.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  952. ]
  953. });
  954. site_map.push({
  955. name: "5千+种PT内站",
  956. label: [
  957. // { name: "HDAI", method: "post", link: 'http://www.hd.ai/Torrents.index?keyword=' + unititle, ajax:'http://www.hd.ai/Torrents.tableList', data:`{"keyword":"${unititle}"}`, headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }, selector: 'data.length > 0' },
  958. { name: "3Wmg", link: 'https://www.3wmg.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  959. { name: "BeiTai", link: 'http://www.beitai.pt/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan,/* selector: "table.torrents:last > tbody > tr:gt(0)"}, */ },
  960. { name: "FreeFarm", link: 'https://pt.0ff.cc/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  961. { name: "OshenPT", link: 'http://www.oshen.win/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  962. { name: "UBits", link: 'https://ubits.club/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  963. { name: "WinSaku", link: 'https://wintersakura.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  964. { name: "ZmPT", link: 'https://zmpt.cc/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  965. { name: "铂金学院", link: 'https://ptchina.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  966. { name: "海棠PT", link: 'https://www.htpt.cc/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  967. ]
  968. });
  969. site_map.push({
  970. name: "1千+种内站",
  971. label: [
  972. { name: "ICC", link: 'https://www.icc2022.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  973. { name: "OKPT", link: 'https://www.okpt.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  974. { name: "PT分享站", link: 'https://pt.itzmx.com/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  975. { name: "UltraHD", link: 'https://ultrahd.net/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  976. { name: "库非", link: 'https://kufei.org/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  977. ]
  978. });
  979. if (is_anime) {
  980. site_map.push({
  981. name: "PT动漫游戏",
  982. label: [
  983. { name: "AB", link: 'https://animebytes.tv/torrents.php?searchstr=' + ywm, selector: "div.thin > div.group_cont" },
  984. { name: "BakaBT", link: 'https://bakabt.me/browse.php?q=' + ywm, selector: "table.torrents > tbody > tr:gt(0)", selector_need_login: "#loginForm" },
  985. { name: "CC", link: 'http://www.cartoonchaos.org/index.php?page=torrents&options=0&active=1&search=' + ywm, selector: "table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > table > tbody > tr:gt(0)", selector_need_login: "table[style='border-color:#E70000']" },
  986. { name: "MONIKA", link: 'https://monikadesign.uk/torrents?' + monid, selector: "td.torrent-listings-overview" },
  987. { name: "SkySnow", link: 'https://skyeysnow.com/forum.php?mod=torrents&notnewword=1&search=' + unititle + nian, selector: "table.torrents > tbody > tr:gt(0)" },
  988. { name: "U2", link: 'https://u2.dmhy.org/torrents.php?incldead=1&search_area=0&notnewword=1&search=' + this_title, },
  989. ]
  990. });
  991. }
  992. site_map.push({
  993. name: "PT影视IPV6",
  994. label: [
  995. { name: "6V", method: "POST", link: 'http://bt.neu6.edu.cn/search.php?mod=forum', selector: '#threadlist > table > tbody > tr:gt(0)', data: `srchtxt=${gunititle}&srchfilter=all&srchfrom=0&before=0&orderby=lastpost&ascdesc=desc&srchfid[]=all&searchsubmit=yes`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, csrf: { name: "formhash", update: "data" } },
  996. { name: "BYRBT", link: 'https://bt.byr.cn/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  997. { name: "HUDBT", link: 'https://hudbt.hust.edu.cn/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  998. { name: "NPUBITS", link: 'https://npupt.com/torrents.php?incldead=1&search_area=1&notnewword=1&' + npid, selector: "#torrents_table > tbody > tr:gt(0)" },
  999. { name: "NWSUAF", link: 'https://pt.nwsuaf6.edu.cn/torrents.php?incldead=1&search_area=1&notnewword=1&search=' + neizhan, },
  1000. { name: "PT江湖", method: "POST", link: 'http://www.dutpt.com/search.php?mod=forum', selector: '#threadlist li.pbw', data: `srchtxt=${unititle}&searchsubmit=yes`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, csrf: { name: "formhash", update: "data" }, selector_need_login: "#messagetext" },
  1001. { name: "ZX", link: 'http://pt.zhixing.bjtu.edu.cn/search/x' + zxid + '/', selector: "table.torrenttable > tbody > tr:gt(1)" },
  1002. ]
  1003. });
  1004. site_map.push({
  1005. name: "PT影视原声",
  1006. label: [
  1007. { name: "DicMusic", link: 'https://dicmusic.club/torrents.php?notnewword=1&searchstr=' + unititle, selector: "td.td_info.big_info" },
  1008. { name: "OpenCD", link: 'https://open.cd/torrents.php?incldead=1&search_area=0&notnewword=1&search=' + unititle, selector: "table.torrents:last > tbody > tr:gt(0)" },
  1009. { name: "JPOP", link: 'https://jpopsuki.eu/torrents.php?searchstr=' + eng_title, selector: "#torrent_table > tbody > tr:gt(0)" },
  1010. { name: "Red", link: 'https://redacted.ch/torrents.php?searchstr=' + eng_title, selector: "tr.group_torrent.edition_1" },
  1011. ]
  1012. });
  1013. site_map.push({
  1014. name: "PT影视外站",
  1015. label: [
  1016. { name: "AR", link: 'https://alpharatio.cc/torrents.php?searchstr=' + ywm, selector: "#torrent_table > tbody > tr:gt(0)" },
  1017. { name: "AHD", link: 'https://awesome-hd.me/torrents.php?id=' + imdb_id, selector: ".torrent_table", selector_need_login: "#loginform" },
  1018. { name: "AsiaCine", link: 'https://asiancinema.me/filterTorrents?' + unit3d, selector: "div.table-responsive a.view-torrent" },
  1019. { name: "BHD", link: 'https://beyond-hd.me/browse.php?incldead=0&search=' + imdb_id, selector: "table.tb_detail.grey.torrenttable:last > tbody > tr:gt(0)" },
  1020. { name: "Classix", link: 'http://classix-unlimited.co.uk/torrents-search.php?incldead=0&search=' + eng_title, selector: "table.ttable_headinner tr.t-row" },
  1021. { name: "FileList", link: 'https://filelist.ro/browse.php?searchin=3&search=' + imdb_id, selector: "div.torrentrow a[data-html='true']" },
  1022. { name: "HDB", link: 'https://hdbits.org/browse.php?&imdb=' + imdb_id, selector: "#torrent-list", selector_need_login: "a[href='/recover.php']" },
  1023. { name: "HDF", link: 'https://hdf.world/torrents.php?searchstr=' + ywm, selector: "#torrent_table > tbody > tr:gt(0)" },
  1024. { name: "HDME", link: 'http://hdme.eu/browse.php?incldead=1&blah=1&search=' + imdb_id, selector: "table:nth-child(13) > tbody > tr" },
  1025. { name: "HDMonkey", link: 'https://hdmonkey.org/torrents-search.php?incldead=0&search=' + ywm, selector: "table.ttable_headinner > tbody > tr:gt(0)" },
  1026. { name: "HDS", link: 'https://hd-space.org/index.php?page=torrents&active=1&options=2&search=' + imdb_id, selector: "table.lista:last > tbody > tr:gt(0)", selector_need_login: "form[name='login']" },
  1027. { name: "HDT", link: 'https://hd-torrents.org/torrents.php?active=1&options=2&search=' + imdb_id, selector: "table.mainblockcontenttt b", selector_need_login: "form[name='login']" },
  1028. { name: "IPT", link: 'https://iptorrents.com/t?qf=all&q=' + imdb_id, selector: "#torrents td.ac" },
  1029. { name: "MTV", link: 'https://www.morethan.tv/torrents.php?searchstr=' + eng_title_clean, selector: "table.torrent_table > tbody > tr:gt(0)" },
  1030. { name: "PTF", link: 'http://ptfiles.net/browse.php?incldead=0&title=0&search=' + ywm, selector: "#tortable > tbody > tr.rowhead:gt(0)" },
  1031. { name: "PTP", link: 'https://passthepopcorn.me/torrents.php?searchstr=' + imdb_id, selector: '#torrent-table tr.group_torrent.group_torrent_header:gt(0)', selector_need_login: "#loginform" },
  1032. { name: "RTF", link: 'https://retroflix.club/torrents1.php?incldead=1&spstate=0&inclbookmarked=0&search_area=4&search_mode=0&search=' + imdb_id, selector: "td table.torrentname" },
  1033. { name: "SC", link: 'https://secret-cinema.pw/torrents.php?cataloguenumber=' + imdb_id, selector: "div.torrent_card" },
  1034. { name: "SDB", link: 'http://sdbits.org/browse.php?incldead=0&imdb=' + imdb_id, selector: "#torrent-list tr.light" },
  1035. { name: "Speed", link: 'https://speed.cd/browse.php?d=on&search=' + imdb_id, selector: "div.boxContent > table:first >tbody > tr:gt(0)" },
  1036. { name: "TD", link: 'https://www.torrentday.com/t?q=' + imdb_id, selector: "#torrentTable td.torrentNameInfo" },
  1037. { name: "TS", link: 'https://www.torrentseeds.org/browse.php?searchin=title&incldead=0&search=%22' + eng_title + year + '%22', selector: "table.table.table-bordered > tbody > tr.browse_color:gt(0)" },
  1038. { name: "TT", link: 'https://revolutiontt.me/browse.php?search=' + imdb_id, selector: "table#torrents-table > tbody > tr:gt(0)" },
  1039. { name: "TL", type: "json", link: "https://www.torrentleech.org/torrents/browse/index/query/" + eng_title + nian, ajax: "https://www.torrentleech.org/torrents/browse/list/query/" + eng_title + year, selector: "numFound > 0" },
  1040. { name: "UHD", link: 'https://uhdbits.org/torrents.php?searchstr=' + imdb_id, selector: "table.torrent_table > tbody > tr.group" },
  1041. ]
  1042. });
  1043. if (is_india || is_pakistan) {
  1044. site_map.push({
  1045. name: "PT印度电影站",
  1046. label: [
  1047. { name: "BwT", link: "https://bwtorrents.tv/index.php?blah=0&cat=0&incldead=1&search=" + ywm, selector: "table.pager + table tr.browse" },
  1048. { name: "Hon3yHD", link: "https://hon3yhd.com/browse.php?searchin=title&incldead=0&search=" + eng_title, selector: "table tr.tt" },
  1049. { name: 'Desitor', method: "post", type: "json", link: 'https://desitorrents.tv/#search_' + ywm, ajax: 'https://desitorrents.tv/ajax.php?action=search_torrent_cats', data: `selected_group=&search_username=&selected_sorting=relevance&search_string=${ywm}`, headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }, selector: 'torrent_html.length > 0' },
  1050. ]
  1051. });
  1052. }
  1053. }
  1054.  
  1055. if (_version === "完整版" && has_imdb) {
  1056. site_map.push({
  1057. name: "NZB终身影视",
  1058. label: [
  1059. { name: "altHUB", link: 'https://althub.co.za/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "#modalLogin" },
  1060. { name: "Crawler", link: 'https://www.usenet-crawler.com/advsearch?searchadvr=' + ywm, selector: "#browsetable a.title", selector_need_login: "#modalLogin" },
  1061. { name: "Miatrix", link: 'https://www.miatrix.com/search/' + ywm, selector: "#browsetable > tbody > tr:gt(0)", selector_need_login: "form[action='login']" },
  1062. { name: "Ninja", link: 'http://ninjacentral.co.za/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "form[action='login']" },
  1063. { name: "NZBCat", link: 'https://nzb.cat/search/' + ywm, selector: "#browsetable > tbody > tr:gt(0)", selector_need_login: "form[action='login']" },
  1064. { name: "NZBgeek", link: 'https://nzbgeek.info/geekseek.php?movieid=' + imdb_id.slice(2), selector: "table > tbody > tr.HighlightTVRow2:gt(0)", selector_need_login: "input[value='do_login']" },
  1065. { name: "NZBGrab", link: 'https://www.nzbgrabit.xyz/nzbsearch.php?query=' + imdb_id, selector: "h3.threadtitle", selector_need_login: "form[action='login.php?do=login']" },
  1066. { name: "NZBP", link: 'https://nzbplanet.net/search/' + ywm, selector: "#browsetable > tbody > tr:gt(0)", selector_need_login: "form[action='login']" },
  1067. { name: "NZBs2GO", link: 'https://nzbs2go.com/search?id=' + ywm, selector: "#browsetable > tbody > tr:gt(0)", selector_need_login: "form[action='login']" },
  1068. { name: "Oznzb", link: 'https://www.oznzb.com/search/' + ywm, selector: "#browsetable > tbody > tr.ratingReportContainer:gt(0)", selector_need_login: "#login" },
  1069. { name: "SNZB", link: 'https://simplynzbs.com/search/' + ywm, selector: "#browsetable > tbody > tr:gt(0)", selector_need_login: "form[action='login']" },
  1070. ]
  1071. });
  1072. site_map.push({
  1073. name: "NZB年费影视",
  1074. label: [
  1075. { name: "abNZB", link: 'https://www.abnzb.com/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "#modalLogin" },
  1076. { name: "DOGnzb", link: 'https://dognzb.cr/search?q=' + ywm, selector: "tr.odd a.link", selector_need_login: "#login" },
  1077. { name: "NZBFind", link: 'https://nzbfinder.ws/search?id=' + ywm, selector: "td.check + td a", selector_need_login: "div.account-form" },
  1078. { name: "NZBNDX", link: 'https://nzbndx.com/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "#modalLogin" },
  1079. { name: "NzbNoob", link: 'https://nzbnoob.com/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "#modalLogin" },
  1080. { name: "NZBSU", link: 'https://nzb.su/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "#modalLogin" },
  1081. ]
  1082. });
  1083. site_map.push({
  1084. name: "NZB免费影视",
  1085. label: [
  1086. { name: "BiNZB", link: 'http://binzb.com/search?q=' + ywm, selector: ".list td .groups" },
  1087. { name: "Bsearch", link: 'http://binsearch.info/?q=' + ywm, selector: "td span.s" },
  1088. { name: "FindNZB", link: 'https://findnzb.net/?q=' + ywm, selector: ".results .big" },
  1089. { name: "FreeNZBs", link: 'https://freenzbs.com/?search%5Btree%5D=cat0_z0_a0&sortdir=ASC&sortby=&search%5Bvalue%5D%5B%5D=Title%3A%3D%3ADEF%3A' + eng_title_clean, selector: "#spots td.title" },
  1090. { name: "NewzNab", link: 'https://newz69.keagaming.com/search/' + ywm, selector: "#browsetable a.title", selector_need_login: "form[action='login']" },
  1091. { name: "NZBStar", link: 'https://nzbstars.com/?search%5Btree%5D=cat0_z0_a0&sortdir=ASC&sortby=&search%5Bvalue%5D%5B%5D=Title%3A%3D%3ADEF%3A' + eng_title_clean, selector: "#spots td.title" },
  1092. { name: "NZBXS", link: 'https://www.nzbxs.com/?search%5Btree%5D=cat0_z0_a0&sortdir=ASC&sortby=&search%5Bvalue%5D%5B%5D=Title%3A%3D%3ADEF%3A' + eng_title_clean, selector: "#spots td.title" },
  1093. { name: "SpotNZB", link: 'https://spotnzb.xyz/?search%5Btree%5D=cat0_z0_a0&sortdir=ASC&sortby=&search%5Bvalue%5D%5B%5D=Title%3A%3D%3ADEF%3A' + eng_title_clean, selector: "#spots td.title" },
  1094. ]
  1095. });
  1096. site_map.push({
  1097. name: "终生会员论坛",
  1098. label: [
  1099. { name: "古哥论坛", link: 'http://www.gudage.cc/search.php?mod=forum&searchsubmit=yes&srchtxt=' + gunititle, selector: "div.tl li.pbw" },
  1100. { name: "抱书吧", link: 'http://www.baoshu8.com/searcher.php?type=thread&keyword=' + gunititle, selector: "div.dlA dl" },
  1101. { name: "国配影迷", link: 'https://club.ccmnn.com/search.php?mod=forum&searchsubmit=yes&srchtxt=' + gunititle, selector: "div.tl li.pbw" },
  1102. { name: "慢慢游影", link: 'https://www.mmybt.com/search.php?mod=forum&searchsubmit=yes&srchtxt=' + unititle, selector: "div.tl li.pbw", selector_need_login: "#messagelogin" },
  1103. { name: "盘乐网影", link: 'http://www.haopanyou.com/search.php?mod=forum&searchsubmit=yes&srchtxt=' + unititle, selector: "div.tl li.pbw", selector_need_login: "#ls_username" },
  1104. { name: "印度电影", link: 'http://www.indmi.com/search.php?mod=forum&searchsubmit=yes&srchtxt=' + unititle, selector: "div.tl li.pbw" },
  1105. { name: "云中漫步", link: 'https://www.yunzmb.com/search.php?mod=forum&searchsubmit=yes&srchtxt=' + gunititle, selector: "div.tl li.pbw" },
  1106. ]
  1107. });
  1108. site_map.push({
  1109. name: "影视论坛资源",
  1110. label: [
  1111. { name: "网盘分享吧", link: 'http://www.wpfx8.com/search.php?mod=forum&searchsubmit=yes&srchtxt=' + unititle, selector: "div.tl li.pbw", selector_need_login: "#messagelogin" },
  1112. { name: "深影论坛", link: 'http://forum.shinybbs.vip/search.php?mod=forum&searchsubmit=yes&srchtxt=' + gunititle, selector: "div.tl li.pbw", selector_need_login: "#messagelogin" },
  1113. ]
  1114. });
  1115.  
  1116. if (_version === "完整版" && (!(is_mandarine) || (is_mandarine && is_otherlan))) {
  1117. site_map.push({
  1118. name: "PT影视字幕",
  1119. label: [
  1120. { name: "BTSchool®", link: 'http://pt.btschool.club/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1121. { name: "BeiTai®", link: "https://www.beitai.pt/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1122. { name: "CHDBits®", link: "https://chdbits.co/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table:last > tbody > tr:gt(1)" },
  1123. { name: "FRDS®", link: "http://pt.keepfrds.com/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1124. { name: "GHTT®", link: 'https://www.hitpt.com/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1125. { name: "Hares®", link: 'https://club.hares.top/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table:last > tbody > tr:gt(1)" },
  1126. { name: "HD4FANS®", link: 'https://pt.hd4fans.org/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1127. { name: "HDArea®", link: 'https://www.hdarea.co/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)", selector_need_login: "h1 span:contains('Checking your browser before accessing')" },
  1128. { name: "HDAtmos®", link: 'https://hdatmos.club/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1129. { name: "HDChina®", link: "https://hdchina.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table.uploaded_sub_list > tbody > tr:gt(1)" },
  1130. { name: "HDCity®", link: "https://hdcity.city/subtitles?notnewword=1&search=" + ptzimu, selector: "center > div:nth-child(1) > table > tbody > tr:nth-child(2)" },
  1131. { name: "HDHome®", link: "https://hdhome.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table:last > tbody > tr:gt(1)" },
  1132. { name: "HDSky®", link: "https://hdsky.me/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table:last > tbody > tr:gt(1)" },
  1133. { name: "HDTime®", link: "https://hdtime.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='100%'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr" },
  1134. { name: "HDU®", link: "http://pt.upxin.net/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1135. { name: "JoyHD®", link: "https://www.joyhd.net/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1136. { name: "MTeam®", link: "https://kp.m-team.cc/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table.table-subtitle-list:last > tbody > tr" },
  1137. //{ name: "NPUBITS®", link: "https://npupt.com/subtitles.php?notnewword=1&search=" + ptzimu, selector: "#main > table > tbody > tr:nth-child(2)" },
  1138. { name: "NYPT®", link: "https://nanyangpt.com/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1139. { name: "OurBits®", link: "https://ourbits.club/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1140. { name: "PTHOME®", link: 'https://www.pthome.net/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1141. { name: "PT之友®", link: 'https://pterclub.com/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1142. { name: "SJTU®", link: "https://pt.sjtu.edu.cn/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1143. { name: "Spring®", link: 'https://springsunday.net/subtitles.php?notnewword=1&search=' + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1144. { name: "TCCF®", link: "https://et8.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1145. { name: "TJUPT®", link: "https://www.tjupt.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1146. { name: "TLFBits®", link: "http://pt.eastgame.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1147. { name: "U2®", link: "https://u2.dmhy.org/subtitles.php?notnewword=1&search=" + ptzimu, selector: "table[width='940'][border='1'][cellspacing='0'][cellpadding='5'] > tbody > tr:nth-child(2)" },
  1148. ]
  1149. });
  1150. }
  1151. }
  1152.  
  1153. site_map.push({
  1154. name: "影视精准匹配",
  1155. label: [
  1156. { name: 'RARBG', link: 'https://rargb.to/search/?search=' + ywm,selector: 'table.lista2t tr.lista2' },
  1157. { name: 'TorGal', link: 'https://tgx.rs/torrents.php?search=' + jingzhun, selector: '#click' },
  1158. { name: 'Zooqle', link: 'https://zooqle.com/search?q=' + jingzhun, selector: 'div.panel-body a.small' },
  1159. { name: '比特大雄', link: 'https://www.btdx8.com/?s=' + unititle, selector: '#content div.post.clearfix' },
  1160. { name: '迅雷影天堂', link: 'https://www.xl720.com/?s=' + unititle, selector: '#content h3.entry-title' },
  1161. { name: '音范丝', link: 'http://www.yinfans.me/?s=' + unititle, selector: '#post_container div.article' },
  1162. { name: '中国高清网', link: 'https://www.cnmkv.com/?s=' + unititle, selector: 'main#main.site-main' },
  1163. ]
  1164. });
  1165. site_map.push({
  1166. name: "云盘资源搜索",
  1167. label: [
  1168. { name: 'T-REX', link: 'https://t-rex.tzfile.com/?s=' + unititle, selector: 'div.item-in' },
  1169. { name: '阿里小站', link: 'https://pan666.net/?q=' + unititle, selector: 'div.DiscussionList' },
  1170. { name: 'Pan58', link: 'http://www.pan58.com/s?wd=' + unititle, selector: 'div.filehdbox' },
  1171. { name: '云盘资源网', link: 'https://www.yunpanziyuan.xyz/fontsearch.htm?fontname=' + unititle, selector: '.media.thread.tap' },
  1172. ]
  1173. });
  1174. site_map.push({
  1175. name: "在线正版中文",
  1176. label: [
  1177. { name: '爱奇艺视频', link: 'https://so.iqiyi.com/so/q_' + unititle, selector: 'div.card-page_container__GJmOy' },
  1178. { name: '哔哩哔哩', link: 'https://search.bilibili.com/all?keyword=' + unititle, selector: 'div.media-card' },
  1179. { name: '乐视视频', link: 'http://so.le.com/s?wd=' + unititle, selector: `h1 > a.j-baidu-a[title*='${unititle}']` },
  1180. { name: '芒果TV', link: 'https://so.mgtv.com/so/k-' + unititle, selector: 'div.so-result-info.clearfix span.label' },
  1181. { name: '搜狐视频', link: 'https://so.tv.sohu.com/mts?wd=' + unititle, selector: 'div.wrap.cfix div.cfix.resource' },
  1182. { name: '腾讯视频', link: 'https://v.qq.com/x/search/?q=' + unititle, selector: 'div.wrapper_main div._infos' },
  1183. { name: '优酷视频', link: 'https://www.soku.com/nt/search/q_' + unititle, selector: 'div.s_dir' },
  1184. ]
  1185. });
  1186. site_map.push({
  1187. name: "在线正版英文",
  1188. label: [
  1189. { name: 'Amazon', link: 'https://instantwatcher.com/a/search?content_type=1+2&source=1+2+3&q=' + eng_title_clean, selector: `span.title a.title-link:contains(${eng_title_clean})` },
  1190. { name: 'Netflix', link: 'https://unogs.com/?q=' + eng_title_clean, ajax: 'https://flixable.com/?s=' + eng_title_clean, selector: ".card-header.card-header-image" },
  1191. ]
  1192. });
  1193. site_map.push({
  1194. name: "在线中文影视",
  1195. label: [
  1196. { name: '万佳影视', link: 'https://www.wjys.cc/vodsearch.html?wd=' + unititle, selector: 'div.module-items'},
  1197. { name: '剧迷', link: 'https://gimytw.cc/search?q=' + unititle, selector: 'div#content'},
  1198. { name: 'HDmoli', link: 'https://www.hdmoli.pro/search.php?searchword=' + unititle + '&submit=', selector: 'div.myui-panel-box.clearfix'},
  1199. ]
  1200. });
  1201. if (has_entitle) {
  1202. site_map.push({
  1203. name: "在线英文影视",
  1204. label: [
  1205. { name: 'UniStream', link: 'https://uniquestream.net/?s=' + eng_title_clean, selector: 'div.result-item div.details' },
  1206. ]
  1207. });
  1208. }
  1209. if (is_anime) {
  1210. site_map.push({
  1211. name: "在线动漫视频",
  1212. label: [
  1213. { name: '9ANIME', link: 'https://9anime.to/search?keyword=' + eng_title, selector: "div.film-list a.name" },
  1214. { name: '爱看番', link: 'http://www.ikanfan.com/search/?wd=' + unititle, selector: '#listvod div.d-info' },
  1215. ]
  1216. });
  1217. }
  1218. if (is_anime) {
  1219. site_map.push({
  1220. name: "动漫国内网站",
  1221. label: [
  1222. { name: 'ACG.RIP', link: 'https://acg.rip/?term=' + unititle, selector: 'tbody tr' },
  1223. { name: 'ACG搜', link: 'https://www.36dm.club/search.php?keyword=' + unititle, selector: 'tbody span.bts_1' },
  1224. { name: 'Mikan', link: 'https://mikanime.tv/Home/Search?searchstr=' + unititle, selector: 'table.table.table-striped.tbl-border.fadeIn a.magnet-link-wrap' },
  1225. { name: 'MioBT', link: 'http://www.miobt.com/search.php?keyword=' + unititle, selector: '#data_list tr[class*=alt]' },
  1226. { name: 'VCB-S', link: 'https://vcb-s.com/?s=' + unititle, selector: '#article-list div.title-article' },
  1227. { name: '爱恋动漫', link: 'http://www.kisssub.org/search.php?keyword=' + unititle, selector: '#data_list tr' },
  1228. { name: '动漫花园', link: 'https://share.dmhy.org/topics/list?keyword=' + unititle, selector: 'tbody span.btl_1' },
  1229. { name: '兜兜动漫网', link: 'http://www.doudoudm.com/Home/Index/search.html?searchText=' + unititle, selector: '#some_drama span.play_some' },
  1230. { name: '漫喵动漫', link: 'http://www.comicat.org/search.php?keyword=' + unititle, selector: '#data_list tr' },
  1231. { name: '漫相随', link: 'http://fodm.net/search.asp?searchword=' + gunititle, selector: 'div.page_content div.intro' },
  1232. { name: "萌番组", method: "post", type: "json", link: "https://bangumi.moe/search/title#search_" + unititle, ajax: "https://bangumi.moe/api/v2/torrent/search", data: `{"query":"${unititle}"}`, headers: { "Content-Type": "text/plain;charset=UTF-8" }, selector: "count > 0" },
  1233. { name: '末日动漫', link: 'https://share.acgnx.cc/search.php?sort_id=0&keyword=' + unititle, selector: 'tbody#data_list' },
  1234. { name: '魔法少女', link: 'https://www.mahou-shoujo.moe/?s=' + this_title, selector: '#main div.entry-summary' },
  1235. { name: '怡萱动漫', link: 'http://www.yxdm.tv/search.html?title=' + unititle, selector: 'div.main p.stars1' },
  1236. ]
  1237. });
  1238. }
  1239.  
  1240. if (is_anime && eng_title.trim().length > 0) {
  1241. site_map.push({
  1242. name: "动漫国外网站",
  1243. label: [
  1244. { name: 'AniDex', link: 'https://anidex.info/?q=' + eng_title, selector: 'div.table-responsive tr' },
  1245. { name: 'AniRena', link: 'https://www.anirena.com/?s=' + eng_title, selector: '#content table' },
  1246. { name: 'AniTosho', link: 'https://animetosho.org/search?q=' + eng_title, selector: '#content div.home_list_entry' },
  1247. { name: 'Nyaa', link: 'https://nyaa.si/?q=' + eng_title, selector: 'div.table-responsive tr.default' },
  1248. { name: 'ニャパンツ', link: 'https://nyaa.pantsu.cat/search?c=_&q=' + eng_title, selector: '#torrentListResults tr.torrent-info' },
  1249. { name: '东京図书馆', link: 'https://www.tokyotosho.info/search.php?terms=' + eng_title, selector: 'table.listing td.desc-top' },
  1250. ]
  1251. });
  1252. }
  1253. if (is_series && is_europe) {
  1254. site_map.push({
  1255. name: "欧美剧集下载",
  1256. label: [
  1257. { name: 'BT美剧', link: 'http://www.btmeiju.com/ustv_search.htm?title=' + unititle, selector: '#_container div.comm_box' },
  1258. { name: 'EZTV', link: 'https://eztv.ag/search/' + ywm.replace(/S\d+$/g, ''), selector: `td.forum_thread_post > a[title*='${ywm.replace(/S\d+$/g, '')}']` },
  1259. { name: 'KPPT', link: 'http://www.kppt.cc/search.php?q=' + unititle, selector: 'div.search span.SearchAlias' },
  1260. { name: '爱美剧', link: 'https://www.meiju22.com/search.php?searchword=' + unititle, selector: 'div.head h3' },
  1261. { name: '每日美剧', link: 'http://www.meirimeiju.com/search?words=' + unititle, selector: 'div.container div.movie-title' },
  1262. { name: '美剧迷', link: 'http://www.meijumi.vip/index.php?s=' + unititle + ' 下载', selector: `h2.entry-title > a:contains(${unititle})` },
  1263. { name: '美剧天堂', link: 'https://www.meijutt.tv/search/index.asp?searchword=' + gunititle, selector: 'div.list3_cn_box ul.list_20' },
  1264. { name: '人人影视', link: 'http://www.zmz2019.com/search?type=resource&keyword=' + unititle, selector: "div.search-result > ul > li" },
  1265. //{ name: '人人美剧', link: 'http://www.yyetss.com/Search/index/s_keys/' + unititle, selector: 'div.row div.col-xs-3' },
  1266. ]
  1267. });
  1268. }
  1269. if (is_series && is_japan && !is_anime) {
  1270. site_map.push({
  1271. name: "日剧资源下载",
  1272. label: [
  1273. { name: '91日剧', link: 'http://www.wwmulu.com/?s=' + unititle, selector: `h2.entry-title > a:contains(${unititle})` },
  1274. { name: "东京不够热", method: "post", link: "http://www.tokyonothot.com/search.php?mod=portal", data: `srchtxt=${gunititle}&searchsubmit=yes`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: "div.tl li.pbw" },
  1275. { name: '花译工坊', link: 'https://discuss.huayiwork.com/?q=' + unititle, ajax: "https://discuss.huayiwork.com/api/xun/discussions?include=page%5Blimit%5D=3&include=mostRelevantPost&filter%5Bq%5D=" + unititle, type: "json", selector: 'data.length > 0' },
  1276. { name: '心动日剧', link: 'http://www.doki8.com/?s=' + unititle, selector: `h2.post-box-title > a:contains(${unititle})` },
  1277. // { name: '隐社', link: 'http://www.hideystudio.com/drama/' + release_year + drama_season + '.html', selector: `td > span.titles:contains(${unititle})` },
  1278. // { name: '猪猪日部落', link: 'http://www.zzrbl.com/?s=' + unititle, selector: 'div.section_body li' },
  1279. { name: '追新番', method: "post", link: 'http://www.zhuixinfan.com/search.php?searchsubmit=yes', data: `mod=tvplay&formhash=453fc7da&srchtype=title&srhfid=0&srhlocality=main%3A%3Aindex&srchtxt=${unititle}&searchsubmit=true`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: '#wp td.td2' },
  1280. ]
  1281. });
  1282. }
  1283. if (is_series && is_korea && !is_anime) {
  1284. site_map.push({
  1285. name: "韩剧资源下载",
  1286. label: [
  1287. { name: '韩饭网', link: 'http://www.hanfan.cc/?s=下载 ' + unititle, selector: 'div.content p.meta' },
  1288. { name: '韩剧迷', link: 'http://www.aioio.cn/?s=下载 ' + unititle, selector: 'div.content p.meta' },
  1289. { name: '韩流韩剧网', link: 'http://www.hlhanju.com/index.php?s=vod-search-wd-' + unititle, selector: '#find-focus div.play-txt' },
  1290. { name: '韩迷', link: "http://www.hanmi520.com/search.php?mod=forum&searchsubmit=yes&srchtxt=" + unititle, selector: "div.tl li.pbw" },
  1291. ]
  1292. });
  1293. }
  1294. if (is_series && is_thai && !is_anime) {
  1295. site_map.push({
  1296. name: "泰剧资源下载",
  1297. label: [
  1298. { name: '97泰剧网', link: 'http://www.97taiju.com/index.php?s=vod-search&wd=' + unititle, selector: '#vodlist dd.title' },
  1299. { name: '泰剧资料馆', link: 'http://www.taijuzlg.com/?s=泰剧下载 ' + unititle, selector: '#main li.entry-title' },
  1300. ]
  1301. });
  1302. }
  1303. if (is_document) {
  1304. site_map.push({
  1305. name: "纪录片下载站",
  1306. label: [
  1307. { name: '盗火纪录片', link: 'http://www.daofire.com/search/titlesearch?keyword=' + unititle, selector: 'div.videos div.post_title' },
  1308. { name: '纪录片天地', link: 'https://www.bing.com/search?q=site%3Awww.jlpcn.net+intitle%3A' + unititle, selector: '#b_content div.b_title' },
  1309. { name: '熊猫盘纪录', link: 'http://xiongmaopan.com/search/' + unititle, selector: `h2 > a[title*='${unititle}']` },
  1310. ]
  1311. });
  1312. }
  1313. site_map.push({
  1314. name: "电影资源下载",
  1315. label: [
  1316. { name: 'Grab4K', link: 'https://grab4k.com/vod/search.html?wd=' + unititle, selector: 'div.module-list' },
  1317. { name: 'LOL电影', link: 'http://www.993dy.com/index.php?m=vod-search&wd=' + unititle, selector: '.movielist h5' },
  1318. { name: 'SOZMZ', link: 'https://v.dsb.ink/#/#search_' + unititle, ajax: "https://v.dsb.ink/getinfo.php?page=1&search=" + unititle, type: "json", selector: 'count > 0' },
  1319. { name: '修罗影视', link: 'https://v.xlys.ltd.ua/search/' + unititle, selector: 'a.search-movie-title', selector_need_login: ".alert.alert-success p:contains('需要输入验证码')" },
  1320. { name: '电影港', method: "post", link: 'https://www.dygang.cc/e/search/index.php', data: `tempid=1&tbname=article&keyboard=${gunititle}&show=title%2Csmalltext&Submit=%CB%D1%CB%F7`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: "table[width='100%'][border='0'][cellspacing='0'][cellpadding='0'] a.classlinkclass" },
  1321. { name: '电影天堂', method: "post", link: 'https://www.dytt8899.com/e/search/index.php', data: `show=title&keyboard=${gunititle}`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: 'b a.ulink' },
  1322. { name: '高清888', link: 'https://www.gaoqing888.com/search?kw=' + unititle, selector: 'div.wp-content div.video-row' },
  1323. { name: '迅雷影天堂', link: 'https://www.xl720.com/?s=' + unititle, selector: `h3 > a[title*='${unititle}']` },
  1324. ]
  1325. });
  1326.  
  1327. if (!(is_mandarine) || (is_mandarine && is_otherlan)) {
  1328. site_map.push({
  1329. name: "精准中文字幕",
  1330. label: [
  1331. { name: 'OpenSub', link: 'https://www.opensubtitles.org/zh/search/sublanguageid-chi,zht,zhe,eng/imdbid-' + imdb_id, selector: "#search_results tr.change", selector_need_login: "#recaptcha2" },
  1332. ]
  1333. });
  1334. }
  1335. if (!(is_mandarine) || (is_mandarine && is_otherlan)) {
  1336. site_map.push({
  1337. name: "中文影视字幕",
  1338. label: [
  1339. { name: 'Sub HD', link: 'https://subhd.tv/search/' + unititle, selector: ".position-relative .float-start" },
  1340. { name: '伪射手', link: 'http://assrt.net/sub/?searchword=' + unititle, selector: "#resultsdiv a.introtitle" },
  1341. { name: '字幕库', link: 'https://srtku.com/search?q=' + unititle + '&chost=zimuku.org', selector:".search-results .result-item" },
  1342. { name: 'R3字幕网', link: 'https://r3sub.com/search.php?s=' + unititle, selector: "div.col-sm-10" },
  1343. ]
  1344. });
  1345. }
  1346. if (!(is_mandarine) || (is_mandarine && is_otherlan)) {
  1347. site_map.push({
  1348. name: "英文影视字幕",
  1349. label: [
  1350. { name: 'Addic7ed', link: 'http://www.addic7ed.com/srch.php?search=' + eng_title_clean + year, selector: "table.tabel tr" },
  1351. { name: 'iSubtitles', link: 'https://isubtitles.info/search?kwd=' + ywm, selector: "div.movie-list-info h3" },
  1352. { name: 'Podnapisi', link: 'https://www.podnapisi.net/zh/subtitles/search/?language=zh&language=en&keywords=' + eng_title_clean + '&' + year + '-' + year, selector: "table tr.subtitle-entry" },
  1353. { name: 'Subscene', link: 'https://subscene.com/subtitles/title?q=' + eng_title_clean, selector: "div.search-result div.title", selector_need_login: "h1 span:contains('Checking your browser')" },
  1354. { name: 'TVsubtitles', link: 'http://www.tvsubtitles.net/search.php?q=' + eng_title_clean, selector: "div.left_articles li" },
  1355. { name: 'YIFY', link: 'http://www.yifysubtitles.com/search?q=' + eng_title_clean, selector: "div.col-sm-12 div.col-xs-12" },
  1356. ]
  1357. });
  1358. }
  1359.  
  1360. site_map.push({
  1361. name: "BT国内网站",
  1362. label: [
  1363. { name: 'BT部落', link: 'http://www.btbuluo.net/s/' + unititle + '.html', selector: `h2 a:contains(${unititle})` },
  1364. { name: 'BT之家', link: 'https://www.1lou.info/search-' + unititle + '.htm', selector: '.subject a:nth-of-type(1)' },
  1365. ]
  1366. });
  1367. if (has_imdb) {
  1368. site_map.push({
  1369. name: "BT国外网站",
  1370. label: [
  1371. { name: '1337X', link: 'https://www.1337x.to/search/' + ywm + '/1/', selector: 'table.table-list.table.table-responsive.table-striped td.coll-1.name' },
  1372. { name: 'TorLock', link: 'https://www.torlock.com/?qq=1&q=' + ywm, selector: 'table.table:nth-of-type(1) td:nth-of-type(1)' },
  1373. { name: 'YTS', link: 'https://yts.am/browse-movies/' + eng_title, selector: 'div.row div.browse-movie-bottom' },
  1374. { name: 'Кинозал', link: 'http://kinozal.tv/browse.php?s=' + ywm, selector: 'table.t_peer.w100p td.nam' },
  1375. { name: '海盗湾', link: 'https://piratebay.live/search/' + ywm, selector: '#searchResult div.detName' },
  1376. ]
  1377. });
  1378. }
  1379. } else if (location.host === "book.douban.com") {
  1380. let title = $('#wrapper > h1 > span')[0].textContent.replace(/[:\(].*$/, "");
  1381. let original_anchor = $('#info span.pl:contains("原作名")');
  1382. let original = original_anchor[0] ? fetch_anchor(original_anchor) : '';
  1383. let title_eng = title.match(/([a-zA-Z :,\(\)])+/);
  1384. let original_eng = original.match(/([a-zA-Z :,\(\)])+/);
  1385. let ywm = "";
  1386. if (title_eng) {
  1387. ywm = title;
  1388. } else if (original_eng) {
  1389. ywm = original.replace(/[:\(].*$/, "");
  1390. }
  1391. let has_ywm = title_eng + original_eng;
  1392. let stitle = ywm.toLowerCase().replace(/ /g, "-");
  1393. let is_writer = $('#info span.pl:contains("作者")').length > 0;
  1394. let writer = is_writer ? ' ' + $('#info span.pl:contains("作者")')[0].nextSibling.nextSibling.textContent.replace(/\[[^\]]+\]/g, '').replace(/([^)]+)/g, '').replace(/^\s{1,}/g, '') : '';
  1395. let gtitle = _encodeToGb2312(title, true);
  1396. let ptitle = encodeURI(title).replace(/%/g, "%25");
  1397. let isbn_anchor = $('#info span.pl:contains("ISBN")');
  1398. let isbn = isbn_anchor[0] ? fetch_anchor(isbn_anchor) : '';
  1399.  
  1400. // 比较时无视英文名大小写
  1401. jQuery.expr[':'].Contains = function (a, i, m) {
  1402. return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
  1403. };
  1404.  
  1405. function isbn13to10(str) {
  1406. //ISBN 10位和13位码互相转换
  1407. var s;
  1408. var c;
  1409. var checkDigit = 0;
  1410. var result = "";
  1411. s = str.substring(3, str.length);
  1412. for (let i = 10; i > 1; i--) {
  1413. c = s.charAt(10 - i);
  1414. checkDigit += (c - 0) * i;
  1415. result += c;
  1416. }
  1417. checkDigit = (11 - (checkDigit % 11)) % 11;
  1418. result += checkDigit == 10 ? 'X' : (checkDigit + "");
  1419. return (result);
  1420. }
  1421.  
  1422. let isbn10 = isbn13to10(isbn);
  1423.  
  1424. // 当前只对有isbn号的书籍开启中栏评分增强
  1425. if (isbn) {
  1426. let rating_more_hit = false;
  1427. $("div#interest_sectl").append(`<div class='rating_wrap clearbox' id='loading_more_rate'>加载第三方评价信息中.......</div>
  1428. <div class="rating_wrap clearbox rating_amazon_cn" rel="v:rating" style="display:none"></div>
  1429. <div class="rating_wrap clearbox rating_goodreads" style="display:none"></div>`);
  1430.  
  1431. if (GM_getValue("enable_book_amazon.cn_rate", true)) {
  1432. rating_more_hit = true;
  1433. // 通过ISBN信息在亚马逊中国上搜索
  1434. getDoc("https://www.amazon.cn/s/?url=search-alias%3Dstripbooks&field-keywords=" + isbn, null, function (doc) {
  1435. let result_0 = $('div[data-index="0"]', doc);
  1436. if (result_0.length > 0) { // 这本书在亚马逊中国上能搜索到
  1437. let book_id_in_amazon = result_0.attr("data-asin");
  1438. let book_url = "https://www.amazon.cn/dp/" + book_id_in_amazon;
  1439. let vote_text = result_0.text().replace(/\n/g, " ");
  1440.  
  1441. // 这是一个很取巧的获取方式,很可能因为页面结构更改而失效。 最近检查于 2019.09.25
  1442. let _group = vote_text.match(/([\d.]+?) 颗星,最多 5 颗星 +([\d,]+)/);
  1443. if (_group) {
  1444. let _rating = _group[1];
  1445. let _vote = _group[2];
  1446.  
  1447. $('#interest_sectl div.rating_amazon_cn').html(starBlock("亚马逊中国", book_url, _rating, _vote, 5)).show();
  1448. }
  1449. } else {
  1450. $('#interest_sectl div.rating_amazon_cn').append(`<br>搜索亚马逊中国: <a target='_blank' href='${`https://www.amazon.cn/s?k=${encodeURI(title)}&i=stripbooks`}'>${title}</a>`);
  1451. }
  1452. $('#loading_more_rate').hide();
  1453. });
  1454. }
  1455.  
  1456. if (GM_getValue('enable_book_goodreads', false) && GM_getValue('apikey_goodreads', false)) {
  1457. rating_more_hit = true;
  1458. getJSON(`https://www.goodreads.com/book/review_counts.json?key=${GM_getValue('apikey_goodreads', '')}&format=json&isbns=${isbn}`, function (data) {
  1459. try {
  1460. let book = data['books'][0];
  1461.  
  1462. let goodread_id = book['id'];
  1463. let goodread_url = `https://www.goodreads.com/book/show/${goodread_id}`;
  1464. let rating = book['average_rating'];
  1465. let vote = book['work_ratings_count'];
  1466. $('#interest_sectl div.rating_goodreads').html(starBlock("GoodReads", goodread_url, rating, vote, 5)).show();
  1467. } catch (e) {
  1468. $('#interest_sectl div.rating_goodreads').append(`<br>搜索GoodReads: <a target='_blank' href='${`https://www.goodreads.com/search?q=${encodeURI(title)}`}'>${title}</a>`);
  1469. }
  1470. $('#loading_more_rate').hide();
  1471. });
  1472. }
  1473.  
  1474. if (!rating_more_hit) {
  1475. $('#loading_more_rate').hide();
  1476. }
  1477. }
  1478.  
  1479. if (_version === "完整版") {
  1480. site_map.push({
  1481. name: "会员精准匹配",
  1482. label: [
  1483. { name: "mLook©", link: "http://plugin.mlook.mobi/search?q=" + isbn, selector: "div.books div.fl.meta" },
  1484. { name: 'Gold©', link: 'http://goldroom.top/book/search/?q=' + isbn, selector: 'i.glyphicon-download-alt:not(:contains("0"))' },
  1485. { name: 'Z-Lib©', link: 'https://book4you.org/s/?e=1&q=' + isbn, selector: '#searchResultBox div.authors' },
  1486. ]
  1487. });
  1488. site_map.push({
  1489. name: "图书会员网站",
  1490. label: [
  1491. { name: '33文库', link: 'http://www.33file.com/search.php?word=' + title, selector: `table.td_line span.txtred:contains(${title})` },
  1492. { name: 'Bookle', link: `http://www.x5v.net/#search_${title}`, ajax: 'http://www.x5v.net/bsearch', data: `searchType=search&searchText=${title}`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, selector: 'a.book-link' },
  1493. { name: 'Goldroom', link: 'http://goldroom.top/book/search/?q=' + title, selector: 'i.glyphicon-download-alt:not(:contains("0"))' },
  1494. { name: 'IRead', link: 'http://www.iread.cf/?query=' + title, selector: 'li.book-item div.book-info' },
  1495. { name: "Kindle88", link: "http://www.kindle88.com/?s=" + title + writer, selector: "div.widget-content li.archive-thumb" },
  1496. { name: 'iamtxt', method: "post", link: 'https://www.iamtxt.com/e/search/index.php', data: `keyboard=${title}&show=title&tempid=2`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: 'div.sResult div.title' },
  1497. { name: "mLook", link: "http://plugin.mlook.mobi/search?q=" + title, selector: "div.books div.fl.meta" },
  1498. { name: 'rejoice', link: 'http://www.rejoiceblog.com/article/search/page/1/?keyword=' + title, selector: 'div.article a.title' },
  1499. { name: 'Z-Libary', link: 'https://book4you.org/s/?e=1&q=' + title, selector: '#searchResultBox div.authors' },
  1500. { name: 'Zure', link: 'https://zure.fun/book/search/?q=' + title, selector: 'div.item a' },
  1501. { name: "点书网", method: "post", link: "http://www.gezhongshu.com/search.php?mod=forum", data: `srchtxt=${title}${writer}&searchsubmit=yes`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: "div.tl li.pbw" },
  1502. { name: "慧眼看", link: "https://www.huiyankan.com/?s=" + title, selector: `h2.entry-title a:contains(${title})` },
  1503. { name: "精读", link: "https://www.jingdoo.net/?s=" + title, selector: `h3 a[title*='${title}']` },
  1504. { name: "慢慢游书", link: 'https://www.manmanyou.net/search.php?mod=forum&searchsubmit=yes&srchtxt=' + title, selector: "div.tl li.pbw", selector_need_login: "#messagelogin" },
  1505. { name: '偶书', link: 'https://obook.cc/index.php?app=search&ac=s&kw=' + title, selector: 'span.c9 + a' },
  1506. { name: "盘乐网书", link: 'https://www.panle.net/search.php?mod=forum&searchsubmit=yes&srchtxt=' + title, selector: "div.tl li.pbw" },
  1507. { name: "书点点", link: 'https://illumebook.com/?s=' + title, selector: 'a.ss_bt_a' },
  1508. { name: "书行万里", link: 'https://www.gpdf.net/?s=' + title, selector: `h2 a:contains(${title})` },
  1509. { name: "小书虫", link: 'https://www.wq1.net/?s=' + title, selector: `h3 a[title*='${title}']` },
  1510. { name: "星际图书", link: 'http://60.205.213.143:7743/find?q=' + title, selector: `h3.general_result_title a:contains(${title})` },
  1511. { name: "星空好书", link: 'https://www.goodepub.com/?s=' + title, selector: "h2.entry-title" },
  1512. { name: '雅书', method: "post", link: 'https://yabook.blog/e/search/index.php', data: `tbname=news&keyboard=${title}&show=title&tempid=1`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: 'div.main div.postinfo' },
  1513. { name: "掌上书苑", link: 'https://www.soepub.com/search/index/?q=' + title, selector: "div.book-info-title" },
  1514. { name: "知识库", link: 'https://book.zhishikoo.com/?s=' + title, selector: `h3 a[title*='${title}']` },
  1515. ]
  1516. });
  1517. site_map.push({
  1518. name: "图书公众号站",
  1519. label: [
  1520. { name: '519资源网', link: 'https://book.519.best/?key=' + title, selector: 'span.book-name a' },
  1521. { name: 'AiBooks', link: 'https://www.aibooks.cc/search/' + title, selector: `h3 > a[title*='${title}']` },
  1522. { name: 'Kindle吧', link: 'https://www.kindle8.cc/?s=' + title, selector: `h2 > a:contains(${title})` },
  1523. { name: 'NMOD', link: 'https://www.nmod.net/search/' + title, selector: `h3 > a[title*='${title}']` },
  1524. { name: 'SoBooks', link: 'https://sobooks.cc/search/' + title, selector: `h3 > a[title*='${title}'], h1.article-title a` },
  1525. { name: '爱书小站', link: 'https://www.aishuchao.com/?s=' + title, selector: `h2 a:contains(${title})` },
  1526. { name: '电子书基地', link: 'http://www.dzs.so/Book/List?Keyword=' + title, selector: `h5 a:contains(${title})` },
  1527. { name: '读书达人', link: 'http://www.dushudaren.com/?s=' + title, selector: `h2 a:contains(${title})` },
  1528. { name: '读书小站', link: 'https://ibooks.org.cn/?s=' + title, selector: `h3.entry-title a:contains(${title})` },
  1529. { name: '跪读网', link: 'https://orzbooks.com/search.php?q=' + title, selector: `h2 a:contains(${title})` },
  1530. { name: '琳宝书屋', link: 'https://linbaoshuwu.com/search/' + title + '/', selector: `h2 a:contains(${title})` },
  1531. { name: "皮皮书屋", link: 'http://www.pipibook.com/?s=' + title, selector: "div.list-content div.list-body" },
  1532. { name: '书单', link: 'https://ebooklist.mobi/?s=' + title, selector: `h2 > a:contains(${title})` },
  1533. { name: '天浪书屋', link: 'https://www.tianlangbooks.com/?s=' + title, selector: `h3 > a[title*='${title}']` },
  1534. { name: '图书库', link: 'http://www.tbookk.com/?s=' + title, selector: `h2 > a[title*='${title}']` },
  1535. ]
  1536. });
  1537. }
  1538. site_map.push({
  1539. name: "图书在线试读",
  1540. label: [
  1541. { name: '多看阅读', link: `http://www.duokan.com/search/${title}`, selector: `div.wrap > a:contains(${title})` },
  1542. { name: '京东数字', link: `https://s-e.jd.com/Search?enc=utf-8&key=${title}${writer}`, selector: 'div.p-name a' },
  1543. { name: '亚马逊商店', link: 'https://www.amazon.cn/s?i=digital-text&k=' + isbn, selector: 'div.sg-col-inner h2' },
  1544. ]
  1545. });
  1546. site_map.push({
  1547. name: "图书精准匹配",
  1548. label: [
  1549. { name: "EBH", link: "http://ebookhunter.ch/search/?keyword=" + isbn, selector: "#mains_left div.index_box_title.list_title" },
  1550. { name: "LibGen", link: "http://libgen.rs/search.php?column=title&req=" + isbn, selector: "table[rules='rows'] td[width='500']" },
  1551. { name: '科学文库', link: 'http://book.sciencereading.cn/shop/book/Booksimple/list.do?showQueryModel.nameIsbnAuthor=' + isbn, selector: 'div.book_detail_title b.kc_title' },
  1552. { name: '图书馆联盟', link: 'http://book.ucdrs.superlib.net/search?Field=all&channel=search&sw=' + isbn, selector: '#leftcommon + td table.book1' },
  1553. ]
  1554. });
  1555. /** site_map.push({
  1556. name: "图书网盘精准",
  1557. label: [
  1558. { name: 'Downtr❏', link: 'https://downtr.cc/?do=search&subaction=search&story=' + isbn10, selector: '#dle-content div.title', selector_need_login: "h1 span:contains('Checking your browser')" },
  1559. { name: 'FilmSoft❏', link: 'http://filmsofts.com/?do=search&subaction=search&story=' + isbn10, selector: '#dle-content div.story', selector_need_login: "h1 span:contains('Checking your browser')" },
  1560. { name: 'Freshwap❏', link: 'http://www.freshwap.cc/?do=search&subaction=search&story=' + isbn10, selector: '#dle-content div.maincont', selector_need_login: "h1 span:contains('Checking your browser')" },
  1561. { name: 'OneDDL❏', link: 'https://oneddl.org/?do=search&subaction=search&story=' + isbn10, selector: '#dle-content div.con', selector_need_login: "h1 span:contains('Checking your browser')" },
  1562. { name: 'SoftArch❏', link: 'https://sanet.st/search/?category=any&filehosting=any&isbn=' + isbn10, selector: 'div.titles_list_box a.cellMainLink', selector_need_login: "h1 span:contains('Checking your browser')" },
  1563. { name: 'WarezSer❏', link: 'http://warez-serbia.com/index.php?do=search&subaction=search&story=' + isbn10, selector: '#dle-content div.post-info', selector_need_login: "h1 span:contains('Checking your browser')" },
  1564. { name: 'Win7DL❏', link: 'https://win7dl.org/?do=search&subaction=search&story=' + isbn10, selector: '#dle-content td.block_head_2', selector_need_login: "h1 span:contains('Checking your browser')" },
  1565. ]
  1566. }); **/
  1567. site_map.push({
  1568. name: "图书免费网站",
  1569. label: [
  1570. { name: '云搜', link: 'https://yunsou.xyz/s/' + unititle, selector: 'ul.DiscussionList-discussions > li[data-id]' },
  1571. { name: 'LoreFree', link: 'https://ebook2.lorefree.com/site/index?s=' + title, selector: 'div.body-content div.caption.book-content' },
  1572. { name: 'SaltTiger', link: 'https://salttiger.com/?s=' + title, selector: `h1.entry-title > a:contains(${title})` },
  1573. { name: '爱悦读', link: 'https://www.iyd.wang/?s=' + title, selector: `h2.entry-title > a:contains(${title})` },
  1574. { name: '台大图书馆', link: 'http://ebooks.lib.ntu.edu.tw/Home/ListBooks?type=KeywordSearch&h_tag=&pageNumber=1&searchTopic=title&record_per_page=10&send=%E6%9F%A5%E8%A9%A2&keyword=' + title, selector: 'tbody td.content' },
  1575. { name: '中国哲学书', link: 'https://ctext.org/searchbooks.pl?if=gb&remap=gb&searchu=' + title, selector: 'ul.searchres div.ctext' },
  1576. ]
  1577. });
  1578. if (has_ywm) {
  1579. site_map.push({
  1580. name: "图书国外网站",
  1581. label: [
  1582. { name: 'BookFl', link: 'http://en.bookfi.net/s/?e=1&q=' + ywm, selector: `#searchResultBox h3.color1:Contains(${ywm})` },
  1583. { name: 'Booksee', link: 'http://en.booksee.org/s/?e=1&q=' + ywm, selector: `#searchResultBox h3.color1:Contains(${ywm})` },
  1584. { name: 'EPDF', link: 'https://epdf.tips/search/' + ywm, selector: `h3.note-title:Contains(${ywm})` },
  1585. { name: 'PDFDrive', link: 'https://www.pdfdrive.com/search?q=' + ywm, selector: `div.file-right a[href*='${stitle}']` },
  1586. ]
  1587. });
  1588. }
  1589. site_map.push({
  1590. name: "图书网盘搜索",
  1591. label: [
  1592. { name: '爱问资料', link: `http://ishare.iask.sina.com.cn/search/home.html?ft=all&cond=${ptitle}`, selector: 'ul.landing-txt-list h4.data-name' },
  1593. { name: '小白盘图书', link: 'http://www.xiaobaipan.com/list-' + title + '.html?order=size', selector: 'h4.job-title a' },
  1594. ]
  1595. });
  1596. site_map.push({
  1597. name: "有声在线试听",
  1598. label: [
  1599. { name: '懒人听书', link: 'https://www.lrts.me/search/book/' + title, selector: 'ul li.book-item' },
  1600. { name: '评书吧', link: 'http://www.pingshu8.com/search/1.asp?keyword=' + gtitle, selector: "table.TableLine div[align='left']" },
  1601. { name: '天方听书网', link: 'https://www.tingbook.com/search/' + title, selector: 'ul.search_result_list h4.clearfix' },
  1602. { name: '中文听书网', link: 'https://www.tingzh.com/search.php?searchword=' + gtitle, selector: 'div.sear_height a.play' },
  1603. { name: '喜马有声', link: 'https://www.ximalaya.com/so/' + title + '/', selector: `div.xm-album-cover__wrapper + a[title*='${title}']` },
  1604. ]
  1605. });
  1606. site_map.push({
  1607. name: "图书有声网站",
  1608. label: [
  1609. { name: 'ABB', link: 'http://audiobookbay.nl/?s=' + title, selector: '#content div.postTitle' },
  1610. ]
  1611. });
  1612. } else if (location.host === "music.douban.com") {
  1613. // 页面元素定位
  1614. let album_anchor = $('#info span.pl:contains("专辑类型")'); //专辑类型
  1615. let medium_anchor = $('#info span.pl:contains("介质")'); //介质
  1616. let album = album_anchor[0] ? fetch_anchor(album_anchor) : '';
  1617. let is_single = album.match(/单曲/);
  1618. let title = $('#wrapper > h1 > span')[0].textContent.split(' ').shift().replace(/[,]/g, " ").replace(/:.*$/, "");
  1619. let gtitle = _encodeToGb2312(title, true);
  1620. let ptitle = encodeURI(title).replace(/%/g, "%25");
  1621. let singer = ' ' + $('#info > span > span.pl > a')[0].textContent;
  1622. let gsinger = _encodeToGb2312(singer, true);
  1623. if (_version === "完整版") {
  1624. site_map.push({
  1625. name: "PT音乐顶配",
  1626. label: [
  1627. { name: "CHDBits♬", link: 'https://chdbits.co/torrents.php?cat406=1&cat408=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1628. { name: "CMCT♬", link: "https://hdcmct.org/torrents.php?cat508=1&incldead=1&search_area=1&notnewword=1&search=" + title + singer, },
  1629. { name: "HDChina♬", link: 'https://hdchina.org/torrents.php?cat408=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, selector: "table.torrent_list:last > tbody > tr:gt(0)" },
  1630. { name: "HDSky♬", link: 'https://hdsky.me/torrents.php?cat408=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1631. { name: "MTeam♬", link: 'https://kp.m-team.cc/torrents.php?cat408=1&cat434=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1632. { name: "OpenCD♬", link: 'https://open.cd/torrents.php?incldead=1&search_area=0&notnewword=1&search=' + title + singer, selector: "table.torrents:last > tbody > tr:gt(0)" },
  1633. { name: "OurBits♬", link: 'https://ourbits.club/torrents.php?cat=416&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1634. { name: "TTG♬", link: 'https://totheglory.im/browse.php?c=M&notnewword=1&search_field=分类%3A%60无损音乐FLAC%26APE%60+分类%3A%60%28电影原声%26Game%29OST%60 ' + title + singer, selector: "table#torrent_table:last > tbody > tr:gt(0)" },
  1635. { name: "U2♬", link: 'https://u2.dmhy.org/torrents.php?cat30=1&incldead=1&search_area=0&notnewword=1&search=' + title.split(' ')[0], },
  1636. ]
  1637. });
  1638. site_map.push({
  1639. name: "PT音乐标配",
  1640. label: [
  1641. { name: "HDCity♬", link: 'https://hdcity.city/pt?cat408=1&incldead=1&search_area=1&notnewword=1&iwannaseethis=' + title + singer, selector: "center > div > div > div.text" },
  1642. { name: "HDHome♬", link: 'https://hdhome.org/torrents.php?cat439=1&cat440=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1643. { name: "HDTime♬", link: 'https://hdtime.org/torrents.php?cat=408&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1644. { name: "JoyHD♬", link: 'https://www.joyhd.net/torrents.php?cat=414&incldead=1&search_area=1&notnewword=1&search=' + title + singer, },
  1645. ]
  1646. });
  1647. site_map.push({
  1648. name: "PT音乐教育",
  1649. label: [
  1650. { name: "NYPT♬", link: 'https://nanyangpt.com/torrents.php?cat407=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, selector: "table.torrents:last > tbody > tr" },
  1651. { name: "SJTU♬", link: 'https://pt.sjtu.edu.cn/torrents.php?cat420=1&cat421=1&cat422=1&cat423=1&cat425=1&cat426=1&incldead=1&search_area=1&notnewword=1&search=' + title + singer, selector: "table.torrents:last > tbody > tr" },
  1652. ]
  1653. });
  1654. site_map.push({
  1655. name: "PT音乐外站",
  1656. label: [
  1657. { name: "JPOP♬", link: 'https://jpopsuki.eu/torrents.php?searchstr=' + title + singer, selector: "#torrent_table > tbody > tr:gt(0)" },
  1658. { name: "Orpheus♬", link: 'https://orpheus.network/torrents.php?searchstr=' + title + singer, selector: "#torrent_table:last > tbody > tr.group_torrent:gt(0)" },
  1659. { name: "Red♬", link: 'https://redacted.ch/torrents.php?searchstr=' + title + singer, selector: "#torrent_table > tbody > tr.group_torrent:gt(0)" },
  1660. { name: "Waffles♬", link: 'https://waffles.ch/browse.php?q=' + title + singer, selector: "#browsetable:last > tbody > tr:gt(0)" },
  1661. ]
  1662. });
  1663. site_map.push({
  1664. name: "音乐论坛资源",
  1665. label: [
  1666. { name: "AIPT♬", link: 'http://pt.aipt123.org/table_list.php?search_area=1&notnewword=1&search=' + title + singer, },
  1667. { name: "磨坊", method: "post", link: "http://www.moofeel.com/search.php?mod=forum", data: `srchtxt=${gtitle}${gsinger}&searchsubmit=yes`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, rewrite_href: true, selector: "div.tl li.pbw" },
  1668. { name: "无损音乐网", link: 'https://www.so.com/s?q=site%3Awusunyinyue.cn+intitle:' + title + '%26%26' + singer.trim(), selector: 'ul.result li.res-list' },
  1669. { name: "盘乐网音", link: 'https://www.panle.net/search.php?mod=forum&searchsubmit=yes&srchtxt=' + title, selector: "div.tl li.pbw" },
  1670. { name: "炫音音乐", link: `http://so.musicool.cn/cse/search?s=10523158750213826925&q=${title}${singer}`, selector: "#results h3.c-title" },
  1671. ]
  1672. });
  1673. }
  1674. site_map.push({
  1675. name: "在线音乐播放",
  1676. label: [
  1677. { name: 'QQ音乐', link: 'https://y.qq.com/portal/search.html#page=1&searchid=1&remoteplace=txt.yqq.top&t=album&w=' + title + singer, ajax: "https://c.y.qq.com/soso/fcgi-bin/client_search_cp?t=8&format=json&w=" + title + singer, type: "json", selector: 'data.album.totalnum > 0' },
  1678. { name: '百度音乐', link: 'http://music.baidu.com/search/album?key=' + title + singer, selector: '#album_list div.album-info' },
  1679. { name: '酷我音乐', link: 'http://sou.kuwo.cn/ws/NSearch?type=album&key=' + title + singer, selector: 'div.album p.musicName' },
  1680. { name: '咪咕音乐', link: `http://music.migu.cn/v2/search?type=album&keyword=${title}${singer}`, selector: `div.album-name font:contains(${title})` },
  1681. { name: '虾米音乐', link: `https://www.xiami.com/search/album/?key=${title}${singer}`, selector: `p.name > a[title='${title}'] + a[title='${singer.trim()}']` },
  1682. { name: '网易云音乐', link: 'https://music.163.com/#/search/m/?type=10&s=' + title + singer, ajax: "https://api.imjad.cn/cloudmusic/?type=search&s=" + title + singer, type: "json", selector: 'result.songCount > 0' },
  1683. ]
  1684. });
  1685. if (is_single) {
  1686. site_map.push({
  1687. name: "单曲无损网站",
  1688. label: [
  1689. { name: '51Ape', link: 'https://www.bing.com/search?q=site%3Awww.51ape.com+intitle%3A' + title + '+intitle%3A' + singer, selector: '#b_content div.b_caption' },
  1690. ]
  1691. });
  1692. }
  1693. site_map.push({
  1694. name: "音乐免费网站",
  1695. label: [
  1696. { name: 'DTShot', link: 'http://www.dtshot.com/search/' + title + singer + '/', selector: `div.case_info div.meta-title:contains(${title})` },
  1697. { name: 'XZPC音乐', method: "post", link: 'http://www.xzpc6.com/#search_' + title, ajax: 'http://www.xzpc6.com/sou.php', data: `key=${title}`, headers: { "Content-Type": "application/x-www-form-urlencoded" }, selector: 'p a' },
  1698. { name: '爱无损', link: 'http://www.lovewusun.com/?s=' + title + singer, selector: '#main h2.entry-title' },
  1699. { name: '小浣熊音乐', link: `https://www.xiaohx.org/search?cat=5&key=${title}${singer}`, selector: `div.result_p a[title*='${title}']` },
  1700. ]
  1701. });
  1702. site_map.push({
  1703. name: "音乐国内网盘",
  1704. label: [
  1705. { name: '小白盘音乐', link: 'http://www.xiaobaipan.com/list-' + title + '.html?order=size', selector: 'h4.job-title a' },
  1706. ]
  1707. });
  1708. site_map.push({
  1709. name: "音乐国外网盘",
  1710. label: [
  1711. { name: 'AvaxHome♬', link: 'https://tavaz.xyz/search/?category_slug=music&query=' + title + singer, selector: 'div.col-xs-12.col-sm-8.col-md-8.col-lg-8 div.panel-heading' },
  1712. { name: 'Rutrack♬', link: 'http://rutracker.org/forum/search_cse.php?q=' + title, ajax: `https://www.google.com/search?q=allintitle:+${title}+site:rutracker.org`, selector: '`a > h3:contains(${title})`' },
  1713. ]
  1714. });
  1715. }
  1716.  
  1717. // 检查站点是否需要登陆的方法 res 应该是GM_xmlhttpRequests返回对象 ,返回bool值,true时为需要登陆
  1718. function login_check(res) {
  1719. let need_login = false;
  1720. if (/login|verify|checkpoint|returnto/ig.test(res.finalUrl)) {
  1721. need_login = true; // 检查最终的URL看是不是需要登陆
  1722. } else if (/refresh: \d+; url=.+login.+/ig.test(res.responseHeaders)) {
  1723. need_login = true; // 检查responseHeader有没有重定向
  1724. } else {
  1725. let responseText = res.responseText;
  1726. if (typeof responseText === "undefined") {
  1727. need_login = true; // 检查最终的Text,如果什么都没有也可能说明需要登陆
  1728. } else if (responseText.length < 800 && /login|not authorized/.test(responseText)) {
  1729. need_login = true; // 对Text进行检查,断言“过短,且中间出现login字段”即说明可能需要登陆
  1730. }
  1731. }
  1732. return need_login;
  1733. }
  1734.  
  1735. function Exist_check(label) {
  1736. let site = label.name;
  1737. let psite = $(`a[data-name="${site}"]`);
  1738.  
  1739. function HideTag() {
  1740. if (GM_getValue('enable_adv_auto_hide', false)) {
  1741. $(psite).hide();
  1742. }
  1743. }
  1744.  
  1745. function TagExist(link) {
  1746. $(psite).css("background-color", GM_getValue("tag_bcolor_exist", "#e3f1ed"));
  1747. $(psite).css("color", GM_getValue("tag_fcolor_exist", "#3377aa"));
  1748. $(psite).attr("title", "资源存在");
  1749. let storage_data = true;
  1750. if (label.rewrite_href && label.rewrite_href === true) { // 重写链接
  1751. storage_data = cache.get(site, link || $(psite).attr("href"));
  1752. $(psite).attr("href", storage_data);
  1753. }
  1754. cache.add(site, storage_data);
  1755. }
  1756.  
  1757. function TagNotExist() {
  1758. $(psite).css("background-color", GM_getValue("tag_bcolor_not_exist", "#f4eac2"));
  1759. $(psite).css("color", GM_getValue("tag_fcolor_not_exist", "#3377aa"));
  1760. $(psite).attr("title", "资源不存在");
  1761. HideTag();
  1762. }
  1763.  
  1764. function TagNeedLogin() {
  1765. $(psite).css("background-color", GM_getValue("tag_bcolor_need_login", ""));
  1766. $(psite).css("color", GM_getValue("tag_fcolor_need_login", "#3377aa"));
  1767. need_login_cache.add(site, true);
  1768. $(psite).click(function () {
  1769. need_login_cache.del(site);
  1770. });
  1771. $(psite).attr("title", "站点需要登陆");
  1772. HideTag();
  1773. }
  1774.  
  1775. function TagError(errtype) {
  1776. $(psite).css("background-color", GM_getValue("tag_bcolor_error", ""));
  1777. $(psite).css("color", GM_getValue("tag_fcolor_error", "#3377aa"));
  1778. $(psite).attr("title", "遇到问题" + (errtype ? (" - " + errtype) : ""));
  1779. HideTag();
  1780. }
  1781.  
  1782. // 这里假定有这个资源的就一直都有,直接使用第一次请求成功的时候缓存信息
  1783. if (cache.get(site)) { TagExist(); return; }
  1784.  
  1785. // 如果前次检查到这个站点需要登陆
  1786. if (need_login_cache.get(site)) { TagNeedLogin(); return; }
  1787.  
  1788. // 不然,则请求相关信息
  1789.  
  1790. // 重写请求参数
  1791. //if (typeof label.data === "object") {
  1792. // let myData = new FormData();
  1793. // for (let k in label.data) {
  1794. // myData.append(k,label.data.k);
  1795. // }
  1796. // label.data = myData;
  1797. //}
  1798.  
  1799. // 请求核心方法
  1800. function check_core(label) {
  1801. GM_xmlhttpRequest({
  1802. method: label.method || "GET",
  1803. url: label.ajax || label.link,
  1804. data: label.data,
  1805. headers: label.headers,
  1806. timeout: 45e3, // 默认45s服务器无响应算超时
  1807. onload: function (res) {
  1808. if (login_check(res)) {
  1809. TagNeedLogin();
  1810. } else {
  1811. try { // 开始解析返回信息
  1812. let responseText = res.responseText;
  1813. if (label.type && ["json", "jsonp"].includes(label.type)) { // 如果前面定义了返回类型是"json'或者"jsonp"
  1814. if (label.type === "jsonp") {
  1815. responseText = responseText.match(/[^(]+\((.+)\)/)[1];
  1816. }
  1817. let par = JSON.parse(responseText);
  1818. if (eval("par." + label.selector)) {
  1819. TagExist();
  1820. } else {
  1821. TagNotExist(); // 所有情况都失败则未存在
  1822. }
  1823. } else { // 否则默认label.type的默认值为 html
  1824. let doc = page_parser(res.responseText);
  1825. let body = doc.querySelector("body");
  1826. // 因为jQuery的选择器丰富,故这里不用 dom.querySelector() 而用 jQuery.find()
  1827. if (label.selector_need_login && $(body).find(label.selector_need_login).length) {
  1828. TagNeedLogin(); // 如果存在selector_need_login选择器,则先判断是否存在以确定是否需要登录(不可用)
  1829. } else if ($(body).find(label.selector || "table.torrents:last > tbody > tr:gt(0)").length) {
  1830. TagExist(res.finalUrl); // 最后使用selector选择器判断资源是否存在
  1831. } else {
  1832. TagNotExist(); // 所有情况都失败则未存在
  1833. }
  1834. }
  1835. } catch (e) {
  1836. TagError("解析错误");
  1837. }
  1838. }
  1839. },
  1840. onerror: function () { TagError("请求故障"); },
  1841. ontimeout: function () { TagError("请求超时"); },
  1842. });
  1843. }
  1844.  
  1845. // 请求动作方法
  1846. function check_func() {
  1847. $(psite).attr("title", "正在请求信息中");
  1848. if (label.csrf) { // 对某些启用了csrf的站点,先使用正常方式请求一次获取csrf值
  1849. GM_xmlhttpRequest({
  1850. method: "GET",
  1851. url: label.link,
  1852. timeout: 45e3, // 默认45s服务器无响应算超时
  1853. onload: function (res) {
  1854. if (!login_check(res)) {
  1855. try {
  1856. let doc = page_parser(res.responseText);
  1857. let csrf_ = $(`input[name='${label.csrf.name}'`, doc);
  1858. let csrf_key = csrf_.attr("value"); // 获取csrf值
  1859. label[label.csrf.update] += `&${label.csrf.name}=${csrf_key}`; // 更新对应选项
  1860. check_core(label);
  1861. } catch (e) {
  1862. TagError("解析故障");
  1863. }
  1864. }
  1865. },
  1866. onerror: function () { TagError("请求错误"); },
  1867. ontimeout: function () { TagError("请求超时"); },
  1868. });
  1869. } else {
  1870. check_core(label);
  1871. }
  1872. }
  1873.  
  1874. // 根据设置,是自动请求还是鼠标移动时在做请求
  1875. if (GM_getValue("enable_adv_auto_search", true)) {
  1876. check_func();
  1877. } else {
  1878. $(psite).mouseenter(function (e) { // 鼠标进入时才自动搜索并反馈
  1879. if ($(psite).attr('title') == 'empty') { // 防止重复请求
  1880. check_func();
  1881. $(psite).unbind('mouseenter');
  1882. }
  1883. });
  1884. }
  1885. }
  1886.  
  1887. function site_exist_status() {
  1888. $("#drdm_req_status").show();
  1889. for (let i = 0; i < site_map.length; i++) {
  1890. let map_dic = site_map[i];
  1891. if (GM_getValue(delete_site_prefix + map_dic.name, false)) {
  1892. continue;
  1893. }
  1894. $('#drdm_sites').append(`<div class="c-aside name-offline" data-id="${i}"><h2><i>${map_dic.name}</i>· · · · · ·</h2><div class=c-aside-body style="padding: 0 12px;"> <ul class=bs > </ul> </div> </div>`);
  1895.  
  1896. let in_site_html = $(`div[data-id='${i}'] ul.bs`);
  1897. for (let j = 0; j < map_dic.label.length; j++) {
  1898. let label = map_dic.label[j];
  1899. if (GM_getValue(delete_site_prefix + label.name, false)) {
  1900. continue;
  1901. }
  1902. in_site_html.append(`<a href="${label.link}" data-name="${label.name}" target="_blank" rel="nofollow" class="name-offline" title="empty">${label.name}</a>`);
  1903. Exist_check(label);
  1904.  
  1905. }
  1906. }
  1907.  
  1908. update_status_interval = window.setInterval(update_req_status, 1e3);
  1909.  
  1910. if (!GM_getValue("enable_adv_auto_search", true)) {
  1911. $("#drdm_req_status_hide").click();
  1912. }
  1913. }
  1914. site_exist_status();
  1915. }
  1916.  
  1917. // 脚本页面切换方法
  1918. function wrapper_change(id, html, callback) {
  1919. if ($(`div#wrapper > div#${id}`).length === 0) {
  1920. $('div#wrapper').append(html);
  1921. if (typeof callback === "function") {
  1922. callback();
  1923. }
  1924. }
  1925. let ele_inst = $(`div#wrapper > div#${id}`);
  1926. let ele_other = $(`div#wrapper > div#content, div#footer`);
  1927. if (ele_other.is(':visible')) {
  1928. ele_other.hide(); ele_inst.show();
  1929. } else {
  1930. ele_other.show(); ele_inst.hide();
  1931. }
  1932. }
  1933.  
  1934. // 加载豆列搜索
  1935. if (GM_getValue("enable_doulist_search", true)) {
  1936. GM_addStyle('#db-nav-movie a.movieannual {margin-left: 350px !important;}');
  1937. $('div.nav-items ul').append('<li><a id="search_dlist" href="javascript:void(0);">豆列搜索</a></li>');
  1938. $("#search_dlist").click(function () {
  1939. let int_html = `<div id='drdm_doulist'><h1>豆列搜索</h1><div class="grid-16-8 clearfix"><div class="article"><div class="indent"><div class="movie-list"></div><a class="more" href="javascript:;" style="display:none">加载更多</a></div></div><div class="aside"><div><h2>豆列搜索 · · · · · ·</h2><div><span><p><div id="form-doulist"><input class="doulist" id="input-doulist" placeholder="Criterion, 46534919, ..." value=""</input><input type="submit" id="doulist-submit" value="search" /input></div></p></span><span style="" class="search_result c-aside-body"></span></div></div><div class="doulist_intro"><h2>豆列搜索说明 · · · · · ·</h2><p>输入你想搜的关键词,点击搜索。就这么简单。</p></div></div></div></div>`;
  1940. wrapper_change("drdm_doulist", int_html, function () {
  1941. let load_more = $("#drdm_doulist a.more");
  1942. $('#doulist-submit').click(function () {
  1943. let doulist = $("#input-doulist").val();
  1944. $('div.movie-list').html("");
  1945. let get_doulist = function (doulist, page) {
  1946. load_more.text("加载中......").show();
  1947. getDoc('https://cn.bing.com/search?q=site%3awww.douban.com%2fdoulist+' + doulist + '&first=' + page, null, function (doc, res, meta) {
  1948. let result = $('ol#b_results .b_algo', doc);
  1949. result = result.filter(function () {
  1950. return $("a[href^='https://www.douban.com/doulist/']", this).length > 0;
  1951. });
  1952. if (result.length === 0) {
  1953. load_more.text('没有找到相关豆列');
  1954. }
  1955. else {
  1956. result.each(function () {
  1957. let title = $(this).find("a[href^='https://www.douban.com/doulist/']");
  1958. let caption = $(this).find("div.b_caption");
  1959.  
  1960. let id = title.attr("href").match(/doulist\/(\d+)/)[1];
  1961. let title_clean = title.text().replace(/(\(豆瓣\)|\s-\s豆瓣电影|\s-\s豆瓣)/, '').replace(/ - douban.com/, '');
  1962. caption.find("div.b_attribution").remove();
  1963. let detail = caption.html();
  1964.  
  1965. if ($(`div.movie-list > div[data-dlist=${id}]`).length === 0) { // 重复的不再插入
  1966. $('div.movie-list').append(`<div data-dlist="${id}"><div><h2 style="font-size:13px;"><a href="https://www.douban.com/doulist/${id}" target="_blank">${title_clean}</a></h2><div></div></div><div class="tags">${detail}<p class="ul"></p></div></div>`);
  1967. }
  1968. });
  1969.  
  1970. // 更新加载信息
  1971. let load_id = page + 10;
  1972. load_more.text('加载更多');
  1973. load_more.one("click", function () {
  1974. get_doulist(doulist, load_id);
  1975. });
  1976. }
  1977. });
  1978. }
  1979. get_doulist(doulist, 1);
  1980. });
  1981. });
  1982. });
  1983. }
  1984.  
  1985.  
  1986. // 脚本设置
  1987. $("#db-global-nav > div > div.top-nav-info").append(`<a href="javascript:;" id="drdm_setting_btn">脚本设置</a>`);
  1988. $("#drdm_setting_btn").click(function () {
  1989. let int_html = `<div id='drdm_setting'><h2>脚本设置界面正在开发中,请等待完善......</h2></div>`;
  1990. wrapper_change("drdm_setting", int_html, function () {
  1991. // TODO 评分信息,豆列搜索等杂项功能启用情况
  1992. let config_setting = "<h1>脚本基本功能启用状况</h1><dl class='drdm-dl-horizontal'>";
  1993.  
  1994. function config_setting_gen(name, key, note, def = true) {
  1995. config_setting += `<dt>${name}</dt><dd><input type="checkbox" id="drdm_config_${key}" ${GM_getValue(key, def) ? 'checked' : ''} data-config="${key}"><label for="drdm_config_${key}"></label> ${note} </dd>`;
  1996. }
  1997.  
  1998. config_setting_gen("额外样式", "enable_extra_stylesheet", "注入一些额外的CSS样式屏蔽豆瓣广告等(注意:这会隐藏豆瓣自带的观影渠道)", true);
  1999. config_setting_gen("豆列搜索", "enable_doulist_search", "对豆列进行搜索(通过 \`cn.bing.com\` 搜索)");
  2000. config_setting_gen("电影简介生成", "enable_mediainfo_gen", "生成符合PT站点电影简介信息(Mediainfogen格式)", false);
  2001. config_setting_gen("各类排行榜", "enable_top_rang_tag", `显示来自 <a href="https://github.com/bimzcy/rank4douban">bimzcy/rank4douban</a> 的各种排行榜`);
  2002. config_setting_gen("启用全站自动搜索", "enable_adv_auto_search", "启用可让脚本自动搜索全部站点(会消耗CPU及网络资源),不启用则仅当鼠标移至对应站点时搜索");
  2003. config_setting_gen("自动隐藏搜索失败站点", "enable_adv_auto_hide", "搜索时自动隐藏搜索失败(资源不存在,需要登陆,遇到问题)站点,默认关闭", false);
  2004. config_setting_gen("搜索完成后隐藏提示条", "enalbe_adv_auto_tip_hide", "搜索结束后自动隐藏搜索情况提示条,默认关闭且不建议开启", false);
  2005. config_setting_gen("展示IMDB增强信息", "enable_imdb_ext_info", "展示制片成本、本国首周票房、北美首周票房、总票房等来自IMDb的影片增强信息");
  2006. config_setting_gen("烂番茄评分", "enable_tomato_rate", "展示烂番茄评分信息");
  2007. config_setting_gen("动漫评分", "enable_anime_rate", "展示动漫影视的AniDB、Bgm、Mal等评分");
  2008. config_setting_gen("蓝光发售日", "enable_blue_date", "展示蓝光的发售日期(来自IMDb)");
  2009. config_setting_gen("亚马逊图书评分", "enable_book_amazon.cn_rate", `展示在<a href="https://www.amazon.cn/" target="_blank">亚马逊中国</a> 上有对应ISBN信息的图书评分信息`);
  2010. config_setting_gen("GoodReads图书评分", "enable_book_goodreads", `展示在 <a href="https://www.goodreads.com" target="_blank">GoodReads</a> 上有对应ISBN信息的图书评分信息,设置你的APIKEY: <input id='drdm_setting_apikey_goodreads' type='text' value='${GM_getValue('apikey_goodreads', '')}'></input> (<a href='//blog.rhilip.info/archives/1124/' target='_blank'>说明</a>)`, false);
  2011.  
  2012. config_setting += `</dl><br>`;
  2013.  
  2014. // 构造站点启用信息
  2015. let setting_site = "<h1>搜索站点启用情况(在当前页面条件下)</h1>";
  2016. for (let i = 0; i < site_map.length; i++) {
  2017. let map_dic = site_map[i];
  2018. setting_site += `<div><h2>${map_dic.name} <input type="checkbox" id="${'drdm_config_site_' + map_dic.name}" ${GM_getValue(delete_site_prefix + map_dic.name, false) ? '' : 'checked'} data-config="${delete_site_prefix + map_dic.name}" data-par="${map_dic.name}" data-type="map"><label for="${'drdm_config_site_' + map_dic.name}"></label></h2><table><tbody><tr>`;
  2019. for (let j = 0; j < map_dic.label.length; j++) {
  2020. let label = map_dic.label[j];
  2021. setting_site += `<td style="text-align:right;"><span>${label.name}</span><input type="checkbox" id="${'drdm_config_site_' + label.name}" ${GM_getValue(delete_site_prefix + map_dic.name, false) || GM_getValue(delete_site_prefix + label.name, false) ? '' : 'checked'} ${GM_getValue(delete_site_prefix + map_dic.name, false) ? 'disabled' : ''} data-config="${delete_site_prefix + label.name}" data-par="${map_dic.name}" data-type="site"><label for="${'drdm_config_site_' + label.name}"></label></td>`;
  2022. if ((j + 1) % 7 === 0) {
  2023. setting_site += '</tr><tr>';
  2024. }
  2025. }
  2026. setting_site += "</tbody></table></div><hr>";
  2027. }
  2028. $("#drdm_setting").append(config_setting + setting_site);
  2029. $("input[id^='drdm_config_']").click(function () {
  2030. let that = $(this);
  2031. GM_setValue(that.attr("data-config"), that.attr("data-config").match(delete_site_prefix) ? !that.prop("checked") : that.prop("checked"));
  2032. if (that.attr("data-type") && that.attr("data-type") === "map") {
  2033. let par = that.attr("data-par");
  2034. $(`input[id^='drdm_config_site_'][data-type='site'][data-par='${par}']`).prop("disabled", !that.prop("checked")).prop("checked", that.prop("checked"));
  2035. }
  2036. });
  2037.  
  2038. // 其他回调
  2039. $('input#drdm_setting_apikey_goodreads').on('input change', function () {
  2040. let that = $(this);
  2041. GM_setValue('apikey_goodreads', that.val());
  2042. });
  2043. });
  2044. });
  2045. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址