Grab IMDB Info

Grabs IMDB info from the provided ID.

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/20373/659178/Grab%20IMDB%20Info.js

  1. /*
  2. * name Grab IMDB Info
  3. * namespace pxgamer
  4. * version 0.3.1
  5. * description Grabs IMDB info from the provided ID.
  6. * author pxgamer
  7. */
  8.  
  9. function imdbG(id) {
  10. 'use strict';
  11.  
  12. let imdb = {
  13. imdbId: id,
  14. mScore: '',
  15. poster: '',
  16. description: '',
  17. genres: '',
  18. ageRating: '',
  19. duration: '',
  20. writers: '',
  21. stars: ''
  22. };
  23.  
  24. $.ajax({
  25. url: 'https://www.imdb.com/title/tt'+imdb.imdbId+'',
  26. method: 'GET',
  27. returnData: 'html',
  28. success: function(data) {
  29. imdb.mScore = $('div.metacriticScore span', data).text();
  30. imdb.poster = $('div.slate_wrapper div.poster a img[itemprop="image"]', data).attr('src');
  31. imdb.description = $('#titleStoryLine div.inline.canwrap[itemprop="description"] p', data).text().trim();
  32. imdb.genres = $('div.see-more.inline.canwrap[itemprop="genre"]', data).text().replace(/Genres:\n /g, '').replace(/\n/g, '').trim();
  33. imdb.ageRating = $('div.txt-block span[itemprop="contentRating"]', data).text();
  34. imdb.duration = $('div.txt-block time[itemprop="duration"]', data).text();
  35. imdb.director = $('span[itemprop="director"] a span[itemprop="name"]', data).text();
  36. imdb.writers = $('div.credit_summary_item span[itemprop="creator"]', data).text().replace(/ /g, '').replace(/\n/g, '');
  37. imdb.stars = $('div.credit_summary_item span[itemprop="actors"]', data).text().replace(/ /g, '').replace(/\n/g, '');
  38.  
  39. console.log(imdb);
  40. }
  41. });
  42.  
  43. }