IMDB Watchlist on Netflix?

Add Netflix availablity to IMDB watchlist

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        IMDB Watchlist on Netflix?
// @namespace   http://rasmuswriedtlarsen.com
// @description Add Netflix availablity to IMDB watchlist
// @include     http://*.imdb.com/user/*/watchlist*
// @version     0.1
// @grant       none
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==

// Not always accurate :(

// Based on https://greasyfork.org/en/scripts/10290-imdb-title-y-n-on-netflix/code
// and button from https://greasyfork.org/en/scripts/12219-imdb-netflix-button/code

(function(){
    $('.lister-item-header').each( function(){
        //used for span id, as it cannot contain spaces
        var title_ref_re = /\/title\/(.*?)\//;

        var header = $(this);
        var title = $('a',this).text();
        var title_ref = title_ref_re.exec( $('a',this).attr('href') )[1];
        var year = /\d+/.exec($('.lister-item-year', this).text())[0];

        var spanTitle = "netflix-checker-"+title_ref;
        $(header).append('<span id=\''+spanTitle+'\' style=\'font-size: 10px; color: White; font-weight: bold; padding:4px;\'></span>');
        $.ajax({ url: 'http://netflixroulette.net/api/api.php?title=' + title + '&year=' + year
        }).done(function(data) {
            var nID = data['show_id'];

            $('#'+spanTitle).html('<a href="http://netflix.com/watch/' + nID + '" target="_new" style="color: #fff;text-decoration: underline;">On Netflix</a>');
            $('#'+spanTitle).css('background-color', 'green');
        }).error(function(err) {
            $('#'+spanTitle).text('Not on Netflix');
            $('#'+spanTitle).css('background-color', 'red');});
        console.log(title+"|"+year);
    }
);
})();