Ourbits Movie Uploady

Auto get movie&TV info from douban&imdb for Ourbits

  1. // ==UserScript==
  2. // @name Ourbits Movie Uploady
  3. // @namespace https://pterclub.com/forums.php?action=viewtopic&topicid=3391
  4. // @version 0.1.7
  5. // @description Auto get movie&TV info from douban&imdb for Ourbits
  6. // @author scatking
  7. // @match https://ourbits.club/upload.php*
  8. // @match https://ourbits.club/edit.php*
  9. // @require https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js
  10. // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
  11. // @icon https://pterclub.com/favicon.ico
  12. // @grant GM.xmlHttpRequest
  13. // @grant GM_xmlhttpRequest
  14. // ==/UserScript==
  15. async function fill_form(response) {
  16. let data = response.response;
  17. let poster = data['poster'];
  18. function up2imgbb(){
  19. GM.xmlHttpRequest({
  20. method: "GET",
  21. url: 'https://api.imgbb.com/1/upload?key=cc322c352c9f362350d05c7823995020&image='+poster,
  22. responseType: 'json',
  23. onload: function (response) {
  24. if (response.response.success === true) {poster = response.response.data.display_url;}
  25. const descr =data['format'];
  26. const img_descr = `[img]${poster}[/img]` + descr.replace(/\[img].*\[\/img]/,'') ;
  27. $('#descr').val(img_descr)
  28. }
  29. })
  30. }
  31. await up2imgbb();
  32. if (data['site'] === 'douban'){
  33. var trans_titles='',directors='',casts='';
  34. if (data['foreign_title'].length == 0){ trans_titles= data['chinese_title']}
  35. else {
  36. data.trans_title.forEach(function (trans_title) {
  37. let reg_title = trans_title.replace(/[a-zA-Z\s]/g,'');
  38. if (reg_title.length != 0 && reg_title != trans_title){reg_title = trans_title}
  39. trans_titles += reg_title + ' '
  40. });
  41. }
  42. data.director.forEach(function (director) {
  43. directors = /(.+?)\s/.exec(director['name']).pop()
  44. });
  45. var actors = data.cast.slice(0,3);
  46. actors.forEach(function (cast) {
  47. casts += /(.+?)\s/.exec(cast['name']).pop()+' '
  48. });
  49. let subtitle = trans_titles + ' | ' + "导演:" + directors + ' | ' + '主演:' + casts;
  50. subtitle= subtitle.replace(/\s+/g,' ');
  51. $('input[name="url"][type="text"]').val(data['imdb_link']);
  52. $('input[name="small_descr"]').val(subtitle)
  53. }
  54. }
  55. function triger(url) {
  56. function get_info(url) {
  57. GM.xmlHttpRequest({
  58. method: "GET", //We call the Steam API to get info on the game
  59. url: "https://autofill.scatowl.workers.dev/?url="+url,
  60. responseType: "json",
  61. onload: fill_form
  62. });
  63. }
  64. if (url.indexOf("douban.com/") !== -1){ get_info(url)}
  65. else {
  66. let id = /\/(tt\d+)/.exec(url).pop();
  67. GM.xmlHttpRequest({
  68. method: "GET", //We call the Steam API to get info on the game
  69. url: "https://autofill.scatowl.workers.dev/?search="+id,
  70. responseType: "json",
  71. onload: function (response) {
  72. try {
  73. url = response.response.data[0].link;
  74. $('input[name="douban"]').val(url);
  75. }
  76. catch (TypeError) {console.log('no douban page')}
  77. finally {get_info(url);}
  78. }
  79. });
  80. }
  81. }
  82. function writeInto(){
  83. const subtitle = $('input[name="small_descr"]');
  84. const cstext = subtitle.val() + "[国语中字]";
  85. subtitle.val(cstext);
  86. }
  87. function replaceimg(){
  88. let descr = $('#descr').val();
  89. let poster = /\[img](.*)\[\/img]/.exec(descr)[1];
  90. console.log(poster);
  91. GM.xmlHttpRequest({
  92. method: "GET",
  93. url: 'https://api.imgbb.com/1/upload?key=cc322c352c9f362350d05c7823995020&image='+poster,
  94. responseType: 'json',
  95. onload: function (response) {
  96. if (response.response.success === true) {poster = response.response.data.display_url;}
  97. console.log('OK');
  98. const img_descr = descr.replace(/\[img].*\[\/img]/,`[img]${poster}[/img]`) ;
  99. $('#descr').val(img_descr)
  100. }
  101. })
  102. }
  103. (function() {
  104. 'use strict';
  105. let name = $('input[name="name"][type="text"]');
  106. let imdb_url = $('input[name="url"][type="text"]');
  107. //let douban_url = $('input[name="douban"]');
  108. let subtitle = $('input[name="small_descr"]');
  109. name.after('<a href="javascript:;" id="imgbb" style="color:green">Imgbb it</a>');
  110. imdb_url.after('<a href="javascript:;" id="fill_imdb" style="color:green">Auto Fill</a>');
  111. douban_url.after('<a href="javascript:;" id="fill_douban" style="color:green">Auto Fill</a>');
  112. subtitle.after('<a href="javascript:;" id="fill_cs" style="color:green">[国语中字]</a>');
  113. $('#imgbb').click(function () {replaceimg()});
  114. $('#fill_cs').click(function () {writeInto()});
  115. $('#fill_imdb').click(function () {triger(imdb_url.val())});
  116. $('#fill_douban').click(function () {triger(douban_url.val())})
  117. })();

QingJ © 2025

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