Part of the EllisLab Network
   
 
CI IMDb Library
Posted: 03 February 2008 12:31 AM   [ Ignore ]  
Summer Student
Total Posts:  17
Joined  12-30-2007

I’m working on a site using CI right now that interfaces with IMDb.com to retrieve information about movies.  I have tweaked an excellent class called IMDBPHP to work as a CI library.  I thought I’d share it in case it would be useful for someone else.

CI IMDb Library

It uses Pear’s HTTP_Request package or another PHP class called browseremulator (included in the zip) to connect to IMDb.com and scrape information.  Pages can also be cached to speed up lookups.

Using the ID from IMDb.com, you can retrieve any info about a particular movie (run time, date, cast, directors, plot, etc).  You can also use the library to search IMDb for these IDs based on a movie title.

The code was fairly well documented, and there is an API reference available on the IMDBPHP site.

A quick note - IMDb changes their layout semi-regularly and this can sometimes cause pieces of the script to break.  You should keep an eye on the IMDBPHP home page as the maintainers are usually pretty good with posting updates to fix such issues.

Enjoy!

Profile
 
 
Posted: 03 February 2008 03:45 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

So it’s in fact a screenscraper specific for IMDb. Maybe it could be extended to use for other sites who don’t offer rss or apis.

Thanks for the share.

Profile
 
 
Posted: 24 March 2008 02:24 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  21
Joined  11-17-2007
xwero - 03 February 2008 03:45 AM

So it’s in fact a screenscraper specific for IMDb.

Thanks captain obvious, he stated that in his own post.

There was only one problem with this library for me, repeated searches don’t clear the results after each request.

My lines are probably slightly off compared to the original but at around line 1437 replace:

function results($url = "") {

with

function results($url = "") {
        
unset($this->resu);

I’m working on converting it to use cUrl right now as the browser emulator is painfully slow, and i can’t stand using pear (if i wanted a behemoth, i could just use zend framework instead wink )

 Signature 

minthost.com
localhostr.com
jonathancremin.com

CentOS 4.5 / Apache 2.2.6 / PHP 5.2.5 / MySQL 4.1.22 / Kohana 2.3

Profile
 
 
Posted: 24 March 2008 05:12 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  37
Joined  01-25-2008

Thanks for sharing. Good documentation too. cheese

Profile
 
 
Posted: 25 March 2008 02:30 AM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
Joined  07-14-2006

@pwninja : nice piece of using only the part you want to react on and bring someone down. It was the observation that is the stepping stone for the actual request how the contribution could be extended.

If you only think about making others bad (pear,zend framework) you’re on the wrong forum.

Profile
 
 
Posted: 25 March 2008 11:58 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Avatar
Total Posts:  21
Joined  11-17-2007
xwero - 25 March 2008 02:30 AM

@pwninja : nice piece of using only the part you want to react on and bring someone down. It was the observation that is the stepping stone for the actual request how the contribution could be extended.

If you only think about making others bad (pear,zend framework) you’re on the wrong forum.

My apologies, I thought you were just stating the obvious, I see now you were just priming the next sentence.

I’ve updated this library to use the latest version of the IMDBPHP class, I’ll post it when I get home this evening if i have a chance. I’m having trouble so far making cUrl behave exactly like the PEAR class, so that won’t be making an appearance yet.

 Signature 

minthost.com
localhostr.com
jonathancremin.com

CentOS 4.5 / Apache 2.2.6 / PHP 5.2.5 / MySQL 4.1.22 / Kohana 2.3

Profile
 
 
Posted: 25 May 2008 04:13 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  110
Joined  12-18-2007

Hello,

Anybody can reupload? Is not avaible on the initial blog.

Thank you,
—Isern Palaus

 Signature 

Isern Palaus
http://blog.ipalaus.es

Profile
 
 
Posted: 27 May 2008 10:12 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  596
Joined  02-04-2008

Wouldn’t this be against the imdb terms of use?

Profile
 
 
Posted: 03 June 2008 06:10 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  110
Joined  12-18-2007

I think no. :S

Regards,
—Isern Palaus

 Signature 

Isern Palaus
http://blog.ipalaus.es

Profile
 
 
Posted: 03 June 2008 09:55 AM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  596
Joined  02-04-2008

Did you check their terms? It’s right up top.

License and Site Access
IMDb grants you a limited license to access and make personal use of this site and not to download (other than page caching) or modify it, or any portion of it, except with express written consent of IMDb. This site or any portion of this site may not be reproduced, duplicated, copied, sold, resold, visited, or otherwise exploited for any commercial purpose without express written consent of IMDb. This license does not include any resale or commercial use of this site or its contents or any derivative use of this site or its contents.

I only am aware of this because I worked at a company once that had to license the content from IMDB. They make significant amounts of money from distributing their content and don’t give it away for free.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120200 Total Logged-in Users: 66
Total Topics: 126330 Total Anonymous Users: 4
Total Replies: 664386 Total Guests: 543
Total Posts: 790716    
Members ( View Memberlist )