Grab IMDB Info

Grabs IMDB info from the provided ID.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/20373/659178/Grab%20IMDB%20Info.js

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

/*
 *  name         Grab IMDB Info
 *  namespace    pxgamer
 *  version      0.3.1
 *  description  Grabs IMDB info from the provided ID.
 *  author       pxgamer
 */

function imdbG(id) {
    'use strict';

    let imdb = {
        imdbId: id,
        mScore: '',
        poster: '',
        description: '',
        genres: '',
        ageRating: '',
        duration: '',
        writers: '',
        stars: ''
    };

    $.ajax({
        url: 'https://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);
        }
    });

}