Author Topic: Custom actors and directors field  (Read 119 times)

0 Members and 3 Guests are viewing this topic.

Offline afrocuban

  • Moderator
  • *****
  • Posts: 468
    • View Profile
Custom actors and directors field
« on: November 12, 2024, 04:14:57 am »
Hello Ivek.


I'm creating a new skin, pretty much different than anything seen here so far. As a teaser, It'll contain all the custom fields I'm aware of, around 160 as I already mentioned earlier.


For it to work properly, I need 2 custom fields: for IMDb actors without role and directors, with values separated with: "  •  ", or with double/triple space, even better.


I can't use existing human fields for those two, because they're by design of a link memo type, and with link memo it is impossible (at least for me) to achieve even simple goals in skin engineering.


I am more than willing to learn to do it myself with your help, of course. I can recognize patterns, and I already changed separator for Tv2 custom field with aforementioned, instead comma.


Thank you in advance
« Last Edit: November 12, 2024, 04:21:19 am by afrocuban »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2711
    • View Profile
Re: Custom actors and directors field
« Reply #1 on: November 12, 2024, 09:45:20 am »
You could edit the Tv2 (Long Text) custom field, because it is not a memo field, the data transfer is already done for the Long Text custom field in the IMDb script. As for the IMDb actors without role and directors, the data transfer would already be done in the IMDb script so that you could then still use the custom memo field or some other custom field, such as Long Text or Multiselect list. But first, you would need to edit the IMDb script for the IMDb actors without role and directors and then of course make these changes in the database as well
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Moderator
  • *****
  • Posts: 468
    • View Profile
Re: Custom actors and directors field
« Reply #2 on: November 12, 2024, 11:48:44 pm »
Thanks for a feedback, Ivek.
I understood your points, and this is what I did


Code: [Select]

    //Get  to "Cast" ~actors~ ctActors
       //Go Cast list
       curPos:=Pos('<h3 class="ipc-title__text">Top cast',HTML);                                     //Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-avatar ipc-avatar--base ipc-avatar--dynamic-width" role="group">');                                //Strings end which opens the block content data.  WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><><><><>',HTML,curPos);                                             //Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('" class="ipc-image" loading="',ItemList)                               //String which opens the subList data. WEB_SPECIFIC
       index:=1;
ItemValue1:=''; // Initialize the custom IMDb Cast field


       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break;     //Limited depassed.
          //Get PersonURL (Always must it has)
          ItemValue:=TextBetWeen(ItemList,'<a data-testid="title-cast-item__actor" href="/name/','?ref_=tt_cl_t_',false,curPos);
          PersonURL:=BASE_URL_PERSON_PRE + ItemValue + BASE_URL_SUF; //Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
       //Get Name (Always must it has) 
          //Name:=TextBetWeen(ItemList,'?ref_=tt_cl_t_'+IntToStr(index)+'" class="StyledComponents__ActorName-y9ygcu-1 eyqFnv"','</a><div class="title-cast-item__characters-list">',false,curPos);
        Name:=TextBetWeen(ItemList,'">','</a><div class="title-cast-item__characters-list">',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
          //Name:=Trim(StringReplace(Name,'>','',True,False,True));
        LogMessage('      Parse Results Name:'+Name+'||');
          //Get Role YES: PVD save Role in cast (actors) people (Not always has link)       
        Role:=TextBetWeen(ItemList,' title-cast-item__char" data-testid="cast-item-characters-link">','</span><span data-testid="cast-item-characters-with-as" class="',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
          //Role:=Trim(StringReplace(Role,'>','',True,False,True));
          ///Role:=StringReplace(Role,Chr(13),'',True,False,True);
          ///Role:=StringReplace(Role,'  ','',True,False,True);
          LogMessage('      Parse Results Role:'+Role+'||');
        If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
        AddMoviePerson(Name,'',Role,PersonURL,ctActors);
          LogMessage('      Get results cast:#'+IntToStr(index)+'|'+Name+'|'+Role+'|'+PersonURL+'||ctActors');                                               


    // Custom field: IMDb Cast (names only, separated by "  •  ")
    If ItemValue1='' Then
        ItemValue1:=Name
    Else
        ItemValue1:=ItemValue1+'  •  '+Name;
          //curPos:=PosFrom('" class="ipc-image" loading="',ItemList,curPos);                          //String which opens the Web Result item List data. WEB_SPECIFIC
          index:=index+1;
       End;
      //LogMessage(#13+'');
    End;   
   //*)     
   //(*         
      LogMessage(#13+'');
   //*)     


// Add custom field IMDb Cast
AddCustomFieldValueByName('IMDb Cast', ItemValue1);
// Log the IMDb Cast field for verification
LogMessage('IMDb Cast: '+ItemValue1);


    //Get "plot_summary" as ~comment~ //debug_pos1-1


Mysteriously and hilariously, instead of importing Cast, it imports Tv2 value into IMDb Cast field! It's some problem with ItemValue1 value that I'm trying to define, but I am not able to grasp what I'm doing wrong, so it pulls ItemValue1 from the first previous segment where it's used, and that is exactly Tv2 field in the script.


If you're willing to review and suggest snippet change, it would be appreciated as always.


P.S. Forum won't accept in the code section / div, but it's there in


<><><><>


so it's actually < / div >< / div >< / div >< / div >, without space inside, of course.
« Last Edit: November 13, 2024, 12:57:19 am by afrocuban »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2711
    • View Profile
Re: Custom actors and directors field
« Reply #3 on: November 13, 2024, 11:33:58 am »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

I will edit a special script for this, maybe today for you.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2711
    • View Profile
Re: Custom actors and directors field
« Reply #4 on: November 13, 2024, 02:23:31 pm »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

I will edit a special script for this, maybe today for you.

Here is a special IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script for you, which is set up to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. You can also edit other person information using it.

The IMDB_[EN][HTTPS]_TEST_2c script cannot transfer all person information from the primary IMDb movie pages, because it will need to make some corrections or updates to properly transfer all information again,  because some changes were made to the source code of the IMDb pages again.


IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script is attached.
« Last Edit: November 13, 2024, 02:26:09 pm by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Moderator
  • *****
  • Posts: 468
    • View Profile
Re: Custom actors and directors field
« Reply #5 on: November 13, 2024, 06:03:07 pm »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

Oh, I see! Thank you for fantastic assistance!!! It works now! Here's the code (it imports only up to 15 actors into custom field because of the design of my skin):

Code: [Select]

If GET_FULL_CREDIT Then Begin
    //Get ~crew~ctDirectors,ctWriters,ctComposers,ctProducers
       curPos:=Pos('<li role="presentation" class="ipc-metadata-list__item" data-testid="title-pc-principal-credit"><span class="ipc-metadata-list-item__label">Director',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=PosFrom('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">',HTML,curPos); // Strings end which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed.
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/','/?ref_=tt_ov_dr',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_ov_dr">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Get result Name:'+Name+'||');
          //Get Role NO: PVD don't save Role in crew people
          If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
             AddMoviePerson(Name,'','',PersonURL,ctDirectors);
          LogMessage('      Get results Director:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctDirectors'); 
          curPos:=PosFrom('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End;   
    //Go to "Writer:" or "Writers:" ~crew~ctWriters
       curPos:=Pos('">Writer',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=PosFrom('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">',HTML,curPos); // Strings end which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/','/?ref_=tt_ov_wr',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_ov_wr">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Get result Name:'+Name+'||');
          //Get Role NO: PVD don't save Role in crew people
          AddMoviePerson(Name,'','',PersonURL,ctWriters);
          LogMessage('      Get results Writer:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctWriters'); 
          curPos:=PosFrom('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End; 
//Go to "Soundtracks" ~crew~ctComposers
       curPos:=Pos('/soundtrack/?ref_=tt_trv_snd" target="">Soundtracks</a>',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('/soundtrack/?ref_=tt_trv_snd" target="">Soundtracks</a>'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('/soundtrack/?ref_=tt_trv_snd" aria-label="See more" target="">',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('</span><span class="soundtrack-comment-1">',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed.
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'" href="/name/','/?ref_=tt_trv_snd">',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_trv_snd">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          //Get Role NO: PVD don't save Role in crew people
          If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
             AddMoviePerson(Name,'','',PersonURL,ctComposers);
          LogMessage('      Get results Composers:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctComposers'); 
          curPos:=PosFrom('Composed by',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End; 
    //Go to "Producers" ~crew~ctProducers
       //No Producers in principal page. 
       LogMessage('      Get No results Producers'+#13);
    //Get to "Cast" ~actors~ ctActors
       // Start the cast extraction process
LogMessage('Starting cast extraction process.');
curPos:=Pos('<h3 class="ipc-title__text">Top cast',HTML); // Start of cast block
curPos:=curPos+Length('<div class="ipc-avatar ipc-avatar--base ipc-avatar--dynamic-width" role="group">'); // Strings end which opens the block content data. WEB_SPECIFIC


// Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
endPos:=PosFrom('</li></ul><><><><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
ItemList:=Copy(HTML,curPos,endPos-curPos);
//LogMessage('Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
curPos:=Pos('" class="ipc-image" loading="',ItemList); // String which opens the subList data. WEB_SPECIFIC
index:=1;
ItemValue1:=''; // Initialize the custom IMDb Cast field


While (curPos > 0) and (index <= 15) Do Begin
    // Get PersonURL (Always must it has)
    ItemValue:=TextBetWeen(ItemList,'<a data-testid="title-cast-item__actor" href="/name/','?ref_=tt_cl_t_',false,curPos);
    PersonURL:=BASE_URL_PERSON_PRE + ItemValue + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
    LogMessage('Parse Results PersonURL:'+PersonURL+'||');


    // Get Name (Always must it has)
    Name:=TextBetWeen(ItemList,'">','</a><div class="title-cast-item__characters-list">',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
    LogMessage('Parse Results Name:'+Name+'||');


    // Custom field: IMDb Cast (names only, separated by " • ")
    If ItemValue1='' Then
        ItemValue1:=Name
    Else
        ItemValue1:=ItemValue1+' • '+Name;


    curPos:=PosFrom('<a data-testid="title-cast-item__actor" href="',ItemList,curPos); // Move to the next actor's block
    index:=index+1;
End;


// Add custom field IMDb Cast
AddCustomFieldValueByName('IMDb Cast', ItemValue1);
// Log the IMDb Cast field for verification
LogMessage('IMDb Cast: '+ItemValue1);


// Log message and end block as in your script
LogMessage('Completed cast extraction process.');
LogMessage(#13+'');
End;


    //Get "plot_summary" as ~comment~ //debug_pos1-1







I will edit a special script for this, maybe today for you.


I don't want to bother you! This is only for my needs so far, so let's spare you!!!

Offline afrocuban

  • Moderator
  • *****
  • Posts: 468
    • View Profile
Re: Custom actors and directors field
« Reply #6 on: November 13, 2024, 06:05:17 pm »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

I will edit a special script for this, maybe today for you.

Here is a special IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script for you, which is set up to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. You can also edit other person information using it.

The IMDB_[EN][HTTPS]_TEST_2c script cannot transfer all person information from the primary IMDb movie pages, because it will need to make some corrections or updates to properly transfer all information again,  because some changes were made to the source code of the IMDb pages again.


IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script is attached.

Oh, you were faster then me. My replying window was open while I was coding, so wasn't aware of your response. Thank you so much, but as I wrote, let's spare you when you are needed for global script, not for mine only! Humbly grateful.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2711
    • View Profile
Re: Custom actors and directors field
« Reply #7 on: November 13, 2024, 10:28:06 pm »
Of course it doesn't transfer the correct information because this feature is not disabled. You probably have a setting to transfer information to "Cast" ~actors~ ctActors from the Full Cast&Crew website. Find this feature in the Script Options section at the top of the script and change the settings as shown below.
Code: [Select]
  //GET_FULL_CREDIT  = True ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.
  GET_FULL_CREDIT  = False ;  //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page.

Oh, I see! Thank you for fantastic assistance!!! It works now! Here's the code (it imports only up to 15 actors into custom field because of the design of my skin):

Code: [Select]

If GET_FULL_CREDIT Then Begin
    //Get ~crew~ctDirectors,ctWriters,ctComposers,ctProducers
       curPos:=Pos('<li role="presentation" class="ipc-metadata-list__item" data-testid="title-pc-principal-credit"><span class="ipc-metadata-list-item__label">Director',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=PosFrom('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">',HTML,curPos); // Strings end which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed.
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/','/?ref_=tt_ov_dr',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_ov_dr">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Get result Name:'+Name+'||');
          //Get Role NO: PVD don't save Role in crew people
          If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
             AddMoviePerson(Name,'','',PersonURL,ctDirectors);
          LogMessage('      Get results Director:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctDirectors'); 
          curPos:=PosFrom('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End;   
    //Go to "Writer:" or "Writers:" ~crew~ctWriters
       curPos:=Pos('">Writer',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=PosFrom('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">',HTML,curPos); // Strings end which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('<div class="ipc-metadata-list-item__content-container"><ul class="ipc-inline-list ipc-inline-list--show-dividers ipc-inline-list--inline ipc-metadata-list-item__list-content baseAlt" role="presentation">'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('</li></ul><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/','/?ref_=tt_ov_wr',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Parse Results PersonURL:'+PersonURL+'||');
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_ov_wr">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          LogMessage('      Get result Name:'+Name+'||');
          //Get Role NO: PVD don't save Role in crew people
          AddMoviePerson(Name,'','',PersonURL,ctWriters);
          LogMessage('      Get results Writer:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctWriters'); 
          curPos:=PosFrom('<a class="ipc-metadata-list-item__list-content-item ipc-metadata-list-item__list-content-item--link" rel="" href="/name/',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End; 
//Go to "Soundtracks" ~crew~ctComposers
       curPos:=Pos('/soundtrack/?ref_=tt_trv_snd" target="">Soundtracks</a>',HTML); // Strings start which opens the block content data. WEB_SPECIFIC
       curPos:=curPos+Length('/soundtrack/?ref_=tt_trv_snd" target="">Soundtracks</a>'); // Strings end which opens the block content data. WEB_SPECIFIC
       //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
       endPos:=PosFrom('/soundtrack/?ref_=tt_trv_snd" aria-label="See more" target="">',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
       ItemList:=Copy(HTML,curPos,endPos-curPos);
       //LogMessage('           Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
       curPos:=Pos('</span><span class="soundtrack-comment-1">',ItemList); // String which opens the subList data. WEB_SPECIFIC
       index:=1;
       While curPos>0 Do Begin
          If (index>PEOPLE_LIMITS) Then break; // Limited depassed.
          //Get PersonURL (Always must it has)
          PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'" href="/name/','/?ref_=tt_trv_snd">',false,curPos) + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
          //Get Name (Always must it has)
          Name:=TextBetWeen(ItemList,'/?ref_=tt_trv_snd">','<',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
          //Get Role NO: PVD don't save Role in crew people
          If Pos('http://www.imdb.com/name//' ,PersonURL) < 1 then
             AddMoviePerson(Name,'','',PersonURL,ctComposers);
          LogMessage('      Get results Composers:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctComposers'); 
          curPos:=PosFrom('Composed by',ItemList,curPos); // String which opens the subList data. WEB_SPECIFIC
          index:=index+1;
       End; 
    //Go to "Producers" ~crew~ctProducers
       //No Producers in principal page. 
       LogMessage('      Get No results Producers'+#13);
    //Get to "Cast" ~actors~ ctActors
       // Start the cast extraction process
LogMessage('Starting cast extraction process.');
curPos:=Pos('<h3 class="ipc-title__text">Top cast',HTML); // Start of cast block
curPos:=curPos+Length('<div class="ipc-avatar ipc-avatar--base ipc-avatar--dynamic-width" role="group">'); // Strings end which opens the block content data. WEB_SPECIFIC


// Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~
endPos:=PosFrom('</li></ul><><><><>',HTML,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
ItemList:=Copy(HTML,curPos,endPos-curPos);
//LogMessage('Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');
curPos:=Pos('" class="ipc-image" loading="',ItemList); // String which opens the subList data. WEB_SPECIFIC
index:=1;
ItemValue1:=''; // Initialize the custom IMDb Cast field


While (curPos > 0) and (index <= 15) Do Begin
    // Get PersonURL (Always must it has)
    ItemValue:=TextBetWeen(ItemList,'<a data-testid="title-cast-item__actor" href="/name/','?ref_=tt_cl_t_',false,curPos);
    PersonURL:=BASE_URL_PERSON_PRE + ItemValue + BASE_URL_SUF; // Strings which opens/closes the data. WEB_SPECIFIC
    LogMessage('Parse Results PersonURL:'+PersonURL+'||');


    // Get Name (Always must it has)
    Name:=TextBetWeen(ItemList,'">','</a><div class="title-cast-item__characters-list">',false,curPos); // Strings which opens/closes the data. WEB_SPECIFIC
    LogMessage('Parse Results Name:'+Name+'||');


    // Custom field: IMDb Cast (names only, separated by " • ")
    If ItemValue1='' Then
        ItemValue1:=Name
    Else
        ItemValue1:=ItemValue1+' • '+Name;


    curPos:=PosFrom('<a data-testid="title-cast-item__actor" href="',ItemList,curPos); // Move to the next actor's block
    index:=index+1;
End;


// Add custom field IMDb Cast
AddCustomFieldValueByName('IMDb Cast', ItemValue1);
// Log the IMDb Cast field for verification
LogMessage('IMDb Cast: '+ItemValue1);


// Log message and end block as in your script
LogMessage('Completed cast extraction process.');
LogMessage(#13+'');
End;


    //Get "plot_summary" as ~comment~ //debug_pos1-1







I will edit a special script for this, maybe today for you.


I don't want to bother you! This is only for my needs so far, so let's spare you!!!

This code of yours does not work for me. Can you attach your version of the script so I can see how it looks and works.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Moderator
  • *****
  • Posts: 468
    • View Profile
Re: Custom actors and directors field
« Reply #8 on: November 13, 2024, 11:06:21 pm »
IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script is attached.

Just to confirm that your script works! Thank you so much!

Offline afrocuban

  • Moderator
  • *****
  • Posts: 468
    • View Profile
Re: Custom actors and directors field
« Reply #9 on: November 13, 2024, 11:09:09 pm »

This code of yours does not work for me. Can you attach your version of the script so I can see how it looks and works.


Of course. Just to let you know that at the moment I'm working on Directors custom field. So, for now only IMDb Cast custom field works

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2711
    • View Profile
Re: Custom actors and directors field
« Reply #10 on: November 14, 2024, 08:18:36 am »
IMDB_[EN][HTTPS]_TEST_2c(Cast&Crew)_(afrocuban) script is attached.

Just to confirm that your script works! Thank you so much!

Thanks.


This code of yours does not work for me. Can you attach your version of the script so I can see how it looks and works.


Of course. Just to let you know that at the moment I'm working on Directors custom field. So, for now only IMDb Cast custom field works

Thank you for your script.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2711
    • View Profile
Re: Custom actors and directors field
« Reply #11 on: November 14, 2024, 10:58:34 am »
In the script, change the number of users to be transferred in the custom field, as shown in the following example.
Code: [Select]
  //PEOPLE_LIMITS  = 1000;    //Limit of number of actors (cast) or of credits (crew) retrieved on Main page. 
  //PEOPLE_LIMIT  = 1000;    //Limit of number of actors (cast) or of credits (crew) retrieved.
  PEOPLE_LIMITS  = 18;    //Limit of number of actors (cast) or of credits (crew) retrieved on Main page. 
  PEOPLE_LIMIT  = 25;    //Limit of number of actors (cast) or of credits (crew) retrieved.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD