UncleMeat / gazelle

Other
8 stars 4 forks source link

REQUEST: IMDB #5

Open Atmos01 opened 8 years ago

Atmos01 commented 8 years ago

Hi All,

This source is the best ive seen so far.. but like all other sources i would like to have some extras..

I Do not know if there is still any support on this but would like to have IMDB bb code like this:

[imdb]http://www.imdb.com/title/tt1431045/[/imdb] or [imdb]tt1431045[/imdb]

Here is the source: https://github.com/FabianBeiner/PHP-IMDB-Grabber

Already have the function from a phpbb mod:

/*
* IMDB code
*/

    function bbcode_imdb($var1)
    {
        global $phpEx;

    include('mods/imdb.' . $phpEx);

        if(intval($var1))
        {
            $imdb = new IMDB('http://www.imdb.com/title/tt' . $var1);
        }
        else
            {
                $var1 = preg_replace('#[^\d]+#', '', $var1);
                $imdb = new IMDB('http://www.imdb.com/title/tt' . $var1);
            }

        if($imdb->isReady && $imdb->getTitle() != 'N/A')
        {
        $imdb_percentage = ($imdb->getRating() / 10 * 100);

              if($imdb->getPoster() == 'n/A')
        {
        $Message = '[imdb_wrap]';
              }
              else
              {
              $Message = '[imdb_wrap][img]https://xxx.xom/posters' . ltrim($imdb->getPoster(),".") . '[/img]';
              }
        $Message .= '[imdb_title][url=' . $imdb->getUrl() . ']' . $imdb->getTitle() . '[/url][/imdb_title]';
        $Message .= '[list][*][b]Tagline:[/b][i] ' . $imdb->getTagline() . '[/i]';
        $Message .= '[*][b]Genre:[/b][i] ' . $imdb->getGenreAsUrl() . '[/i]';
        $Message .= '[*][b]Rating:[/b] [i]' . $imdb->getRating() . '/10[/i] [imdb_stars]' . $imdb_percentage . '[/imdb_stars][i]from ' . $imdb->getVotes() . ' votes[/i]';
        $Message .= '[*][b]Runtime:[/b] [i]' . $imdb->getRuntime() . ' minutes[/i]';
        $Message .= '[*][b]Release date:[/b][i] ' . $imdb->getReleaseDate() . '[/i]';
        $Message .= '[*][b]Trailer link:[/b][i] ' . $imdb->getTrailerAsUrl() . '[/i]';
        $Message .= '[*][b]Director:[/b][i] ' . $imdb->getDirectorAsUrl() . '[/i]';
              $Message .= '[*][b]Cast:[/b][i] ' . $imdb->getCastAsUrl(14) . '[/i]';
        $Message .= '[*][b]Plot:[/b] ' . $imdb->getPlot() . '<br /><br />[/list][/imdb_wrap]';
        }
        else
            {
                $Message = '[imdb_wrap][imdb_credits]Find a movie. [url=http://www.imdb.com]IMDB - The Internet Movie Database[/url][/imdb_credits][size=130]Movie Not Found![/size][/imdb_wrap]';
            }
              $Message = str_replace("\x85", "...", $Message);
        return $Message;

    }

I tried to work some out in classes/class_text.php but failed :dancer:

If someone can point me in the right direction on how to get this done would be awesome.

ps. it should look like this:

image

L4nz commented 8 years ago

I wouldn't recommend adding any scraper functionality to the bbcode. Because this means it will access imdb every time someone visits that torrent page, or forum post or wherever you allow them to use that tag. That will both slow down page loading time, and most likely get your domain banned from imdb when the site access it over and over for the same information.

The right thing to do is to scrape the information and store it locally on the server.

Just my 2c.

Atmos01 commented 8 years ago

Ok, thank you for your answer. Im not a php developer so this is a no go for me :dancer: