Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BETA Scripts #80

Open
Ephellon opened this issue Jul 13, 2019 · 4 comments
Open

BETA Scripts #80

Ephellon opened this issue Jul 13, 2019 · 4 comments
Assignees
Labels
beta this is in testing (BETA) and requires beta-testers (active feedback) cant-fix requests that can't be fixed by the developers (usually user oriented actions) discussion open ended forum to keep some issues down enhancement this item makes the project better in some way help-wanted outside assistance is recommended for this item question requests that are questions, rather than informative statements wiki requests that can be added to the Wiki for future users

Comments

@Ephellon
Copy link
Collaborator

A place to test scripts that require special access or instances.

@Ephellon Ephellon added enhancement this item makes the project better in some way help-wanted outside assistance is recommended for this item question requests that are questions, rather than informative statements discussion open ended forum to keep some issues down wiki requests that can be added to the Wiki for future users beta this is in testing (BETA) and requires beta-testers (active feedback) labels Jul 13, 2019
@Ephellon Ephellon self-assigned this Jul 13, 2019
@Ephellon
Copy link
Collaborator Author

Ephellon commented Jul 13, 2019

Pass the Popcorn (Invitation Only)

Translation of @inonprince's /ptp.js

// Pass the Popcorn requires: api

let plugin = {
    "url": "*://*.passthepopcorn.me/torrents.php",

    "ready": () => !$('.page__main-content').empty,

    "timeout": 3000,

    "init": async(ready) => {
        let _title, _year, _image, R = RegExp;

        let title, year, image, TMDbID,
            type = 'movie',
            IMDbID = script.getIMDbID(),
            OBJECT;

        await fetch(`https://api.themoviedb.org/3/find/${ IMDbID }?api_key=${ configuration.TMDbAPI }&external_source=imdb_id`)
            .then(r => r.json())
            .then(json => {
                let results = json.movie_results;
                if(json && results && results.length) {
                    results = results.filter(o => o.id && o.title && o.release_date)[0];

                    title  = results.title;
                    year   = results.release_date.slice(0, 4) | 0;
                    TMDbID = results.id;
                }

                if(!TMDbID || !title)
                    throw `Unable to get information for "${ IMDbID }"`;

                IS_DONE = top.IS_DONE = true;

                return OBJECT = { type, title, year, IMDbID, TMDbID };
            })
            .catch(error => { throw error });

        if(IS_DONE && OBJECT)
            return OBJECT;
        return plugin.timeout;
    },

    "getIMDbID": () => {
        let link = $('#imdb-title-link').first;

        if(link)
            return link.href.replace(/^[^]+(tt\d+)\b[^]*$/, '$1');
    },
},
    IS_DONE = top.IS_DONE = (top.IS_DONE || false);

@Ephellon Ephellon pinned this issue Jul 13, 2019
Repository owner locked and limited conversation to collaborators Aug 2, 2019
Repository owner unlocked this conversation Aug 2, 2019
@Ephellon Ephellon added the cant-fix requests that can't be fixed by the developers (usually user oriented actions) label Aug 8, 2019
@Ephellon

This comment has been minimized.

@Ephellon Ephellon unpinned this issue Dec 12, 2019
@Ephellon
Copy link
Collaborator Author

Ephellon commented Jan 1, 2020

Plugin API is pretty solid, will close soon. The only "fix" would be getting async calls to work correctly

@Ephellon
Copy link
Collaborator Author

Ephellon commented Jan 1, 2020

Message passing, maybe, but the function must return a value... I'll make a switch for this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta this is in testing (BETA) and requires beta-testers (active feedback) cant-fix requests that can't be fixed by the developers (usually user oriented actions) discussion open ended forum to keep some issues down enhancement this item makes the project better in some way help-wanted outside assistance is recommended for this item question requests that are questions, rather than informative statements wiki requests that can be added to the Wiki for future users
Projects
None yet
Development

No branches or pull requests

1 participant