绿豆瓣·豆瓣电影 BT/种子/资源/磁链/字幕 一键搜索下载 在线观看

搜片神器,高清党福音;自动解析电影名/豆瓣ID/IMDb ID;BTDigg/低端影视/茶杯狐/WebHD/SubHD/字幕库/伪射手 一键直达

  1. // ==UserScript==
  2. // @name 绿豆瓣·豆瓣电影 BT/种子/资源/磁链/字幕 一键搜索下载 在线观看
  3. // @namespace https://github.com/94leon/movie.plus
  4. // @description 搜片神器,高清党福音;自动解析电影名/豆瓣ID/IMDb ID;BTDigg/低端影视/茶杯狐/WebHD/SubHD/字幕库/伪射手 一键直达
  5. // @author 94Léon
  6. // @grant GM_setClipboard
  7. // @match http*://movie.douban.com/subject/*/
  8. // @match http*://movie.douban.com/subject/*/?from=*
  9. // @exclude-match http*://movie.douban.com/subject/*/*/
  10. // @version 231017
  11. // ==/UserScript==
  12.  
  13. const myScriptStyle = document.createElement("style");
  14. myScriptStyle.innerHTML = "@charset utf-8;.c-aside {margin-bottom: 30px} .c-aside-body {*letter-spacing: normal} .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:hover, .c-aside-body a:active {background-color: #e8e8e8;color: #37A} .c-aside-body a.disabled {text-decoration: line-through} .c-aside-body a.available {background-color: #5ccccc;color: #006363} .c-aside-body a.available:hover, .c-aside-body a.available:active {background-color: #3cc} .c-aside-body a.honse {background-color: #fff0f5;color: #006363} .c-aside-body a.honse:hover, .c-aside-body a.honse:active {background-color: #3cc} .c-aside-body a.sites_r0 {text-decoration: line-through}";
  15. document.getElementsByTagName("head")[0].appendChild(myScriptStyle);
  16. const aside_html = '<div class=c-aside > <h2><i class="">四字标题</i>· · · · · · </h2> <div class=c-aside-body style="padding: 0 12px;"> <ul class=bs > </ul> </div> </div>';
  17.  
  18.  
  19. const en_total_reg = /^[a-zA-Z\d\s-:·,/`~!@#$%^&*()_+<>?"{}.…;'[\]]+$/;
  20. const en_end_reg = /\s[a-zA-Z\d\s-:·,/`~!@#$%^&*()_+<>?"{}.…;'[\]]+$/;
  21. const cn_start_reg = /^[\u4e00-\u9fa5a-zA-Z\d\s-::·,,/`~!@#$%^&*()_+<>?"{}.…;'[\]!¥(—);“”‘、|《。》?【】]+/;
  22. const cn_total_reg = /^[\u4e00-\u9fa5a-zA-Z\d\s-::·,,/`~!@#$%^&*()_+<>?"{}.…;'[\]!¥(—);“”‘、|《。》?【】]+$/;
  23. const symbol_delete_reg = /[-::·,,/`~!@#$%^&*()_+<>?"{}.…;[\]!¥(—);“”‘、|《。》?【】]/g;
  24.  
  25. function parseURL(url) {
  26. let a;
  27. a = document.createElement('a');
  28. a.href = url;
  29. return {
  30. source: url,
  31. protocol: a.protocol.replace(':', ''),
  32. host: a.hostname,
  33. port: a.port,
  34. query: a.search,
  35. params: (function () {
  36. let i, len, ret, s, seg;
  37. ret = {};
  38. seg = a.search.replace(/^\?/, '').split('&');
  39. len = seg.length;
  40. i = 0;
  41. s = void 0;
  42. while (i < len) {
  43. if (!seg[i]) {
  44. i++;
  45. continue;
  46. }
  47. s = seg[i].split('=');
  48. ret[s[0]] = s[1];
  49. i++;
  50. }
  51. return ret;
  52. })(),
  53. file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
  54. hash: a.hash.replace('#', ''),
  55. path: a.pathname.replace(/^([^\/])/, '/$1'),
  56. relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
  57. segments: a.pathname.replace(/^\//, '').split('/')
  58. };
  59. }
  60.  
  61. function update_bt_site(title, year, douban_ID, IMDb_ID, title_cn) {
  62. let name, sites;
  63. // title = encodeURI(title.trim());
  64. title = title.trim();
  65. sites = {
  66. // 'RARBG': 'https://proxyrarbg.org/torrents.php?imdb=' + IMDb_ID,
  67. 'BTDigg.EN': 'https://www.btdig.com/search?q=' + title + ' ' + year + ' 1080p',
  68. 'BTDigg.中': 'https://www.btdig.com/search?q=' + title_cn,
  69. '低端影视': 'https://ddys.pro/?s=' + douban_ID,
  70. '茶杯狐': 'https://cupfox.app/search?key=' + title_cn,
  71. 'WebHD': 'https://webhd.top/d/' + douban_ID,
  72. '懒鱼看看': 'https://lykk.top/api/go?doubanId=' + douban_ID,
  73. }
  74.  
  75.  
  76. if (is_series(title))
  77. sites['BTDigg.EN'] = 'https://www.btdig.com/search?q=' + title + ' 1080p'
  78. // if (not_series_01(title))
  79. // sites['RARBG'] = 'https://proxyrarbg.org/torrents.php?search=' + title
  80.  
  81.  
  82. for (name in sites) {
  83. let link = parse_sites(name, sites)
  84. $('#content div.site-bt-body ul').append(link);
  85. }
  86. }
  87.  
  88.  
  89. function update_sub_site(title, douban_ID, IMDb_ID) {
  90. let name, sites;
  91. title = encodeURI(title);
  92.  
  93. sites = {
  94. 'SubHD': 'https://subhd.tv/d/' + douban_ID,
  95. '字幕库': 'https://zimuku.org/search?q=' + IMDb_ID,
  96. '伪射手': 'https://assrt.net/sub/?searchword=' + title,
  97. }
  98.  
  99. for (name in sites) {
  100. let link = parse_sites(name, sites)
  101.  
  102. // //网站限制无法直接跳转,自动复制IMDb_ID到剪贴板,手动粘贴搜索
  103. // if (name === "字幕库") {
  104. // link.on('click', function () {
  105. // GM_setClipboard(IMDb_ID)
  106. // });
  107. // }
  108.  
  109. $('#content div.site-sub-body ul').append(link);
  110. }
  111. }
  112.  
  113. function parse_sites(name, sites) {
  114. let link = sites[name], link_parsed = parseURL(link);
  115. let aTag = $('<a></a>')
  116. link = aTag.attr('href', link);
  117. link.attr('data-host', link_parsed.host);
  118. link.attr('target', '_blank').attr('rel', 'nofollow');
  119. link.html(name);
  120.  
  121. return link
  122. }
  123.  
  124. function get_other_title_en(other_title) {
  125. let other_title_en = '';
  126. //获取第一个英文副标题
  127. other_title.split("/").some((item) => {
  128. if (en_total_reg.test(item)) {
  129. other_title_en = item;
  130. return true;
  131. }
  132. });
  133. return other_title_en
  134. }
  135.  
  136. function is_series(name) {
  137. return /S\d+$/.test(name);
  138. }
  139.  
  140. function not_series_01(name) {
  141. return /S\d+$/.test(name) & !name.endsWith('S01');
  142. }
  143.  
  144. function format_series_name(name) {
  145. if (!/\sSeason\s\d+$/.test(name))
  146. return name
  147. let name_arr = name.split("Season")
  148. let series_id = name_arr.slice(-1)[0].trim().padStart(2, '0')
  149. return name_arr[0] + "S" + series_id
  150. }
  151.  
  152. function main() {
  153. const seBwhA = document.createElement("a");
  154. seBwhA.id = "seBwhA";
  155. document.getElementsByTagName("html")[0].appendChild(seBwhA);
  156.  
  157. $(document).ready(() => {
  158.  
  159. let site_sub = $(aside_html), selector = $('#content div.aside');
  160. site_sub.addClass('name-offline');
  161. site_sub.find('div.c-aside-body').addClass('site-sub-body');
  162. site_sub.find('h2 i').text('字幕直达');
  163. selector.prepend(site_sub);
  164.  
  165. let site_bt = $(aside_html);
  166. site_bt.addClass('site_bt');
  167. site_bt.find('div.c-aside-body').addClass('site-bt-body');
  168. site_bt.find('h2 i').text('BT 搜索');
  169. selector.prepend(site_bt);
  170.  
  171.  
  172. let h1_span, title_cn, title_en, title_en_sub, bt_title, year, douban_ID, IMDb_ID;
  173.  
  174. h1_span = $('#content > h1 > span');
  175. let title_all = h1_span[0].textContent
  176.  
  177. if (cn_total_reg.test(title_all)) {
  178. //名称只有中英文时匹配英文——————————————
  179. title_en = title_all.match(en_end_reg);
  180. title_en = title_en ? title_en[0] : '';
  181. }
  182.  
  183. if (title_en) {
  184. //有英文名时匹配中文——————————————
  185. title_cn = title_en ? title_all.split(title_en)[0] : '';
  186. } else {
  187. //直接匹配中文——————————————
  188. title_cn = title_all.match(cn_start_reg);
  189. title_cn = title_cn ? title_cn[0] : '';
  190. }
  191.  
  192. //检查名称——————————————
  193. // console.log(title_all.length, (title_en + title_cn).length)
  194. if ((title_all.length !== (title_en + title_cn).length)) {
  195.  
  196. title_cn = ""
  197. let title_array = title_all.split(" ");
  198. title_array.some(item => {
  199. if (!cn_total_reg.test(item))
  200. return true
  201. title_cn += item + " "
  202. })
  203.  
  204. title_en = ''
  205. }
  206.  
  207. //解析info内容
  208. let info_text = $('#info')[0].innerText, info_map = {}
  209. // console.log(info_text);
  210. info_text.split("\n").forEach(line => {
  211. let index = line.indexOf(":")
  212. if (index > 0)
  213. info_map[line.slice(0, index).trim()] = line.slice(index + 1).trim()
  214. })
  215. // console.log(info_map);
  216.  
  217. //匹配备用英文名——————————————
  218. title_en_sub = info_map["又名"];
  219. title_en_sub = title_en_sub ? get_other_title_en(title_en_sub) : '';
  220.  
  221. bt_title = title_en || title_en_sub || title_cn;
  222. //规范的命名只保留英文字母
  223. bt_title = bt_title.replaceAll(symbol_delete_reg, ' ').replace('\'', '').replace(/\s+/g, ' ').trim();
  224. bt_title = format_series_name(bt_title)
  225.  
  226. // title_en = title_en ? title_en[0] : '';
  227.  
  228.  
  229. // console.log('title_all:' + title_all);
  230. // console.log('title_en:' + title_en);
  231. // console.log('title_cn:' + title_cn);
  232. // console.log('title_en_sub:' + title_en_sub);
  233. // console.log('bt_title:' + bt_title);
  234.  
  235. // console.log(" h1_span[1].textContent", h1_span[1].textContent);
  236. year = h1_span[1].textContent.substr(1, 4);
  237.  
  238. douban_ID = location.href.split('\/')[4] || title_cn;
  239.  
  240. IMDb_ID = info_map["IMDb"];
  241. IMDb_ID = IMDb_ID ? IMDb_ID : title_cn;
  242. // console.log('IMDb_ID', IMDb_ID);
  243.  
  244. update_bt_site(bt_title, year, douban_ID, IMDb_ID, title_cn);
  245. update_sub_site(title_cn, douban_ID, IMDb_ID);
  246.  
  247. });
  248. }
  249.  
  250. main()

QingJ © 2025

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