tboothman / imdbphp

PHP library for retrieving film and tv information from IMDb
247 stars 84 forks source link

Filmography and photo returns empty for some people #286

Closed robertorodriguezgarcia closed 1 year ago

robertorodriguezgarcia commented 1 year ago

I'm using latest Imdbphp dev revision

For some people don't get the photo and filmography. Ex: Brad Pitt, Hugh Laurie, Olivia Cooke, Leonardo DiCaprio, Tom Hanks...

tboothman commented 1 year ago

Who does get a photo and filmography?

robertorodriguezgarcia commented 1 year ago

I mean in obtaining info in person.php olivia

GeorgeFive commented 1 year ago

There has been a code change, and at a quick glance, it definitely affects images.

Thomasdouscha commented 1 year ago

There is issue to get photo of person. it works randomize. I can say it gets photos approximately 90% but i afraid that issue day by day will be worse.

MMMDI @.***>, 2 Ara 2022 Cum, 19:57 tarihinde şunu yazdı:

There has been a code change, and at a quick glance, it definitely affects images.

— Reply to this email directly, view it on GitHub https://github.com/tboothman/imdbphp/issues/286#issuecomment-1335536579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKPFI3H6XCXSEVARTLJUHPLWLITBJANCNFSM6AAAAAASD5AWPM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

GeorgeFive commented 1 year ago

This can more than likely be done much more efficiently, but this was what I came up with on short notice. Do note that the images will now be smaller, but this didn't affect my usage case.

Person.php function photo

if (preg_match('!ipc-media--poster-m ipc-poster__poster-image ipc-media__img" style="width:100%"><img alt="(.*?)" class="ipc-image" loading="eager" src="(.*?)"!ims', $this->page["Name"], $match)) {

if ($thumb) { $this->main_photo = $match[2];

robertorodriguezgarcia commented 1 year ago

This issue not only happens with the photos, you can't get the filmography either. Examples: Leonardo DiCaprio, Olivia Cooke, Halle Berry, Chris Hemsworth, Robert Downey Jr., Mark Ruffalo...

Thomasdouscha commented 1 year ago

It start to be terrible that cover photo of person. Where is @duck7000 ? Please help us.

Thomasdouscha commented 1 year ago

@Thomasdouscha I have build my own version of imdbphp because the maintainers here are resistent, don't look at PR's and if they do (after sometimes years) they respond with "i don't understand what you changed" You did notice that @tboothman did responded to this thread with a question but after that it is silent and no solution is even thought about i guess.. I mean if you are the maintainer of this repo, then MAINTAIN it, especially when somebody reports a problem. So i decided to leave this repo, and i'm sorry for all the good people here who appreciated my work. Feel free to use my version but it is very much stripped down for my needs, so person is completely removed.

It is a very pity ! you are very useful and helper man :) I really really worried about that. I looked at your repo and s you said that is very much stripped down unfortunately myself. I hope that you will add some components as person.php.

duck7000 commented 1 year ago

Imdb is/finished redesign the person pages so i think that the whole person class eventually will fail

So your best hope is that the maintainer(s) will pick this up. I'm not going to as i have no interest in this, sorry If that changes in the future i will add it to my stripped down version.

duck7000 commented 1 year ago

Well the photo was a easy fix so change the existing method photo() with this: Thumb is now 140x207, big is 304x400

    #--------------------------------------------------------[ Photo specific ]---

    /** Get cover photo
     * @param optional boolean thumb get the thumbnail (140x207, default) or the
     *        bigger variant (304x400 - FALSE)
     * @return mixed photo (string url if found, FALSE otherwise)
     * @see IMDB person page / (Main page)
     */
    public function photo($thumb = true)
    {
        if (empty($this->main_photo)) {
            $this->getPage("Name");
            if (preg_match('!<div.*?class="sc-21f2de71-7 kvyqcm".*?>*.*?<img.*?src="(.*?)"!ims', $this->page["Name"], $match)) {
                if ($thumb) {
                    $this->main_photo = $match[1];
                } else {
                    $this->main_photo = str_replace('._V1_QL75_UY207_CR9,0,140,207_', '._V1_', $match[1]);
                }
            } else {
                return false;
            }
        }
        return $this->main_photo;
    }
duck7000 commented 1 year ago

Filmograf appears to be a page change

In person.php: Change line 253 with: $page = $this->getPage("Fullcredits");

replace protected function getUrlSuffix() with:

    protected function getUrlSuffix($pageName)
    {
        switch ($pageName) {
            case "Name"        :
                $urlname = "/";
                break;
            case "Bio"         :
                $urlname = "/bio";
                break;
            case "Publicity"   :
                $urlname = "/publicity";
                break;
            case "Fullcredits"   :
                $urlname = "/fullcredits";
                break;
            default            :
                throw new \Exception("Could not find URL for page $pageName");
        }
        return $urlname;
    }

This should add back all functions but it is a simple fix and can/will break again i guess

robertorodriguezgarcia commented 1 year ago

Thank you very much @duck7000 :)

duck7000 commented 1 year ago

@robertorodriguezgarcia Thanks but i shouldn't be doing this, it is a shame that the maintainer(s) didn't do anything!

Thomasdouscha commented 1 year ago

Yes , you shouldn't be doing this. But you did, thanks for it. In my oppinion you should keep to support it . May be maintainers have some problems about time or jobs may be they are very busy. Try to talk them.

duck7000 commented 1 year ago

@Thomasdouscha Well i tried many times, politely or otherwise but somehow they refuse anything that is no problem to them or they deny that there is a problem. And yes they maybe busy but be honest about that (@jreklund did, so he is honest about that) At the other hand if you are saying that you are maintain this repo why don't they do it then? Or at least admit openly that @tboothman is not going to maintain this repo. It feels to me like an up hill battle, that's why i created my own version

jreklund commented 1 year ago

Solved in v7.4.0+