imdbphp icon indicating copy to clipboard operation
imdbphp copied to clipboard

Trailer method in Title class is broken

Open jcvignoli opened this issue 1 year ago • 9 comments

Just tested with "2001, a space odyssey".

No trailer is found, despite there are many:

https://www.imdb.com/title/tt0062622/videogallery/content_type-trailer

jcvignoli avatar Feb 26 '24 14:02 jcvignoli

Well.. imdb changed the trailer page, so this is to be expected.

if anyone is interested in fixing this the right way here is the query i use:

            $query = <<<EOF
query Video(\$id: ID!) {
  title(id: \$id) {
    primaryVideos(first: 9999) {
      edges {
        node {
          playbackURLs {
            url
          }
          thumbnail {
            url
            width
            height
          }
          runtime {
            value
          }
          contentType {
            displayName {
              value
            }
          }
          primaryTitle {
            titleText {
              text
            }
          }
        }
      }
    }
  }
}
EOF;

Figure out the rest yourself as it works the same as other GraphQL methods. It includes other info as well but you can strip that out of you don't want it.

As a courtesy to show that i DO care and respect this project and maintainers.

duck7000 avatar Feb 26 '24 15:02 duck7000

Thanks @duck7000, I actually already implemented your graphql method in my own fork. Just took out the get_headers() check which takes forever on my environnement, don't know why.

jcvignoli avatar Feb 26 '24 15:02 jcvignoli

Get_headers will check if the found url can be used as embedded url in an iframe, not all urls are allowed to do so. Why that takes a long time in your environment is beyond me as it works fast at my server.

It wonders me though why you add this issue here but use your own fork?

duck7000 avatar Feb 26 '24 16:02 duck7000

Well, because I'm not a developper, and true developpers do a better work than me :)

jcvignoli avatar Feb 26 '24 22:02 jcvignoli

I'm not a true developer either hah

duck7000 avatar Feb 27 '24 10:02 duck7000

Trailers is still broken. setting "Trailers" => "/videogallery/?contentType=trailer", in Title.php at least got rid of the class error 404 not found. But content is so different it won't match

pb1dft avatar Jul 24 '24 21:07 pb1dft

My 2 cents on a fix. I only return the 1080 version per trailer. When one wants multiple version they are free to adjust the code ;)

Second i filter out foreign languages.

diff.txt

pb1dft avatar Jul 25 '24 14:07 pb1dft

@pb1dft i DO appreciate you did try to fix this but what i don't understand is that if there is a solid fix (with GraphQL) why you (and other people) do insist to use old scraper methods while there is a perfect solution ready to use? It is beyond me, that is all i'm about to say about it.

You may want to look at my trailer method here (frome line 2000) https://github.com/duck7000/imdbGraphQLPHP/blob/master/src/Imdb/Title.php I do include the image url with a few parameters so don't be intimidated by it hah

duck7000 avatar Jul 25 '24 14:07 duck7000

Because some of us have this library incoorporated in a much larger project ;) That being said i will check out the GraphQL later ;)

pb1dft avatar Jul 25 '24 22:07 pb1dft