Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Trouble with some of IMDB Public Methods

by SergioQ (Beadle)
on Dec 28, 2020 at 18:59 UTC ( [id://11125892]=perlquestion: print w/replies, xml ) Need Help??

SergioQ has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

If anyone has ever used IMDB::Film I thought they might have experienced this (Below is my code to retrieve info from iMDb).

The non-commented items return proper values. However if I try and retirved release_dates(), I get following error:

Use of uninitialized value in concatenation (.) or string at /usr/local/share/perl/5.26.1/IMDB/Film.pm line 1486. CRITICAL Cannot retrieve url http://www.imdb.com/title/tt/releaseinfo at 4news.pl line 151.

I do notice that in the error they have don't have the movie id, just the tt. Which if I manually correct, I get the proper URL, and then loop through it for each different state. Or I could dig through $imdbOBJ, but that seems kind of kludgy. Or create the proper URL, and do it myself. I even though should I touch the modules code, but have never done that.

Any suggestions?

Thanks

$currec{mediaid} = iMDbs id number, which in this case is 'tt6723592'

$imdbOBJ = new IMDB::Film(crit => $currec{mediaid}, user_agent + => 'Opera/8.x', timeout => 30, cache => 0); say $imdbOBJ->title(); say $imdbOBJ->status_descr(); # say $imdbOBJ->release_dates(); say $imdbOBJ->year(); # say $imdbOBJ->full_companies(); say $imdbOBJ->company(); say $imdbOBJ->recommendation_movies();

Replies are listed 'Best First'.
Re: Trouble with some of IDDB Public Methods
by Fletch (Bishop) on Dec 28, 2020 at 19:11 UTC

    Looking at CPAN IMDB::Film was last updated seven years ago in which time I'm going to bet it's more than likely that their HTML (and glancing at the module source it looks like this thing is just scraping HTML) has changed in the meantime. You can try to patch things yourself and then submitting patches back (but then again since it hasn't been touched in this long it may have been abandoned; you can ping the author to check of course).

    (It looks like they (IMDB) do have an official API but the developer page says something along the lines of "contact us for pricing" so scraping may be the way you'll have to go for "unofficial" access.)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Looking at CPAN IMDB::Film was last updated seven years ago

      One more thing I've learnt about CPAN, thanks!

Re: Trouble with some of IDDB Public Methods
by marto (Cardinal) on Dec 28, 2020 at 19:55 UTC

      It may be easier/more maintainable if you parse the data you want yourself. See Re^2: running an example script with WWW::Mechanize* module for a mojo based example of scraping data from IMDB.

      I was actually able to fix, or should I say add some better error catching to the IMDB::File modules. Given my level a little bit proud of myself.

      Looks like WWW::Mechanize is the way to go.Looks like I'm in for a long road of learning. I can definitely parse the main page, but some of the stuff am going to have to find a way to follow links, yada yada yada. But hey, I've some this far!

      Thanks again

        "I was actually able to fix, or should I say add some better error catching to the IMDB::File modules. Given my level a little bit proud of myself."

        Well done, it seems there are various patches for different things in the rt.cpan queue, and the github repo seems to have some merges. This could be worth pursuing depending on how much time you want to devote to it, alternative you should be able to use the mojo based solution from earlier as a starting point to get just what you need. If you have any problems with that just post and I'll take a look.

        I was actually able to fix, or should I say add some better error catching to the IMDB::File modules. Given my level a little bit proud of myself.

        I would love to see your source. I know that I've failed to get far with imdb changing over the years.

        Looks like WWW::Mechanize is the way to go.

        It's been my experience that WWW::Mechanize can't deal with javascript. This site is a 61 k clump of it.

Re: Trouble with some of IMDB Public Methods
by karlgoethebier (Abbot) on Dec 29, 2020 at 06:29 UTC

    See also. As always: Everything has it’s price.

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11125892]
Approved by marto
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-25 10:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found