Grabs IMDB info from the provided ID.
目前為
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/20373/130357/Grab%20IMDB%20Info.js
/*
* name Grab IMDB Info
* namespace PXgamer
* version 0.2
* description Grabs the Metacritic metascore for KAT.
* author PXgamer
*/
(function() {
'use strict';
var imdb = {
imdbId: "0803096",
mScore: '',
poster: '',
description: '',
genres: '',
ageRating: '',
duration: '',
writers: '',
stars: ''
};
$.ajax({
url: 'http://www.imdb.com/title/tt'+imdb.imdbId+'',
method: 'GET',
returnData: 'html',
success: function(data) {
imdb.mScore = $('div.metacriticScore span', data).text();
imdb.poster = $('div.slate_wrapper div.poster a img[itemprop="image"]', data).attr('src');
imdb.description = $('#titleStoryLine div.inline.canwrap[itemprop="description"] p', data).text().trim();
imdb.genres = $('div.see-more.inline.canwrap[itemprop="genre"]', data).text().replace(/Genres:\n /g, '').replace(/\n/g, '').trim();
imdb.ageRating = $('div.txt-block span[itemprop="contentRating"]', data).text();
imdb.duration = $('div.txt-block time[itemprop="duration"]', data).text();
imdb.director = $('span[itemprop="director"] a span[itemprop="name"]', data).text();
imdb.writers = $('div.credit_summary_item span[itemprop="creator"]', data).text().replace(/ /g, '').replace(/\n/g, '');
imdb.stars = $('div.credit_summary_item span[itemprop="actors"]', data).text().replace(/ /g, '').replace(/\n/g, '');
console.log(imdb);
}
});
})();