Giter VIP home page Giter VIP logo

imdb-importer's Introduction

IMDb ratings importer

The IMDb ratings importer is pretty straightforward. It allows you to import your rating from a json file onto the website itself.

This importer was written so that I could import my ratings from other movie tracking websites (such as Rotten Tomatoes) onto IMDb.

Requirements

  • PHP 5.4 <

How to use

In order to use the exporter, you will need to do a couple of things:

  1. You need to figure out 2 values that you will need to pass to the constructor of IMDbImporter. The first value is the id key/value cookie that you receive when you log onto IMDb. You can get the value by logging into your IMDb account and then finding the id key. The second value you need to pass is the rating base of the file you are importing from. For instance, if all the ratings you have in your json files are on 5 (such as 3.5 out of 5, 5 out of 5, etc.), then the RATING_BASE would be 5. This way, the script takes care of converting the source rating base into IMDb rating base (which is 10).

  2. Write a simple script that will load the importer, set the required values and then finally call submit(). Submit receives 1 argument, which is the array of movie titles/rating you want to import.

<?php
require_once 'vendor/autoload.php';

use ImdbImporter\Importer;

// Change FILE to the location of your input json data file
$input = json_decode(file_get_contents('FILE.json'), true);
// Another option
// $input = [['title' => 'The Mask', 'rating' => '5.0']];
// Change ID_FROM_COOKIE
$id = 'ID_FROM_COOKIE';
// Change RATING_BASE
$rating_base = RATING_BASE;

$importer = new Importer($id, $rating_base);
$importer->submit($input);

Example

<?php
require_once 'vendor/autoload.php';

use ImdbImporter\Importer;

$input = json_decode(file_get_contents('my_ratings.json'), true);
$id = 'BCYj3D0pzQplRCdWOk999sALuG13hRj53tUCHy5SPlDT7GjcRHw0K-CWnzGsJPg8VC5jEw64mlaSucVtkCjKhvKZYO2SQ0CSTbspanBkgCdqHwRAlx_3h64JcwJLcU3Mmz2OTPr6BC7zrHzozJZ0BcsTNeEXLcsggl7-RsEIFYEnqdE';
$rating_base = 5;

$importer = new Importer($id, $rating_base);
$importer->submit($input);

Done! All the movies that are in your JSON input file should be now rated on IMDb.

Input format

The expected input format is pretty simple and minimalist. It is an array of arrays, each containing the title of the movie and the rating you gave it.

<?php
[
  [
    "title" => "The Mask",
    "rating" => "5.0"
  ],
  [
    "title" => "The Matrix",
    "rating" => "5.0"
  ]
]

License

The code is licensed under the MIT license. See LICENSE.

imdb-importer's People

Contributors

tomzx avatar tboothman avatar paulgendek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.