Git Product home page Git Product logo

php-imdb-grabber's Introduction

PHP IMDb.com Grabber

This PHP library enables you to scrape data from IMDB.com.

This script is a proof of concept. It’s working, but you shouldn’t use it. IMDb doesn’t allow this method of data fetching. I do not use or promote this script. You’re responsible for using it.

The technique used is called “web scraping.” Which means, if IMDb changes any of their HTML, the script is going to fail. I won’t update this on a regular basis, so don’t count on it to be working all the time.

License

The MIT License (MIT)

Example Usage

<?php
include_once 'imdb.class.php';
$IMDB = new IMDB('Movie Title or IMDB URL');
if ($IMDB->isReady) {
    print_r($IMDB->getAll());
} else {
    echo 'Movie not found. 😞';
}

Available Methods

Get all available data

getAll()

Also Known As

getAka()

All local names

getAkas()

Aspect Ratio

getAspectRatio()

Awards

getAwards()

Budget

getBudget()

Cast

getCast($iLimit = 0, $bMore = true) - $iLimit defines the maximum amount of people returned, $bMore if "…" should be added to the string if needed

Cast Images

getCastImages($iLimit = 0, $bMore = true, $sSize = 'small', $bDownload = false) - $iLimit defines the maximum amount of people returned, $bMore if "…" should be added to the string if needed, $sSize defines the size of the cast image "small, mid and big", $bDownload if the cast image should be downloaded or not

Cast (with links)

getCastAsUrl($iLimit = 0, $bMore = true, $sTarget = '') - $iLimit defines the maximum amount of people returned, $bMore if "…" should be added to the string if needed, $sTarget defines a target

Cast and Character

getCastAndCharacter($iLimit = 0, $bMore = true) - $iLimit defines the maximum amount of people returned, $bMore if "…" should be added to the string if needed

Cast and Character (with links)

getCastAndCharacterAsUrl($iLimit = 0, $bMore = true, $sTarget = '') - $iLimit defines the maximum amount of people returned, $bMore if "…" should be added to the string if needed, $sTarget defines a target

Certification

getCertification()

Color

getColor()

Company

getCompany()

Company (with links)

getCompanyAsUrl($sTarget = '') - $sTarget defines a target

Country

getCountry()

Country (with links)

getCountryAsUrl($sTarget = '') - $sTarget defines a target

Creator

getCreator()

Creator (with links)

getCreatorAsUrl($sTarget = '') - $sTarget defines a target

Description

getDescription()

Director

getDirector()

Director (with links)

getDirectorAsUrl($sTarget = '') - $sTarget defines a target

Distributor

getDistributor($iLimit = 0, $bMore = true) - $iLimit defines the maximum amount of distributors returned, $bMore if "…" should be added to the string if needed

Distributor (with links)

getDistributorAsUrl($sTarget = '') - $sTarget defines a target

Episode

getEpisodeTitle() - returns the episode title of the tv show

Genre

getGenre()

Genre (with links)

getGenreAsUrl($sTarget = '') - $sTarget defines a target

Gross

getGross() to get cumulative worldwide gross

Language

getLanguage()

Language (with links)

getLanguageAsUrl($sTarget = '') - $sTarget defines a target

Location

getLocation()

Location (with links)

getLocationAsUrl($sTarget = '') - $sTarget defines a target

MPAA

getMpaa()

Metacritics

getMetaCritics() - returns all critic reviews

Metascore

getMetaScore() - returns the average score and number of votes based on metacritic.

Music Composer

getMusic()

Music Composer (with links)

getMusicAsUrl($sTarget = '') - $sTarget defines a target

Plot

getPlot($iLimit = 0) - $iLimit defines the maximum characters returned

Plot Keywords

getPlotKeywords()

Poster

getPoster($sSize = 'small', $bDownload = true) - $sSize defines small or big poster size, $bDownload if the poster should be downloaded or not

Rating

getRating()

Release Date

getReleaseDate()

Release Dates

getReleaseDates() returning all release dates for each country

Runtime

getRuntime()

Seasons

getSeasons()

Seasons (with links)

getSeasonsAsUrl($sTarget = '') - $sTarget defines a target

Sound Mix

getSoundMix()

Tagline

getTagline()

Title

getTitle($bForceLocal = false) - $bForceLocal tries to return the original name of the movie

Trailer

getTrailerAsUrl($bEmbed = false) - $bEmbed defines if you want to link to player directly or not.

TVInfo

getTVInfo() - returns an array of all season/episodes of a tv show (includes plot/rating/votes/airdate).

Type

getType() - returns the type of the title (movie, tv episode, tv series)

Url

getUrl()

User Review

getUserReview()

Votes

getVotes()

Writer

getWriter()

Writer (with links)

getWriterAsUrl($sTarget = '') - $sTarget defines a target

Year

getYear()

Bugs?

If you run into any malfunctions, feel free to submit an issue. Make sure to enable debugging: const IMDB_DEBUG = true; in imdb.class.php.

php-imdb-grabber's People

Contributors

avariya avatar bla0r avatar bonk-se avatar defro avatar dialga avatar fabianbeiner avatar fliki avatar fzerorubigd avatar jmartin82 avatar kingofnull avatar mali11011 avatar viktorstiskala avatar viniciusgalvao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-imdb-grabber's Issues

added possibility to watch trailer

I added possibility to watch a trailer...

// Define MovieTrailer not found. == BY SEIFER ALMASY®
public $strMovieNotFound = 'not-trailer';

const IMDB_WATCH        = '~<a href="/video/(.*)/"~Ui';

/**
 * Get information about Trailer and create a link to watch this (by seifer almasy)
  */
public function getWatch() {
   if ($this->isReady) {
        if ($strReturn = $this->matchRegex($this->_strSource, IMDB::IMDB_WATCH, 1)) {
           return $strReturn;
        }
       return $this->strMovieNotFound;
    }
    return $this->strMovieNotFound;
}

in your results, place this

iframe width=653 height=467 scrolling=no src=http://www.imdb.com/video/getWatch();?>/player></iframe

voila... my script open a window (using jquery and winmodal script) to open the video) to watch the trailer!
example in http://www.vgbr.com/forum/imdb/imdb_result.php?fname=thor

IMDB Change the code

Title and getTrailer is affected

const IMDB_TITLE = '~<meta property="og:title" content="(.) ((.))."~Ui';

const IMDB_TRAILER ='~href="/video/imdb(.)/"~Ui';

Grab the IMDb ID from people

Hi! I searched for a request page but I didn't find anything.

Can you please add a little feature there your class can grab the IMDb ID from writers, actors, and directors? It would be perfect!

Thanks in advance.

imdb Site changed. (regex adjust)

Due Imdb.com changed their page style , code changed and the script is not usable anymore!
All will really appreciate if someone can fix the regex part, so this script dont die.
Thank you.

Soundmix, Aspect Ratio, Opening and Official Sites

const IMDB_SITES        = '~<h4 class="inline">Official Sites:</h4>(.*)<span class="see-more inline">~Ui';
const IMDB_OPENING           = '~<h4 class="inline">Opening Weekend:(.*)</div>~Ui'; (not work, but grab info)
const IMDB_SOUNDMIX      ='~<h4 class="inline">Sound Mix:</h4>(.*)</div><div~Ui';
const IMDB_ASPECT_RATIO   ='~<h4 class="inline">Aspect Ratio:</h4>(.*)</div>~Ui';

i have created this, but "sites" and "soundmix" not work properly... not formatted correctly

public function getSites() {
     if ($this->isReady) {
         $arrReturned = $this->matchRegex($this->_strSource, IMDB::IMDB_SITES);
        if (count($arrReturned[1])) {
           foreach ($arrReturned[1] as $i => $strName) {
                $arrReturn[] = $strName;
            }
            return implode(' / ', $arrReturn);
        }
        return $this->strNotFound;
    }
    return $this->strNotFound;
}

public function getSoundMix() {
    if ($this->isReady) {
        $arrReturned = $this->matchRegex($this->_strSource, IMDB::IMDB_SOUNDMIX);
        if (count($arrReturned[1])) {
           foreach ($arrReturned[1] as $strName) {
                $arrReturn[] = $strName;
            }
            return implode(' / ', $arrReturn);
        }
        return $this->strNotFound;
    }
    return $this->strNotFound;
}

public function getAspectRatio() {
    if ($this->isReady) {
        if ($strReturn = $this->matchRegex($this->_strSource, IMDB::IMDB_ASPECT_RATIO, 1)) {
            return $strReturn;
        }
        return $this->strNotFound;
    }
    return $this->strNotFound;
}

Opening referer is a "Opening Week" in US$ milion dolars, but don't work and i removed it

Thank you Fabian! :)

Language

hi um my genre and language is has stopped working i think , keep up the great work . cheers

No exact matches

Hi, is it possible to include in results exact matches if exists ?
At this point the script takes only popular titles.

missing function and feature requests

hi Fabian

would it be possible to get getBudget(); back into the class?

somehow the imdb curl fetcher now grabs a subset of imdb.com and the budget info is no longer part of that subset, was there a reason for that?

also, if it would be possible, i would love to see two more imdb contents:

getMetascore();
getPGRating();

Updated regular expression

Hi,

I got no idea how to update a file. But Cast and Title where broken again. So I fixed it.

const IMDB_CAST         = '~itemprop="actor"(?:.*)><a href="/name/nm(\d+)/(?:.*)" itemprop=\'url\'> <span class="itemprop" itemprop="name">(.*)</span></a>~Ui';
const IMDB_TITLE        = '~<h1 class="header"> <span class="itemprop" itemprop="name">(.*)</span>\s+<span class="nobr">\((.*)\)</span>~Ui';

Didn't find "Creators", "Creators as URL" or "MPAA" so couldn't fix that.

How do I help updating your project?

Incomplete results

Nice job but if I try to scrap a movie (ex:Ironman) with Scrappy (https://www.mashape.com/netfluid-framework/scrappy-web-scraper-for-html5-microdata-semantic-elements) i discover that lot more information are presents

[
{
"itemType":"http://schema.org/Movie",
"awards":[
"Nominated for 2 Oscars.",
"Another 18 wins & 51 nominations."
],
"description":[
"Tony Stark. Genius, billionaire, playboy, philanthropist. Son of legendary inventor and weapons contractor Howard Stark. When Tony Stark is assigned to give a weapons presentation to an Iraqi unit led by Lt. Col. James Rhodes, he's given a ride on enemy lines. That ride ends badly when Stark's Humvee that he's riding in is attacked by enemy combatants. He survives - barely - with a chest full of shrapnel and a car battery attached to his heart. In order to survive he comes up with a way to miniaturize the battery and figures out that the battery can power something else. Thus Iron Man is born. He uses the primitive device to escape from the cave in Iraq. Once back home, he then begins work on perfecting the Iron Man suit. But the man who was put in charge of Stark Industries has plans of his own to take over Tony's technology for other matters. Written by halo1k",
"After being held captive in an Afghan cave, an industrialist creates a unique weaponized suit of armor to fight against evil. This leads him to conflict within his own company."
],
"keywords":[
"Plot Keywords: armor | cave | iron | genius | missile | See All (198) »",
"armor",
"cave",
"iron",
"genius",
"missile"
],
"genre":[
"Genres: Action | Adventure | Sci-Fi",
"Action",
"Adventure",
"Sci-Fi"
],
"url":[
"technical?ref_=tt_dt_spec",
"/offsite/?page-action=offsite-facebook&token=BCYnyIe9ryC6rTJWzl5VnvWcSJucUcsiAH2QmS10UhlMNt4dnbwSpso2OwpynBXaaovXSVIwnGOf%0D%0AlHxXtkAzXII6cTCy2GFoJ4ZF1X_yt-D_4ZvBAQv0jS11eN1UsuYW0zUePWLilYMls5PDB28IHuXE%0D%0AFuafhnmRxSrdI5Y9FhCM-iGmrgUpASHXwLDIKuzE6_yVxvqeemt4ah2KaWqfJL6tL9E8PzsQxDuR%0D%0A1MZmzq3oEhI%0D%0A&ref_=tt_pdt_ofs_offsite_0",
"/offsite/?page-action=offsite-sapo&token=BCYj_UL3CkGt0wguU0H6sBK3Q9SGCkxFYaKa_mv5lmFlp-oyIcaafCMGkVDEkzLIYmTmaukQBKMe%0D%0AfGywn0m2PiPhF5uCpHlO2eeEnqgauYxqyZyK3Hh1ox83z0q8a22VOoa5dj1OYBCWUmeQ76wuy5Z6%0D%0A7VmUKWLRWqyKapiWs_xrcMkiD9rNxH36-ikY4IjXlzc9ddNQS7G1dop57sMnYkoZj_Zy2xmKojgF%0D%0AtUPz6_NmrsU%0D%0A&ref_=tt_pdt_ofs_offsite_1",
"/country/us?ref_=tt_dt_dt",
"/language/en?ref_=tt_dt_dt",
"/language/fa?ref_=tt_dt_dt",
"/language/ur?ref_=tt_dt_dt",
"/language/ar?ref_=tt_dt_dt",
"/search/title?locations=Palmdale+Regional+Airport,+Palmdale,+California,+USA&ref_=tt_dt_dt",
"business?ref_=tt_dt_bus",
"http://pro.imdb.com/title/tt0371746/companycredits?rf=cons_tt_cocred_tt&ref_=cons_tt_cocred_tt",
"http://pro.imdb.com/signup/index.html?rf=cons_tt_cocred_spl&ref_=cons_tt_cocred_spl",
"/search/title?sound_mixes=sdds&ref_=tt_dt_spec",
"/search/title?sound_mixes=dolby_digital&ref_=tt_dt_spec",
"/search/title?sound_mixes=dts&ref_=tt_dt_spec",
"/search/title?colors=color&ref_=tt_dt_spec",
"/plugins?titleId=tt0371746&ref_=tt_plg_rt",
"/plugins?titleId=tt0371746&ref_=tt_plg_rt",
"externalsites?ref_=tt_dt_dt#official",
"releaseinfo?ref_=tt_dt_dt",
"releaseinfo?ref_=tt_dt_dt#akas",
"locations?ref_=tt_dt_dt",
"companycredits?ref_=tt_dt_co"
],
"headline":[
"'Avengers 2' Iron Man Mark Xliii Figure Fully Unveiled",
"Hot Toys Reveal Their 'Iron Man Mark Xliii' Avengers: Age Of Ultron Action Figure",
"New footage from Avengers: Age of Ultron in Audi commercial"
],
"contentRating":[
"12A",
"12A"
],
"audience":{
"itemType":"http://schema.org/Audience",
"url":"/title/tt0371746/parentalguide?ref_=tt_stry_pg"
},
"creator":[
{
"itemType":"http://schema.org/Organization",
"url":"/company/co0023400?ref_=tt_dt_co",
"name":"Paramount Pictures"
},
{
"itemType":"http://schema.org/Organization",
"url":"/company/co0095134?ref_=tt_dt_co",
"name":"Marvel Enterprises"
},
{
"itemType":"http://schema.org/Organization",
"url":"/company/co0051941?ref_=tt_dt_co",
"name":"Marvel Studios"
},
{
"itemType":"http://schema.org/Person",
"url":[
"/name/nm1318843/?ref_=tt_ov_wr",
"/name/nm1319757/?ref_=tt_ov_wr"
],
"name":[
"Mark Fergus",
"Hawk Ostby"
]
}
],
"duration":[
"126 min",
"126 min"
],
"review":{
"itemType":"http://schema.org/Review",
"name":"A Nutshell Review: Iron Man",
"reviewRating":{
"itemType":"http://schema.org/Rating",
"worstRating":"1",
"ratingValue":"10",
"bestRating":"10"
},
"datePublished":"2008-04-30",
"reviewBody":"With a little tinge of shame and regret, my rare dalliances with the Iron Man character stemmed from a few one off comic books, as well as occasions during the teenage years of spending time in the arcade with those Marvel games, where Iron Man was one of my preferred characters because it came together with his incredible arsenal of weapons from repulsor beams to this gigantic cannon which accompanied the execution of some complex combo moves. There's something sexy about the red and gold suit of armour, and having an array of weapons at the disposal of a player, makes perfect sense for variety in dispatching your enemies.This may irk the fervent fans of Iron Man, but face it, the superhero belonged to Tier B where superheroes are concerned, languishing behind easily recognizable peers who already have movie after movie being made. But thanks to the advancement in digital technology, bringing Iron Man to life no longer consisted of the prospect and worrying thought of having a man running about in a rubber suit passing it off as metal, the way Ultraman would have been done, complete with mechanical clicks and whirrs as sound effects to try and fool the visual sensory. Here, we have a very detailed rendering of the entire design from scratch to final modification, and we're in at every step of the way, with many cheeky and sometimes a tad implausible scenes just for cheap laughs thrown in.I thought Iron Man the story worked because of stark (pardon the pun) similarities with Batman Begins, also an origin story which took its time to dwell on the man behind the suit, nevermind at the sacrifice of having less action sequences, or by not giving the fans what they want through the showcase of more than the basic powers. Advanced capabilities can always find room in the sequel, and as the first movie used to establish its characters, I felt that it succeeded, given too that it had a cast of capables (just like Batman Begins had) to pull the movie through without resorting to over the top and campy performances, starting of course with the lead in Robert Downey Jr.In a nutshell, Downey is Tony Stark through and through. His affinity for the character shines, and no doubt it bore some parallels between his own personal, and Stark's life in the narrative future when he hits the bottle. He was allowed to become a Two-Face of sorts, on one hand being and later acting out his flamboyance self whose mission in life was the continuation of his father's legacy of Stark Industries, a weapons conglomerate, versus his personal mission in ridding his own weapons from the hands of the bad guys, now updated to be freedom fighters in the Middle East. The dialogue contained within each scene of Stark's, except perhaps during captivity, is full of one-liners done in double quick time, you probably would think it boiled down to a whole host of natural ad-libbing.But while Starks spends significant amount of time in his unsecured basement building his masterpiece, his human interaction come in the form of faithful secretary Pepper Potts (Gwyneth Paltrow) who actually, for the first time I admit, looked really good on screen as Stark's most trusted aide, bringing about some serious spark of sexual tension and chemistry between the two characters of opposite sex, more so than any other comic book movie I have seen. And good friend from the air force Jim Rhodes (Terrence Howard) complete the circle of trust who knows of Stark's secret identity, and you'd be keeping your fingers crossed at the toss of a teaser of a certain War Machine appearance should the sequel be out. Who's the main villain in the movie? It points the finger at Corporations, or at least here, the weapons manufacturers and the shady deals that go through in the name of profit, the sole objective for any corporation's existence. And Jeff Bridges, in a rare villainous role, got to personify that greed and wrestle for absolute power just like the trailer already suggested. While his performance is refreshing as he disappears behind the ball head and bushy beard, you could see his motivation and how the plot would have been developed to introduced the ultimate fodder for Iron Man to duke it out in a, sad to say, ordinary finale which any audience would probably be able to stay a step ahead.As mentioned earlier, there are plenty of similarities with the Dark Knight of Gotham in Christopher Nolan's reboot, but more so because of properties inherent with the likeness between Bruce Wayne and Tony Stark. Both are incredibly wealthy to devote time outside of the day job to pursue their "hobby", both have to suffer personal tragedies in order to wake up to the cruel world, and in the movie, both fall prey to the corporate raider type, spend time perfecting their suit of war, have assistants they would trust their lives with, and of course save them from impending doom, and a finales set at their facilities.But Iron Man is still a special effects extravaganza offering a thrill ride especially when he goes into battle mode, and without a doubt, Robert Downey Jr probably should be credited for raising the profile of this once Tier-B character, to perhaps becoming more recognizable now, and obviously, expanding the fan base of this weaponry filled suit of metal, which of course, in this origin movie, we were only given a glimpse of its potential. can everyone now spell sequel and clamour for more please? Iron Man has set the bar for the other upcoming comic book movies to try and surpass this summer season!",
"author":"DICK STEEL"
},
"datePublished":[
"1 hours ago",
"2 hours ago",
"10 hours ago",
"2008-05-02"
],
"provider":[
"MovieWeb",
"ComicBookMovie.com",
"Flickeringmyth"
],
"actor":[
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0000375/?ref_=tt_cl_t1",
"name":"Robert Downey Jr."
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0005024/?ref_=tt_cl_t2",
"name":"Terrence Howard"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0000313/?ref_=tt_cl_t3",
"name":"Jeff Bridges"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0000569/?ref_=tt_cl_t4",
"name":"Gwyneth Paltrow"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0004753/?ref_=tt_cl_t5",
"name":"Leslie Bibb"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0869467/?ref_=tt_cl_t6",
"name":"Shaun Toub"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0846687/?ref_=tt_cl_t7",
"name":"Faran Tahir"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0163988/?ref_=tt_cl_t8",
"name":"Clark Gregg"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0810488/?ref_=tt_cl_t9",
"name":"Bill Smitrovich"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0046223/?ref_=tt_cl_t10",
"name":"Sayed Badreya"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0079273/?ref_=tt_cl_t11",
"name":"Paul Bettany"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0269463/?ref_=tt_cl_t12",
"name":"Jon Favreau"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0082526/?ref_=tt_cl_t13",
"name":"Peter Billingsley"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0347375/?ref_=tt_cl_t14",
"name":"Tim Guinee"
},
{
"itemType":"http://schema.org/Person",
"url":"/name/nm0528164/?ref_=tt_cl_t15",
"name":"Will Lyman"
}
],
"thumbnailUrl":[
"/media/rm303336448/tt0371746?ref_=tt_pv_md_1",
"/media/rm2392634368/tt0371746?ref_=tt_pv_md_2",
"/media/rm2409411584/tt0371746?ref_=tt_pv_md_3"
],
"image":[
"http://ia.media-imdb.com/images/G/01/imdb/images/nopicture/small/unknown-1394846836.CB379391227.png",
"http://ia.media-imdb.com/images/G/01/imdb/images/nopicture/small/unknown-1394846836.CB379391227.png",
"http://ia.media-imdb.com/images/G/01/imdb/images/nopicture/small/unknown-1394846836.CB379391227.png",
"http://ia.media-imdb.com/images/M/MV5BMTczNTI2ODUwOF5BMl5BanBnXkFtZTcwMTU0NTIzMw@@.V1_SX214_AL.jpg",
"http://ia.media-imdb.com/images/M/MV5BMTQxOTA2NDUzOV5BMl5BanBnXkFtZTgwNzY2MTMxMzE@.V1_SX86_CR0,0,86,86_AL.jpg",
"http://ia.media-imdb.com/images/M/MV5BMTU0NTgzNTA1OF5BMl5BanBnXkFtZTgwNDMzMzM4NDE@.V1_SX86_CR0,0,86,86_AL.jpg",
"http://ia.media-imdb.com/images/M/MV5BMjMzODA4NDYzM15BMl5BanBnXkFtZTgwMTc0Mzc0NDE@.V1_SX86_CR0,0,86,86_AL.jpg"
],
"director":{
"itemType":"http://schema.org/Person",
"url":"/name/nm0269463/?ref_=tt_ov_dr",
"name":"Jon Favreau"
},
"actors":{
"itemType":"http://schema.org/Person",
"url":[
"/name/nm0000375/?ref_=tt_ov_st",
"/name/nm0000569/?ref_=tt_ov_st",
"/name/nm0005024/?ref_=tt_ov_st",
"fullcredits?ref_=tt_ov_st_sm"
],
"name":[
"Robert Downey Jr.",
"Gwyneth Paltrow",
"Terrence Howard"
]
},
"trailer":"/video/imdb/vi447873305/?ref_=tt_ov_vi",
"name":"Iron Man",
"aggregateRating":{
"itemType":"http://schema.org/AggregateRating",
"ratingValue":"7.9",
"bestRating":"10",
"ratingCount":"571,104",
"reviewCount":[
"1,010 user",
"472 critic"
]
}
}
]

Should a new version use /combined?

I’d like your feedback on this. Switching to the /combined page of a movie has a few advantages – but also a few disadvantages.

This is just a quick brain dump, no research or so has been done.

Advantages

  • The regular expressions are easier, which probably leads to longer lifetime of them. This means, the script wouldn’t need that much attention anymore.
  • For example, the function getCast() could return everything instead of only the first x of a movie – without a second request to IMDb.
  • The /combined page might list more stuff than the overview.

Disadvantages

  • There actually exists stuff on the overview page, that doesn’t exist on the /combined page. For example, the budget.

So, what are your thoughts? Or do you have better insights than I do at the moment?

New movies are "IMDb - <name of movie>"

Here now, new movies in IMDb, as a "IMDb - name of movie"

please how to discard "IMDB -" from title?

old movies as "name of movie - IMDb" i try to remove IMDb but don't have sucess, all new movies in database has this new format, old format working perfect

Thanks

Seasons

Hi,
if seasons are more than 10 only return '1'
ex: 15 season return 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 1 / 1 / 1 / 1 / 1 / 1

and thanks for your great work.

Writer

The script is unable to grab the writer's data.
Thanks

Related, Also and others issues (err, not exactly issue...)

i love this script, but i try to insert new function to grab "Related Videos" a link to open in new window or whatever...

but no have sucess on it, and i try on this following code

const IMDB_RELATED        = '~<h2>Related Videos</h2>(.*)</a>~Ui';

public function getRelated() {
    if ($this->isReady) {
        $arrReturned = $this->matchRegex($this->_strSource, IMDB::IMDB_RELATED);
        if (count($arrReturned[1])) {
            foreach ($arrReturned[1] as $strName) {
                $arrReturn[] = '<a href="http://www.imdb.com/video/' . $strName . '/">' . $strName . '</a>'; 
            }
            return implode(' / ', $arrReturn);
        }
        return $this->strNotFound;
    }
    return $this->strNotFound;
}

but not work, the url not changed to IMDB location...

also, this is a good adicition to Grabber, i think :)

Other adiction i thinking is "Also" (The others names what the movie is called) my code

const IMDB_ALSO        = '~<h4 class="inline">Also Known As:(.*)<span class="see-more inline">~Ui'; 

 public function getAlso() {
    if ($this->isReady) {
        if ($strReturn = $this->matchRegex($this->_strSource, IMDB::IMDB_ALSO, 1)) {
        return $strReturn;
        }
        return $this->strNotFound;
    }
    return $this->strNotFound;
}

thanks :)

getSeasons() doesn't work properly

Hi!

I'm using your wonderful class and everything works like a charm except for the getSeasons() function. This is the problem: when I link to an TV-serie, it says that the TV-serie doesn't have any seasons. I have the latest version of your class and I have only changed $strNotFound, $strSeperator, and the path to the posters and cache.

Thanks in advance.

Hello Fabian can you help me a bit with PHP IMDB GRABER

can u help me a bit with this script i set up a landing page and i`m kind of a noob and i need to know

for exemple i want to define the imdb id tt1022603 as
www.mypage/index.php?id=tt1022603
id = tt1022603

$oIMDB = new IMDB('http://www.imdb.com/title/"id"/');

i hope you understand me what i`m trying to say

like this guy have : http://streamflix.biz/watch.php?movie=1959490

HELPED MYSELF 👍
in case anyone needs

$filename = basename($_SERVER['REQUEST_URI']);

$id = str_replace("index.php?movie=","http://www.imdb.com/title/", $filename);

$oIMDB = new IMDB($id);

Screens value

Is it possible to add the screens value out of the box office.

I mean:
Box office/business:

Opening Weekend
$11,364,505 (USA) (21 February 2012) (1,277 Screens)
€1,764,073 (Italy) (5 February 2012) (458 Screens)

Would love to have this added

Grtz br00m

Html in plot

Example movie: 12 Years A Slave

http://www.imdb.com/title/tt2024544/

Plot (english): Based on an incredible true story of one man's fight for survival and freedom. In the pre-Civil War United States, Solomon Northup (Chiwetel Ejiofor), a free black man from upstate New York, is abducted and sold into slavery. Facing cruelty (personified by a malevolent slave owner, portrayed by Michael Fassbender), as well as unexpected kindnesses, Solomon struggles not only to stay alive, but to retain his dignity. In the twelfth year of his unforgettable odyssey, Solomon's chance meeting with a Canadian abolitionist (Brad Pitt) will forever alter his life.

Episode List

Hey,

I can not get the episodes list of a TV-Serie.

Can help?

getTrailerAsUrl as a mistake, fail to grab any trailers

Explanation: some movies are a different URL...

Thor Movie Example
http://www.imdb.com/video/imdb/vi1431476761/player

Wyse Guys Example
http://www.imdb.com/video/screenplay/vi2104426521/player

after "video" some videos appear "screenplay" not "imdb" that's simple to correct...

Change const IMDB_TRAILER = '~href="/video/imdb/(.)/"~Ui';
To const IMDB_TRAILER = '~href="/video/(.
)/"~Ui';

And

public function getTrailerAsUrl() {
if ($this->isReady) {
if ($strReturn = $this->matchRegex($this->_strSource, IMDB::IMDB_TRAILER, 1)) {
return 'http://www.imdb.com/video/imdb/' . $strReturn . '/player';
}
}
return $this->strNotFound;
}

to

public function getTrailerAsUrl() {
if ($this->isReady) {
if ($strReturn = $this->matchRegex($this->_strSource, IMDB::IMDB_TRAILER, 1)) {
return 'http://www.imdb.com/video/' . $strReturn . '/player';
}
}
return $this->strNotFound;
}

And, please... create function getSeasonsAsUrl :)

Should return array, but is returning strings

Some methods should return arrays, but they are returning strings.

My idea, make different method names returning as string or as arrays:
Example:

    /**
     * Returns the cast.
     *
     * @param int $intLimit limit of cast members (default: 20)
     * @return array The movie cast
     */
    public function getCast($intLimit = 20) { ... }

    /**
     * Returns the cast as string.
     * 
     * @param int $intLimit limit of cast members (default: 20)
     * @return string The movie cast.
     */
    public function theCast($intLimit = 20) 
    {
        $arrayCast = $this->getCast($intLimit);
        return implode($this->strSeperator, $arrayCast);
    }

/tmp keeps filing with $this->_fCookie

Hi,

Just got complain from my shared hosting provider that /tmp keeps filing with files from one of the scripts I'm using. So I have two options... either writes them to directories provided with my account, or that I remove files from /tmp as they are no longer needed...

My knowledge of PHP is low, having said that looking through your script can't see anything obvious why they should be kept, could they be deleted at some point of the script, or not be created at all?

I've redirected them to $_SERVER['DOCUMENT_ROOT'] . '/tmp' for now and I have noticed that files stored there are empty ?

Thank you

Imdb id bug

Hi!

Thank you for the update, you spend a lot of work. I noticed a small bug

only imdb id (tt0367882) be looking at the first download works perfectly, but if you spend your website for the second time, you're completely wrong.

Can you tell me what is the problem?

Best

ps:
sorry my english :D

thumbs

Hi,

first of all thank you for your great work!!
is there a way to get all available movie thumbs? Can you please add this feature?

Keep up your great work man!
thanks!

Multiple movies same title.

Is there a way to further filter out which movie other than just the title.

For example I have 'Alice in Wonderland' the cartoon and 'Alice in wonderland' the recent live action movie.
I've tried adding the year but that doesn't seem to help.

How would I separate those and get the right result for each movie?

Get Full List Image and Video

Get Full List Image Gallery and Video Gallery.

Image: With Info
Get Poster
Get Poster Wide (Detect With Image Link)
Get Only Poster (All)
Get Image Only
Get Full List Image

{
$arr['poster'] = $this->match('/

.?<a name="poster".?><img.?src="(.?)".?</div>/ms', $html, 1);
$arr['poster_large'] = "";
$arr['poster_full'] = "";
if ($arr['poster'] != '' && strpos($arr['poster'], "media-imdb.com") > 0) { //Get large and small posters
$arr['poster'] = preg_replace('/V1.?.jpg/ms', "_V1._SY200.jpg", $arr['poster']);
$arr['poster_large'] = preg_replace('/V1.?.jpg/ms', "_V1._SY500.jpg", $arr['poster']);
$arr['poster_full'] = preg_replace('/_V1.
?.jpg/ms', "_V1._SY0.jpg", $arr['poster']);
} else {
$arr['poster'] = "";
}
}

/**************************************************************/

Video: With Info
Get all Videos
Get all Trailers

public function getVideos($titleId){
    $html = $this->geturl("http://www.imdb.com/title/${titleId}/videogallery");
    $videos = array();
    foreach ($this->match_all('/<a.*?href="(\/video\/imdb\/.*?)".*?>.*?<\/a>/ms', $html, 1) as $v) {
        $videos[] = "http://www.imdb.com${v}";
    }
    return array_filter($videos);
}

As of 28 November 2012 new IMDB search result

As of 28 November 2012 we have launched a new and improved version of our search results page. The following frequently asked questions cover the changes between the old and new search results page.

source: http://www.imdb.com/help/show_leaf?find&ref_=fn_hlp

Result:

  • Search by name ain't working anymore
  • Search by exact imdb url still work

I try to fix it but I don't have the old imdb source to compare and i'm not experienced enough to make the change needed.

BTW: Nice script Fabian I appreciate you're work.

Temporary fix:

1: const IMDB_SEARCH1 " = '~\s+\s+<a href="/title/tt(\d+)/~i'; "

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.