Welcome Guest, Not a member yet? Register   Sign In
CI IMDb Library
#1

[eluser]nevercraft[/eluser]
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!
#2

[eluser]xwero[/eluser]
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.
#3

[eluser]pwninja[/eluser]
[quote author="xwero" date="1202049933"]So it's in fact a screenscraper specific for IMDb.[/quote]

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:
Code:
function results($url = "") {
with
Code:
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 )
#4

[eluser]Ebot Ndip-Agbor[/eluser]
Thanks for sharing. Good documentation too. :cheese:
#5

[eluser]xwero[/eluser]
@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.
#6

[eluser]pwninja[/eluser]
[quote author="xwero" date="1206448254"]@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.[/quote]

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.
#7

[eluser]Isern Palaus[/eluser]
Hello,

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

Thank you,
-- Isern Palaus
#8

[eluser]louis w[/eluser]
Wouldn't this be against the imdb terms of use?
#9

[eluser]Isern Palaus[/eluser]
I think no. :S

Regards,
-- Isern Palaus
#10

[eluser]louis w[/eluser]
Did you check their terms? It's right up top.

Quote: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.




Theme © iAndrew 2016 - Forum software by © MyBB