movie-easy-download

在豆瓣电影页面添加电影和字幕的下载链接

  1. // ==UserScript==
  2. // @namespace https://www.github.com/fytriht/
  3.  
  4. // @name movie-easy-download
  5.  
  6. // @description 在豆瓣电影页面添加电影和字幕的下载链接
  7.  
  8. // @homepageURL https://github.com/fytriht/movie-easy-download
  9. // @supportURL https://github.com/fytriht/movie-easy-download/issues/
  10.  
  11. // @author fytriht
  12. // @version 0.0.1
  13. // @license MIT
  14.  
  15.  
  16. // @match https://movie.douban.com/subject/*
  17. // @grant none
  18. // ==/UserScript==
  19.  
  20. (function () {
  21.  
  22. var sites = [
  23. {
  24. text: 'rargb',
  25. api: 'https://rarbg.to/torrents.php?search='
  26. },
  27. {
  28. text: 'torrentz',
  29. api: 'https://torrentz2.eu/search?f=',
  30. },
  31. {
  32. text: 'addic7ed',
  33. api: 'http://www.addic7ed.com/search.php?Submit=Search&search='
  34. },
  35. {
  36. text: 'openst',
  37. api: 'https://www.opensubtitles.org/en/search2/sublanguageid-eng/moviename-'
  38. }
  39. ];
  40.  
  41. function createEl (querystring) {
  42. return function (text, api) {
  43. var el = document.createElement('span');
  44. el.innerText = text;
  45. el.style.margin = '0 5px';
  46. el.style.color = '#f0f3f5';
  47. el.addEventListener('click', () => window.open(api + querystring));
  48. return el;
  49. };
  50. }
  51.  
  52. function appendTo (cont) {
  53. return function (el) {
  54. cont.appendChild(el);
  55. };
  56. }
  57.  
  58. try {
  59. var title = document.querySelector('[property="v:itemreviewed"]').innerText;
  60. var qs = title.match(/[a-z0-9]+/gi).join('%20');
  61.  
  62. if (qs === null) return;
  63.  
  64. var cont = document.querySelector('#content > h1');
  65.  
  66. var appendToCont = appendTo(cont);
  67. var fn = createEl(qs);
  68.  
  69. sites
  70. .map(site => fn(site.text, site.api))
  71. .forEach(el => appendToCont(el));
  72. }
  73. catch (_) {/* fail silently */}
  74.  
  75. })();
  76.  

QingJ © 2025

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