Coder Social home page Coder Social logo

twtom041 / popcorn-time_anime_localhost_server Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 74 KB

This project is about Popcorn-Time. Currently, the official APIs are not able to provide anime data, this project might do the job.

Python 100.00%
anime popcorn-time flask

popcorn-time_anime_localhost_server's Introduction

Popcorn-Time_anime_localhost_server

This project is about Popcorn-Time. Currently, the official APIs are not able to provide anime data, this project might do the job.

How to use

Installation

  1. clone the repo
git clone https://github.com/TWTom041/Popcorn-Time_anime_localhost_server.git
  1. install the required modules for this repo
pip install requirements.txt
  1. complete auth_kitsu.json
    example:
{
  "access_token": "1dxCxes5gnPkQV9juv2pxA2MU4gdlskcyROOCXKLwjA",
  "token_type": "Bearer",
  "expires_in": 2592000,
  "refresh_token": "5UjncPIvSKVeyQPy5kzl6zkKwew4mc8qPziY7eE19qQ",
  "scope": "public",
  "created_at": 1658001009
}
  1. go to the root of Popcorn Time App, which is usually at %appdata%/Local/Popcorn-Time
  2. append some lines to /src/app/lib/views/browser/item.js:
...
// around line 221:
showDetail: function (e) {
            e.preventDefault();

            var realtype = this.model.get('type');
            var itemtype = realtype.replace('bookmarked', '');
            var providerType = itemtype === 'show' ? 'tvshow' : itemtype;
            var providers = {torrent:App.Config.getProviderForType(providerType)[0]};
            // ----------new added------------
            // I don't know why but these lines worked for me
            $(".spinner").show();
            var temp = this.model;
            if (this.model.get("anime") || true) {
                    $.ajax({
                            url: "http://127.0.0.1:5000/anime/"+this.model.get("_id"),
                            type: 'GET',
                            async: false,
                            cache: false,
                            timeout: 60000,
                            error: function(){
                            $(".spinner").hide();
                            return true;},
                            success: function(msg){
                                    console.log(temp);
                                    var obj3 = {};
                                    msg = JSON.parse(JSON.stringify(msg))
                                    for (var attrname in temp["attributes"]) { obj3[attrname] = temp["attributes"][attrname]; }
                                    console.log(obj3["torrents"]);
                                    for (var attrname in msg) { obj3[attrname] = msg[attrname]; }
                                    console.log(obj3);
                                    temp.attributes = obj3;
                                    console.log(temp);
                            }
                    })
                    $(".spinner").hide();
            }
            console.log(this.model);
		//----------added end--------------
		this.model.set('providers', providers);
            var id = this.model.get(this.model.idAttribute);

            var promises = Object.values(providers).map(function (p) {
              if (realtype === 'show') {
                p = providers.torrent;
              }
                if (!p.detail) {
                    return false;
                }
                return p.detail(id, this.model.attributes);
            }.bind(this));
...

about how to get access_token and refresh_token, check the kitsu api docs:
https://hummingbird-me.github.io/api-docs/#section/Authentication/Obtaining-an-Access-Token

Usage

cd to the directory where main.py is, and run the server like this

python main.py [port]

example:

python main.py 5000

the server api will be at localhost:5000/
then go to Popcorn Time's settings, change the anime api to http://localhost:5000/ or http://127.0.0.1:5000/
and the anime is now watchable

Known issue

  1. "sometimes" torrent scrapper might not work
  2. Popcorn Time will lag a long bit to wait for the localhost server to load

Todo

  1. Database support
  2. Other website support. (only kitsu api supported now)

Declaration

This project can only be used for educational purpose.

popcorn-time_anime_localhost_server's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

nandansharma

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.