duck7000 / imdbGraphQLPHP

6 stars 0 forks source link

Request: Additional credits info #6

Closed GeorgeFive closed 11 months ago

GeorgeFive commented 12 months ago

I know you're getting tired of me... I apologize! I've noticed a few pieces of information are missing / handled differently from your cast class.

 *  'name_alias' => NULL, // Name credited to actor if it is different to their imdb name
 *  'credited' => true, // Was the actor credited in the film?
 *  'role_other' => array() // Any other information about what the cast member did e.g. 'voice', 'archive footage'

The latter seems to be combined with role, while the first two aren't there. I think from a data "purity" standpoint, role_other should be kept separate in the user's db and handled as they please. The first two are just really nice to have.

duck7000 commented 12 months ago

I'm not getting tired of anyone! But i don't use every bit of information that is available so i left out what i don't want. And yes some data is handled differently just for my needs.

I'll think about it

duck7000 commented 12 months ago

I have separated role and role_other so that is sorted.

I'll try to add the rest as well

duck7000 commented 12 months ago

I have added name_alias and credited. For my needs i have to change my program but i agree for a data purity that this is cleaner. Check it out!

GeorgeFive commented 12 months ago

Awesome! Question for you, is there a howto on how to get graphql information so that I could dig into this a little more? I got the graphql extension for developer tools in Chrome, but I don't see any relevant info there (ie, cast page does not show any cast information for the query).

duck7000 commented 12 months ago

In this thread there is some info https://github.com/tboothman/imdbphp/issues/309

i use Firefox, same addon is available go to imdb.com and find a movie find a page (releaseinfo also known as) and look for links like all or 50more right click this link and choose inspect In the inspect window bar click on graphQL scroll the page so that you can see the link and click on it you will see one or more querys in the inspect window/grapql appearing click on one of the links You will see the header, query, response etc compare the outcome with method aka (in this example) to understand what it all do. once you know how it works it is quite clever

Screenshot_2023-08-05_22-37-21

this is basicly how it works, the fun part for me was that a lot of values on the title page don't have links like all or more so i had to figure it out..

If you want to go deeper then it gets complicated which i did but don't recommend

The cast page is not jet converted to graphql (at least not for me) so above won't work. It only works if there is a link all or more available

In this thread Tboothman explains a little more and gets more complicated as i didn't understand how it all works (it took me a while..) https://github.com/tboothman/imdbphp/issues/291

Imdb has a bit information about graphQL but be aware that some of it is outdated https://developer.imdb.com/documentation/api-documentation/sample-queries/title-name

GeorgeFive commented 12 months ago

I've been able to figure out some of this, but I feel like I'm missing something blatantly obvious, hah. Example, how did you do the cast function in your script? You have query CreditQuery in there, how were you able to get the structure for that?

duck7000 commented 12 months ago

Thats where it gets complicated...

You have to set up a php development server with composer and guzzelhttp client you need the directory from imdbphp called graphql (only for this development set up) Then you need GraphiQL extension in chrome Tboothman explained it here a bit https://github.com/tboothman/imdbphp/issues/291 (at the end)

In graphiql you can make the query (there is doc info, you can search for title for example) it is all explained in doc but it can be overwhelming and sometimes what seems to be logic isn't always the case

GeorgeFive commented 11 months ago

Two things I've found about the additional credits info:

  1. You put $role_other in parentheses... could you strip those out? imdbphp didn't use that, and I'm guessing everyone who uses this function accounted for it. So now, my script is using ((double parentheses)). Not a huge issue as I could easily change my script to account for this if needed, but helpful, and goes back to the data purity thing (let the user format it how they choose).

  2. Also on $role_other... I'm a little confused on this, but if there are multiple items, it sometimes groups them and sometimes doesn't.

https://www.imdb.com/title/tt5574342/fullcredits returns: Clayton T. Smith - (voice) (segment "Blanche Dumas from B to Z") This is correct!

https://www.imdb.com/title/tt0462538/fullcredits returns: Marcia Wallace - Mrs. Krabappel (voice scenes deleted) This is wrong... should be: Marcia Wallace - Mrs. Krabappel (voice) (scenes deleted) I personally would put a comma in: Marcia Wallace - Mrs. Krabappel (voice), (scenes deleted) ...but this may be nitpicky, hah.

duck7000 commented 11 months ago

your issues is exactly the reason i did get all possible comments as string to avoid something get missed in the first place. But i have changed that on your behalf and the result is that not every scenario is covered.

I removed the parenthesis and replaced space with comma space. Comments are separated (if there are more than one) by comma space

duck7000 commented 11 months ago

I'm confused right now, i did mix up things i guess

I will look in to it again

duck7000 commented 11 months ago

So name_alias is correct? Only rest of comments is not correct?

Comments are now comma separated string, is that okay? Or would an array with every index a comment a better idea? I think that this is the best approach.

role_other isn't very correct name as this is only comments like voice etc, so would it be better to rename this to comments? role is also not a good name, character would be better? Either way those names are confusing to me.

Edit: i deleted the latest post with the screenshot, that has nothing to do with your issue/question

GeorgeFive commented 11 months ago

Alias seems to be correct, didn't spot any issues during some quick testing.

role_other only seems to get weird when there's more than one item. Sometimes it works fine and sometimes it doesn't.... that's what confused me, it would seem like it always works or always returns wrong. I don't get that, hah.

We could rename stuff if you like, I'm neutral on that. I already have my scripts written to use the current values, but that's an easy fix if you change anything. I output my own wordage in my app, so internal wordage doesn't matter much to me.

duck7000 commented 11 months ago

okay, thanks for your input

I will change those names. And make comments (what remains after credited and name_alias) an array stripped from parenthesis.

I'll let you know

duck7000 commented 11 months ago

I uploaded the changes check it out please

GeorgeFive commented 11 months ago

Every test I ran passed! I went out of my way to try to make it screw up somehow and everything looked great.

duck7000 commented 11 months ago

thanks for testing, glad that this now finally works so everybody is happy :)

GeorgeFive commented 11 months ago

Thanks!