Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
1
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 31, 2025, 11:35:38 am »

Function ParsePage(HTML: String;URL:AnsiString):Cardinal;   //BlockOpen

Minor code correction.

Quote
   
       //Get ~url~
        if (0=Pos(BASE_URL_PRE, StoredURL)) then begin   //Write the url if doesn't exist
            AddFieldValueXML('url', StringReplace(DownloadURL, BASE_URL_PRE_TRUE, BASE_URL_PRE, True, False, False));
            LogMessage('Function ParsePage -      Get result ~url~: ' + StringReplace(DownloadURL, BASE_URL_PRE_TRUE, BASE_URL_PRE, True, False, False) + ' | |');
        end;
      
        //Get ~IMDb Movie Url~ (CF~IMDb.com~) and (CF~WaybackArchive IMDb URLs~)
        Movie_URL := StringReplace(DownloadURL, BASE_URL_PRE_TRUE, BASE_URL_PRE, True, False, False);
      LogMessage('Function ParsePage -      Get result Movie_url: ' + Movie_URL + ' | |');
      
      AddCustomFieldValueByName('IMDb.com', '<link url="' + Movie_URL + '">IMDb.com</link>');
      
      AddCustomFieldValueByName('WaybackArchive IMDb URLs', '<link url="https://web.archive.org/web/*/' + Movie_URL + '*">*IMDb.com*</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'business">Busines</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'combined">Combined</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'fullcredits">Full Cast&Crew</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'awards">Awards</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'releaseinfo">ReleaseDates</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'technical">TechSpecs</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'parentalguide">ParentsGuide</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'keywords">PlotKeywords</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'plotsummary">PlotSummary</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'taglines">Taglines</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'movieconnections">Connections</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'soundtrack">Soundtracks</link>  <link url="https://web.archive.org/web/*/' + Movie_URL + 'externalsites">MiscSites</link>');
            
      Fullinfo1 := '';
      Fullinfo1 := Fullinfo1 + '<link url="http://www.boxofficemojo.com/title/' + MovieID + '">BoxOfficeMojo</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="http://en.wikipedia.org/w/index.php?search=' + GetFieldValue(2) + '">Wikipedia</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dmovies-tv&field-keywords=' + GetFieldValue(2) + '">AmazonSearch</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dmovies-tv&field-keywords=' + GetFieldValue(2) + '%20' + GetFieldValue(5) + '">AmazonSearch1</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="https://www.allmovie.com/search/movies/' + GetFieldValue(2) + '">AllMovieSearch</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="https://www.themoviedb.org/search?query=' + GetFieldValue(2) + '">TMDBSearch</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="https://www.rottentomatoes.com/search/?search=' + GetFieldValue(2) + '">RottenTomatoesSearch</link>  ';
      Fullinfo1 := Fullinfo1 + '<link url="https://www.thetvdb.com/search?query=' + GetFieldValue(2) + '">TVDB Search</link>  ';
      If Fullinfo1 <> '' then Fullinfo1 := Fullinfo1;
      If Fullinfo1 <> '' then AddCustomFieldValueByName('IMDbMovieLinksInfo', Fullinfo1);
            
      AddCustomFieldValueByName('IMDbSearchUrl', '<link url="http://www.imdb.com/find/?s=tt&q=' + StringReplace(GetFieldValueXML('title'), ' ', ' + ', True, True, False) + '">**Search IMDb**</link>  <link url="https://www.imdb.com/search/title?title=' + StringReplace(GetFieldValueXML('title'), ' ', ' + ', True, True, False) + '">Search IMDb</link>  ');
      
      AddCustomFieldValueByName('IMDbMoviesUrl', '<link url="' + Movie_URL + '">IMDb MovieUrl</link>  <link url="https://www.boxofficemojo.com/title/' + MovieID + '/">Box Office Mojo</link>  <link url="http://www.omdbapi.com/">OMDb API info</link>  <link url="http://www.omdbapi.com/apikey.aspx">OMDb API Key</link>');
      
      //AddCustomFieldValueByName('OMDbAPIUrl', '<link url="' + Movie_URL + '">IMDb MovieUrl</link>  <link url="http://www.omdbapi.com/?i=' + MovieID + '&apikey=[yourkey]&plot=short&tomatoes=true">OMDb API info for IMDb</link>  <link url="http://www.omdbapi.com/?i=' + MovieID + '&apikey=[yourkey]&plot=full&tomatoes=true">OMDb API full info for IMDb</link>  <link url="http://www.omdbapi.com/?i=' + MovieID + '&apikey=[yourkey]&plot=full&r=xml&tomatoes=true">OMDb API full xml info for IMDb</link>  <link url="http://www.omdbapi.com/?s=' + GetFieldValueXML('title') + '&apikey=[yourkey]&plot=short&tomatoes=true">OMDb API Search for IMDb</link>');
      //LogMessage('Function ParsePage -      Get result OMDb API info_URL: ' + #13 + '<link url="http://www.omdbapi.com/">OMDb API info</link>  <link url="http://www.omdbapi.com/apikey.aspx">OMDb API Key</link>' + ' | |');
            
      //(*
        Fullinfo := '';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + '">MainPage</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'reference">Reference</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'fullcredits">Full Cast&Crew</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'awards">Awards</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'releaseinfo">ReleaseDates</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'technical">TechSpecs</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'parentalguide">ParentsGuide</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'keywords">PlotKeywords</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'plotsummary">PlotSummary</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'locations">FilmLocations</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'taglines">Taglines</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'companycredits">CompanyCredits</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'movieconnections">Connections</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'soundtrack">Soundtracks</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'externalsites">MiscSites</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'externalsites#photos">MiscPhoto</link>  ';
        Fullinfo := Fullinfo + '<link url="' + Movie_URL + 'mediaindex">PhotoGallery</link>  ';
      Fullinfo := Fullinfo + '<link url="http://www.imdb.com/chart/top">IMDb Top 250</link>  ';
      Fullinfo := Fullinfo + '<link url="http://www.imdb.com/chart/bottom">Lowest Rated</link>  ';
      Fullinfo := Fullinfo + '<link url="http://www.imdb.com/chart/toptv">Top 250 TV</link>  ';
      Fullinfo := Fullinfo + '<link url="https://www.imdb.com/search/title?title=' + StringReplace(GetFieldValueXML('title') + '&title_type=feature&view=simple&count=250', ' ', ' + ', True, True, False) + '">Search IMDb</link>  ';
      Fullinfo := Fullinfo + '<link url="http://www.imdb.com/find?s=tt&q=' + StringReplace(GetFieldValueXML('title'), ' ', ' + ', True, True, False) + '">**Search IMDb**</link>  ';
      If Fullinfo <> '' then IMDB_URL := Fullinfo;
      If IMDB_URL <> '' then AddCustomFieldValueByName('CompE', IMDB_URL);
        If IMDB_URL <> '' then AddCustomFieldValueByName('IMDb_Movies_ Urls', IMDB_URL);
        //LogMessage('Function ParsePage -      Get result Fullinfo-IMDB_URL (CF~CompE~ ): ' + #13 + IMDB_URL + ' | |')
      //*)
Quote
    //Date ~Updated~ (choose simple or verbose version)
        Date := DateToStr(CurrentDateTime);
        //AddFieldValueXML('viewdate', Date); //Only date, don't admit time-. Set Seen value at the same time.
        //AddFieldValueXML('moddate', Date + ' ' + TimeToStr(CurrentDateTime)); //Block the dB saving
        ExplodeString(Date, DateParts, '-');
        Date := DateParts[2] + '.' + DateParts[1] + '.' + DateParts[0];
        Date := CustomStringReplace(Date, ['01.', '02.', '03.', '04.', '05.', '06.', '07.', '08.', '09.'], ['1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.']);
        //AddCustomFieldValueByName('Updated', Date); // Simple
        //AddCustomFieldValueByName('Updated0', Date + ' at ' + TimeToStr(CurrentDateTime)); // Verbose
        AddCustomFieldValueByName('IUpdated', Date + ' at ' + TimeToStr(CurrentDateTime) + ' • ' + SCRIPT_FILE_NAME + ' ' + SCRIPT_VERSION);  // Annoying
        LogMessage('Function ParsePage -    Provider data info retreived Ok in ' + DateToStr(CurrentDateTime) + ' ' + TimeToStr(CurrentDateTime) + '| (~Updated~)');
        Mode := smFinished;
        LogMessage('Function ParsePage smNormal END====================== |');
        Exit;
    End;
2
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 31, 2025, 10:28:16 am »

ParsePage_IMDBMovieCONNECTIONS

Minor code correction.

Quote
            // Format the category link
            Category1 := Category1 + '<link url="' + MovieURL + optionValue + '">' + categoryName + '</link>   •   ';
            //LogMessage('Function ParsePage_IMDBMovieCONNECTIONS - Formatted and added category link: ' + '<link url="' + MovieURL + optionValue + '">' + categoryName + '   •   </link>');
            
            // Move to the next position
            curPos := PosFrom('</option>', Category2, curPos) + Length('</option>');
            //LogMessage('Function ParsePage_IMDBMovieCONNECTIONS - Moved curPos to next option tag: ' + IntToStr(curPos));
         End;
         
         // Remove the trailing "   •   " if it exists and keep the last </link> intact
         If Copy(Category1, Length(Category1) - 13, 7) = '   •   ' Then
         Begin
            Category1 := Copy(Category1, 1, Length(Category1) - 14) + '</link>';
            //LogMessage('Function ParsePage_IMDBMovieCONNECTIONS - Removed trailing "   •   " and kept last </link> in Category1');
         End;
         
         //LogMessage('Function ParsePage_IMDBMovieCONNECTIONS - Final Category1 before combining: ' + Category1);
         
         // Combine and format the final result
         Category1 := '<link url="' + MovieURL + '">Connections:</link>                               ' + Category1;
         //LogMessage('Function ParsePage_IMDBMovieCONNECTIONS - Combined and formatted final Category1: ' + Category1);
         
         // Store the result in the custom field
Quote
         // Combine and format the final result
         if Category1 <> '' then
         Category1 := '<link url="' + MovieURL + '">Connections:</link>     •     ' + Category1
         Else
         Category1 := '<link url="' + MovieURL + '">Connections:</link>          ' + Category1;;
         //LogMessage('Function ParsePage_IMDBMovieCONNECTIONS - Combined and formatted final Category1: ' + Category1);


Function ParsePage_IMDBMovieCRITICREVIEWS

Minor code correction.

Quote
   //Get ~Metascore~
      EndPos := Pos('</span></span><span class="label"><span class="metacritic-score-label">Metascore</span></span></span></a></li></ul>', HTML);
      if EndPos>0 then begin
         curPos := PrevPos('">', HTML, EndPos) + Length('">');
         EndPos := PosFrom('</span></span><span class="label"><span class="metacritic-score-label">Metascore</span></span></span></a></li></ul>', HTML, curPos) + 2;
         //ItemValue := RemoveTags(Copy(HTML, curPos, endPos-curPos), false);
         ItemValue := Copy(HTML, curPos, endPos-curPos);
         LogMessage('Function ParsePage_IMDBMovieCRITICREVIEWS -      Get result Metascore original: ' + ItemValue + ' | |');
         ItemValue := CustomStringReplace(ItemValue, ['0</', '1</', '2</', '3</', '4</', '5</', '6</', '7</', '8</', '9</'], [',0', ',1', ',2', ',3', ',4', ',5', ',6', ',7', ',8', ',9']);
         //curPos := Pos('var ue_t0=ue_t0', ItemValue);                               //WEB_SPECIFIC.
         //If 0<curPos then ItemValue := Copy(ItemValue, 0, curPos-1);
         if ItemValue <> '' then AddCustomFieldValueByName('Metascore', FloatToStr((StrToFloat(ItemValue) * 1)));
         if ItemValue <> '' then LogMessage('Function ParsePage_IMDBMovieCRITICREVIEWS -      Get result Metascore in PVD format (CF~Metascore~): ' + ItemValue + ' | |');
      End;
3
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 31, 2025, 10:08:52 am »

Function ParsePage_IMDBMovieAWARDS

Minor code correction.

Quote
        // Extract category
        //categoryPos := PosFrom('<span class="ipc-metadata-list-summary-item__li awardCategoryName" aria-disabled="false">', Award, 1);
        categoryPos := PosFrom('<span class="ipc-metadata-list-summary-item__li awardCategoryName ipc-btn--not-interactable" aria-disabled="false">', Award, 1);
        If categoryPos > 0 Then Begin
         categoryPos := PosFrom('>', Award, categoryPos) + 1;
         endPos := PosFrom('</span>', Award, categoryPos);
         Category := Copy(Award, categoryPos, endPos - categoryPos);
         LogMessage('Function ParsePage_IMDBMovieAWARDS - Parsed Category: ' + Category);
        End Else Begin
         LogMessage('Function ParsePage_IMDBMovieAWARDS - Category tag not found');
         Category := '';
        End;
4
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 31, 2025, 09:59:36 am »
Function ParsePage_IMDBMovieTECHNICAL

Removing unnecessary parts of the code.

Quote
    //Get "Technical Specifications" info
    curPos := Pos('<hgroup><h1 class="ipc-title__text">Technical specifications</h1></hgroup>', HTML);
    if (curPos=0) then Exit;
      EndPos := curPos;

   ItemList2 := TextBetWeenFirst(HTML, '<h1 class="ipc-title__text">Technical specifications<', 'span id="contribute">Contribute to this page</span>'); //WEB_SPECIFIC.
   If (Length(ItemList2)>0) Then Begin

Removing unnecessary parts of code for custom fields.

Quote
     //Get "Sound Mix" info (CF~SILENT_FIELD~), (CF~Imdb SoundMix~) and (CF~Imdb Sound Mix~)
      curPos := Pos('Sound Mix', ItemList2);               //WEB_SPECIFIC.
      If 2<curPos Then Begin
         ItemValue := HTMLValues2(HTML, 'Sound Mix', '</ul>', '<li role="presentation" class="ipc-inline-list__item">', '</li>', '   ', EndPos);             //WEB_SPECIFIC.
         ItemValue1 := ItemValue;
         ItemValue := StringReplace(ItemValue, '   ', #13, True, False, True);
         ItemValue := StringReplace(ItemValue, '(', ' (', True, False, True);
         If ItemValue <> '' then LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      Get result Sound Mix: ' + ItemValue + ' | |');
         if ItemValue <> '' then ItemList := ItemList + 'Sound Mix' + '<br>' + ItemValue + '<br><br>';
         //  SILENT_FIELD       = 'Silent';
         if PosFrom('Silent', ItemValue, 1)>0 then AddCustomFieldValueByName(SILENT_FIELD, '-1');
         if ItemValue <> '' then AddCustomFieldValueByName('Imdb SoundMix', ItemValue);
         ItemValue1 := StringReplace(ItemValue1, '   ', #13 + ',  ', True, False, True);
         if ItemValue <> '' then AddCustomFieldValueByName('Imdb Sound Mix', RemoveTagsEx0(ItemValue1));
         If ItemValue1 <> '' then LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      Added result for (CF~Imdb SoundMix~) and (CF~Imdb Sound Mix~): ' + ItemValue1 + ' | |');
      End;

   
Quote
  //Get "Aspect Ratio" (CF~Imdb AspectRatio~), (CF~Imdb_Aspect Ratio~), (CF~Imdb Aspect Ratio~), (CF~Aspect Ratio~), (CF~Imdb Aspect Ratio:~) and (CF~Aspect Ratio:~) info
      curPos := Pos('Aspect Ratio', ItemList2);                //WEB_SPECIFIC.
      If 2<curPos Then Begin
         ItemValue := HTMLValues2(HTML, 'Aspect Ratio', '</ul>', '<li role="presentation" class="ipc-inline-list__item">', '</li>', '   ', EndPos);  //'<br><br>'
         ItemValue1 := ItemValue;
         //LogMessage('Function ParsePage_IMDBMovieTECHNICAL      Getting result initial ItemValue1 := ItemValue: ' + ItemValue + ' | |');
         ItemValue := StringReplace(ItemValue, '   ', #13, True, False, True);
         ItemValue := StringReplace(ItemValue, '(', ' (', True, False, True);
         If ItemValue <> '' then LogMessage('Function ParsePage_IMDBMovieTECHNICAL      Getting result ItemValue for the ~features~: ' + ItemValue + ' | |');
         if ItemValue <> '' then ItemList := ItemList + 'Aspect Ratio' + '<br>' + ItemValue + '<br><br>';
         ItemValue1 := StringReplace(ItemValue1, '/ (high definition)', ' HD', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, 'widescreen', 'WideScreen', True, False, True);
         (* //instead of this, I provided snippet that depends on ":" and not on AR, because in the existing snippet there are many ARs that are missing.
         ItemValue1 := StringReplace(ItemValue1, '16:9 HD', '16 : 9  HD', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, '4:3', '4 : 3', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, '2.55: 1', '2.55 : 1', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, '2.39: 1', '2.39 : 1', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, '2.40:1', '2.40 : 1', True, False, True);
         //*)
         ResultText := '';
         i := 1;

         While i <= Length(ItemValue1) Do Begin
            If ItemValue1 = ':' Then Begin
               // Check for spaces before and after the colon
               If (i > 1) And (ItemValue1[i-1] <> ' ') Then
               ResultText := ResultText + ' ';
               ResultText := ResultText + ':';
               If (i < Length(ItemValue1)) And (ItemValue1[i+1] <> ' ') Then
               ResultText := ResultText + ' ';
            End Else
            ResultText := ResultText + ItemValue1;
            i := i + 1;
         End;

         ItemValue1 := ResultText;
         //LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      ResultText: ' + ItemValue1 + ' | |');

         //ItemValue1 := StringReplace(ItemValue1, '1(', '1, (', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, '1(', '1 (', True, False, True);
         ItemValue1 := StringReplace(ItemValue1, ')   ', '), ', True, False, True);
         //LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      ItemValue1: ' + ItemValue1 + ' | |');
         
         // Initialize ItemValue3 to get ARs without descriptions
         ItemValue3 := '';
         ExplodeString(ItemValue1, ItemArray, ',');
         // Iterate through the array and extract only aspect ratios
         For i := 0 To High(ItemArray) Do Begin
            ItemArray := Trim(ItemArray);
            // Check if the entry contains an aspect ratio
            If Pos(':', ItemArray) > 0 Then Begin
               // Remove any parenthesis and their content
               ItemArray := Copy(ItemArray, 1, Pos('(', ItemArray) - 1);
               // Trim any trailing spaces
               ItemArray := Trim(ItemArray);
               // Append to ItemValue3
               If ItemValue3 <> '' Then
                  ItemValue3 := ItemValue3 + ', ';
                  ItemValue3 := ItemValue3 + ItemArray;
            End;
         End;
         //LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      ItemValue3 (Aspect Ratios only): ' + ItemValue3 + ' | |');

         if ItemValue <> '' then AddCustomFieldValueByName('Imdb_Aspect Ratio', StringReplace(RemoveTagsEx0(ItemValue1),'   ',',  ',True,False,True));   //As memo field, ARs with the description each as a comma separated list.
         if ItemValue <> '' then AddCustomFieldValueByName('Imdb Aspect Ratio', RemoveTagsEx0(ItemValue3));   //As memo field, ARs without the description as comma separated list.-------
         if ItemValue3 = '' then AddCustomFieldValueByName('Imdb Aspect Ratio', RemoveTagsEx0(ItemValue1));   //As memo field, ARs without the description as comma separated list.-------
         if ItemValue <> '' then AddCustomFieldValueByName('Aspect Ratio', ItemValue);   //As multiselect list field, ARs with the description each in separate line.
         if ItemValue1 <> '' then LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      ItemValue, ItemValue1 and ItemValue3 are added to a memo and multiselect list');
         //LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      ItemValue, ItemValue1 and ItemValue3 that are added to a memo and multiselect list):' + #13#10 + #13#10 + 'ItemValue added as:' + #13#10 + '---------' + #13#10 + ItemValue + ' | |' + #13#10 + #13#10 + 'ItemValue1 added as' + #13#10 + '---------' + #13#10 + ItemValue1 + ' | |' + #13#10 + #13#10 + 'ItemValue3 added as' + #13#10 + '---------' + #13#10 + ItemValue3 + ' | |' + #13#10);
      End;

Quote
      //Write to ~features~ and (CF~ImdbTechSpecs~) fields
      if (Length(ItemList)>0) then begin
         AddFieldValueXML('features', ItemList);
         AddCustomFieldValueByName('ImdbTechSpecs', ItemList); //Ivek23 CustomField ~ImdbTechSpecs~ for ~features~
         //LogMessage('Function ParsePage_IMDBMovieTECHNICAL -      Added result Movie ~features~ and (CF~ImdbTechSpecs~): ' + ItemList + ' | |');
      End;
     End;

Quote
   //if (ItemValue2 = '') AND (ItemValue00 <> '') then AddFieldValueXML('length', IntToStr(60*StrToInt(ItemValue0)));
   if (ItemValue2 <> '') AND (ItemValue = '') then AddFieldValueXML('length', IntToStr(60*StrToInt(ItemValue2)));
   if (ItemValue2 <> '') AND (ItemValue0 <> '') then AddFieldValueXML('length', IntToStr(60*StrToInt(ItemValue0)));
   if (ItemValue2 = '') AND (ItemValue0 <> '') then AddCustomFieldValueByName('Run time', ItemValue0);
   if (ItemValue2 <> '') AND (ItemValue0 = '') then AddCustomFieldValueByName('Run time', ItemValue2);
   if (ItemValue2 <> '') AND (ItemValue0 <> '') then AddCustomFieldValueByName('Run time', ItemValue0);
                     
   
    LogMessage('Function ParsePage_IMDBMovieTECHNICAL END=====================| |');
  End; //BlockClose
5
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 31, 2025, 09:43:19 am »
Function ParsePage_IMDBMovieREFERENCE

Custom field to remove.

Quote
   //(*
   // Get (CF~Year~) and ~year~
   If Pos('<div id="content-2-wide" class="redesign">', HTML)>0 Then Begin
      curPos := PosFrom('<h3 itemprop="name">', HTML, EndPos);
      EndPos := PosFrom('<section class="titlereference-section-overview">', HTML, curPos);
      ItemList := Copy(HTML, curPos, endPos-curPos);
      ItemValue10 := TextBetWeenFirst(ItemList, 'itemprop="url">', '</a>');
      //if ItemValue10 <> '' then AddCustomFieldValueByName('IMDB_year', ItemValue10);
      if ItemValue10 <> '' then AddCustomFieldValueByName('Year', ItemValue10);
      //If Not (USE_SAVED_PVDCONFIG And (ConfigOptions[4] = '0')) Then Begin
      if ItemValue10 <> '' then AddFieldValueXML('year', ItemValue10); //It looks like there is a bug in PVD. Year will be populated even if set to "None" in PVD)
      //End;
Quote
      // Get ~imdbrating~ (CF~IMDB Rating~), (~IMDBRating~)
            ItemValue2 := TextBetWeenFirst(ItemList, '<span class="ipl-rating-star__rating">', '</span>');
            //ItemValue2 := StringReplace(ItemValue2, ',', '.', True, False, False);       
            If ItemValue2 = '0' then ItemValue2 := '';
            if ItemValue2 <> '' then LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result ItemValue2: ' + ItemValue2 + ' | |');
            //if ItemValue2 <> '' then ItemList2 := ItemList2 + ItemValue2;
            //LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result  ItemList2 + ItemValue: ' + ItemList2 + ItemValue2 + ' | |');
         AddFieldValueXML('imdbrating',ItemValue2);
         LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result ratingValue ~imdbrating~ (CF~IMDB Rating~), (~IMDBRating~): ' + ItemValue2 + ' | |');
Quote
      // Get IMDb Votes (CF~IMDB_Votes~), (CF~IMDB Votes~), (CF~IMDB Votes:~)
            ItemValue12 := TextBetWeenFirst(ItemList, '<span class="ipl-rating-star__total-votes">(', ')</span>');
            ItemValue12 := StringReplace(ItemValue12, '.', '', True, False, False);       
            AddCustomFieldValueByName('IMDB Votes', ItemValue12);
            AddCustomFieldValueByName('IMDB Votes:', ItemValue12);
            if ItemValue12 <> '' then LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result ratingCount (CF~IMDB_Votes~): ' + ItemValue12 + ' | |');
            if ItemValue12 <> '' then LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result ItemValue12: ' + ItemValue12 + ' | |');
            //if ItemValue12 <> '' then ItemList2 := ItemList2 + '  ' + #8226 + '  ' + ItemValue12;
            //LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result   ItemList2: ' + ItemList2 + ' | |');
Quote
      //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Value of ReleaseInfoPageDownloaded: ' + BoolToStr(ReleaseInfoPageDownloaded))
      // Get Imdb Release Date ~rdate~, (CF~IMDB Release Date~), (CF~IMDB Release Dates~)
            ItemValue120 := TextBetWeenFirst(ItemList, '/releaseinfo">', '</a>');
            if ItemValue120 <> '' then LogMessage('Function  -      Get result ItemValue120: ' + ItemValue120 + ' | |');
            if ItemValue120 <> '' then AddCustomFieldValueByName('Imdb Release Date', ItemValue120);
            LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result DatePublished (CF~IMDB Release Date~): ' + ItemValue120 + ' | |');
            //End;
Quote
      // Get ~studio~ and (CF~IMDb Studio2~) "Production Co" (multiple values in a comma separated list)
            curPos := Pos('">Production compan', HTML); // WEB_SPECIFIC.
            //curPos := Pos('<a href="/company/co', HTML) + Length('<a href="/company/co'); // WEB_SPECIFIC.
               If 0 < curPos Then Begin
                  EndPos := curPos;
                  ItemValue := HTMLValues(HTML, '">Production compan', '</ul>', '<li>', '</a>', ', ', endPos);
                  //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get ItemValue Studio/Production Co multiple: ' + ItemValue + ' | |');
                  AddFieldValueXML('studio', ItemValue);
                  LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get results Studio/Production Co: ' + ItemValue + ' | |');
               End;
Quote
      If Not(TechnicalPageDownloaded) then Begin
      //If Not (USE_SAVED_PVDCONFIG And (ConfigOptions[23] = '0')) Then Begin
      // Get the original "Runtime" (in minutes) as ~length~ (in seconds), CF~Run time1~), and (CF~Imdb Runtime1~) instead of the duration of the user movie copy
               curPos := Pos('</li>', ItemList) + Length('</li>');
               //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result curPos for ~length~: ' + IntToStr(curPos) + ' | |');
               ItemList := Copy(ItemList, curPos, endPos - curPos);
               //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result ItemList for ~length~: ' + ItemList + ' | |');
               ItemValue := TextBetWeenFirst(ItemList, '<li class="ipl-inline-list__item">', '</li>');
               LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result ItemValue for ~length~: ' + ItemValue + ' | |');

               if curPos > 0 then
               begin
                  // Extract hours and minutes
                  Hours := 0;
                  Minutes := 0;
                  
                  if Pos('h', ItemValue) > 0 then
                  begin
                     Hours := StrToIntDef(Copy(ItemValue, 1, Pos('h', ItemValue) - 1), 0);
                     ItemValue := Copy(ItemValue, Pos('h', ItemValue) + 1, Length(ItemValue));
                  end;
                  
                  if Pos('min', ItemValue) > 0 then
                  begin
                     Minutes := StrToIntDef(Copy(ItemValue, 1, Pos('min', ItemValue) - 1), 0);
                  end;
                  
                  ItemValue := IntToStr(Hours * 60 + Minutes);
                  if ItemValue = '0' then ItemValue := '';
                  
                  if ItemValue <> '' then
                  begin
                     //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result Original Runtime: ' + ItemValue + ' | |');
                     AddFieldValueXML('length', IntToStr(60 * StrToInt(ItemValue))); //~length~ Value in seconds.
                     AddCustomFieldValueByName('Run time 1', ItemValue);
                     AddCustomFieldValueByName('Imdb Runtime 1', IntToStr(Hours) + 'h' + ' ' + IntToStr(Minutes) + 'm (' + ItemValue + ' minutes)');
                     LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result "Runtime" (in minutes) ~length~, (CF~Run time1~), and (CF~Imdb Runtime1~) : ' + ItemValue + ' | |');
                  end;
               end
               else
               begin
                  LogMessage('Function ParsePage_IMDBMovieREFERENCE - duration/length not found');
               end;
         //End;
      End;   //   If Not(TechnicalPageDownloaded) then Begin should end here


Quote
      If Not (MainPageDownloaded) And Not (TechnicalPageDownloaded) Then Begin
      //Get "Color" (CF~Color :~) & (CF~'Imdb Color :~) (multiple values in a comma separated list)
            curPos := Pos('<td class="ipl-zebra-list__label">Color</td>', HTML);
               //LogMessage('Function ParsePage_IMDBMovieBASE - Get result curPos (CF~Color~) & (CF~Imdb Color~): ' + IntToStr(curPos) + ' | |');
            if 0<curPos then begin
               EndPos := curPos;
               ItemValue := HTMLValues2(HTML, '<td class="ipl-zebra-list__label">Color</td>', '</ul>', '<li class="ipl-inline-list__item">', '</li>', ', ', EndPos);
               //LogMessage('Function ParsePage_IMDBMovieREFERENCE -       Get result ItemValue after HTMLValues2 (CF~Color~) & (CF~Imdb Color~): ' + ItemValue + ' | |');
               //ItemValue := StringReplace(ItemValue, '|        ', ', ', True, True, False);    //WEB_SPECIFIC.
               ItemValue := StringReplace(ItemValue, '(', ' (', True, True, False);          //WEB_SPECIFIC.
               if ItemValue <> '' then ItemList := ItemList + 'Color: ' + ItemValue + '<br>';
               if ItemValue <> '' then AddCustomFieldValueByName('Color :', ItemValue);
               if ItemValue <> '' then AddCustomFieldValueByName('Imdb Color :', ItemValue);

               if ItemValue <> '' then LogMessage('Function ParsePage_IMDBMovieBASE -       Get result (CF~Color :~) and (CF~Imdb Color :~): ' + ItemValue + ' | |');
            End;
      End;   //If Not (MainPageDownloaded) And Not (TechnicalPageDownloaded) Then Begin should end here

Removing unnecessary parts of the code.

Quote
(*
   If Not (MainPageDownloaded) Then Begin
   // Go to "Connections" (CF~Conect~) (CF~MiniConnections~) (CF~FOLLOWEDBY_FIELD~)
      // Initialize the string to collect all entries
      allItemValues := '';
      
      StartPos := Pos('<td class="ipl-zebra-list__label">Movie Connections</td>', HTML);
      If StartPos > 0 Then Begin
         // Define the end marker for the "Connections" section
         EndPos := PosFrom('</tr>', HTML, StartPos);
         If EndPos > StartPos Then Begin
            // Extract the relevant HTML section
            ItemValue := Copy(HTML, StartPos, EndPos - StartPos);
            //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result ItemValue for (CF~Conect~) (CF~MiniConnections~) (CF~FOLLOWEDBY_FIELD~) : ' + #13 + ItemValue + ' | |' + #13);

            // Initialize connections container
            Connections := '';

            // Define connection types
            connectionTypes := ['Featured in', 'Follows', 'Followed by', 'Referenced in', 'Remade as', 'Remake of', 'Spin-off', 'Spoofed in', 'Edited into', 'Edited from', 'Version of', 'Features', 'References', 'Spoofs', 'Spin-off from'];

            // Iterate through each type of connection using an indexed loop
            For i := Low(connectionTypes) To High(connectionTypes) Do Begin
               connType := connectionTypes;
               connStartPos := PosFrom(connType, ItemValue, 1);
               While connStartPos > 0 Do Begin
                  connEndPos := PosFrom('</a>', ItemValue, connStartPos) + Length('</a>') - 1;
                  If connEndPos > connStartPos Then Begin
                     connHTML := Copy(ItemValue, connStartPos, connEndPos - connStartPos + 1);

                     // Extract the link URL
                     linkStartPos := PosFrom('<a href="', connHTML, 1) + Length('<a href="');
                     linkEndPos := PosFrom('">', connHTML, linkStartPos);
                     linkURL := Copy(connHTML, linkStartPos, linkEndPos - linkStartPos);

                     // Extract the link text
                     textStartPos := linkEndPos + Length('">');
                     textEndPos := PosFrom('</a>', connHTML, textStartPos);
                     linkText := Copy(connHTML, textStartPos, textEndPos - textStartPos);

                     // Build the custom format
                     connHTML := connType + ' <link url="https://www.imdb.com' + linkURL + '">' + linkText + '</link>';

                     // Append to connections container
                     If Length(Connections) > 0 Then
                        Connections := Connections + ', ' + connHTML
                     Else
                        Connections := connHTML;
                  End;
                  connStartPos := PosFrom(connType, ItemValue, connStartPos + Length(connHTML));
               End;
            End;

            LogMessage('Function ParsePage_IMDBMovieREFERENCE - Final processed Connections: ' + Connections + ' | |' + #13);

            // Add custom field values
            AddCustomFieldValueByName('Conect', Connections);
            AddCustomFieldValueByName('MiniConnections', Connections);

            // Add condition to check "Followed By" presence and add custom field value
            If PosFrom('Followed By', Connections, 1) > 0 Then
               AddCustomFieldValueByName(FOLLOWEDBY_FIELD, '-1');
         End;
      End Else
         LogMessage('Function ParsePage_IMDBMovieREFERENCE - (CF~Conect~) (CF~MiniConnections~) (CF~FOLLOWEDBY_FIELD~) not found');
   *)
      (*
      //Go to "Soundtracks" (CF~MiniSoundtracks~)
      StartPos := Pos('<td class="ipl-zebra-list__label">Soundtracks</td>', HTML);
      if StartPos>0 then begin
         //ItemValue := HTMLValue(HTML, StartPos, 0, '<div><span class="soundtrack-', '</div>');
         ItemValue := TextBetWeen(HTML, '<td>', '<a href=', False, StartPos);
         AddCustomFieldValueByName('MiniSoundtracks', ItemValue);
         if ItemValue <> '' then LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result Soundtracks (CF~MiniSoundtracks~): ' + #13 + ItemValue + #13);
      end else
         LogMessage('Function ParsePage_IMDBMovieREFERENCE - (CF~MiniSoundtracks~) not found');   
   End;   //If Not (MainPageDownloaded) Then Begin should end here
*)   
6
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 31, 2025, 07:32:49 am »
Function ParsePage_IMDBMovieREFERENCE

Minor code correction.

Quote
Function ParsePage_IMDBMovieREFERENCE(HTML:String):Cardinal; //BlockOpen
    //Returns:
    //     Result := prFinished; Script has finished gathering data
    //     Result := prError; //It will change to prError if any major issue occurs and will exit;
    //Retrieve: REFERENCE~
  Var
    curPos, endPos, debug_pos1:Integer;
    MoviesID, MoviesID2: String;
   ItemValue, ItemList, ItemList2, ItemList22: String;
   ItemValue22, ItemValue3, ItemValue30, ItemValue31: String;
   ItemValue00, ItemValue0, ItemValue1, ItemValue2: String;
   ItemValue10, ItemValue11, ItemValue12, ItemValue40: String;
   ItemValue100, ItemValue120, ItemValue140, ItemValue220: String;
    ItemValue33, ItemList33, enTitleValue, enTitleList: String;
   ItemValue320, ItemValue330: String;
   .
   .
   .
   
  Begin
    LogMessage('Function ParsePage_IMDBMovieREFERENCE BEGIN=====================| |');
    Result := prFinished;  //It will change to prError if any major issue occurs and will exit;   
Quote
      //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Value of ReleaseInfoPageDownloaded: ' + BoolToStr(ReleaseInfoPageDownloaded))
      // Get Imdb Release Date ~rdate~, (CF~IMDB Release Date~), (CF~IMDB Release Dates~)
            ItemValue120 := TextBetWeenFirst(ItemList, '/releaseinfo">', '</a>');
            if ItemValue120 <> '' then LogMessage('Function  -      Get result ItemValue120: ' + ItemValue120 + ' | |');
            if ItemValue120 <> '' then AddCustomFieldValueByName('Imdb Release Date', ItemValue120);
            //AddCustomFieldValueByName('IMDB Release Dates', ItemValue120);
            LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result DatePublished (CF~IMDB Release Date~): ' + ItemValue120 + ' | |');
            ItemValue320 := TextBetWeenFirst(ItemList, '/releaseinfo">', ' (');
            //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result DatePublished 320 for ~rdate~): ' + ItemValue320 + ' | |');
         //   ItemValue320 := ConfDate2(ItemValue320);
            //LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result DatePublished ItemValue320 after ConfDate2 for ~rdate~): ' + ItemValue320 + ' | |');
         //   AddFieldValueXML('rdate', ItemValue320); // Function ConfDate2 to ensure the day and month always have two digits and to format the date independently of regional settings.
            LogMessage('Function ParsePage_IMDBMovieREFERENCE - Get result ~rdate~: ' + ItemValue320 + ' | |');
            //End;
Quote
      //Get Plot Summary from "Storyline" section as ~description~
            curPos := Pos('<td class="ipl-zebra-list__label">Plot Summary</td>', HTML);                                 //WEB_SPECIFIC.
            If 0<curPos then begin
               ItemValue330 := TextBetWeen(HTML, '<p>', '</p>', false, curPos);        //Strings which opens/closes the data. WEB_SPECIFIC
               //LogMessage('Function ParsePage_IMDBMovieREFERENCE -      Get result ItemValue330 for ~description~ from the "Storyline": ' + #13 + ItemValue330 + ' | |');
               curPos := Pos('Written by', ItemValue330);                               //WEB_SPECIFIC.
               If 0<curPos then ItemValue330 := Copy(ItemValue330, 0, curPos-1);
               curPos := Pos('Seasons', ItemValue330);                               //WEB_SPECIFIC.
               If 0<curPos then ItemValue330 := Copy(ItemValue330, 0, curPos-1);
               curPos := Pos('Season', ItemValue330);                               //WEB_SPECIFIC.
               If 0<curPos then ItemValue330 := Copy(ItemValue330, 0, curPos-1);
               curPos := Pos('Year:', ItemValue330);                               //WEB_SPECIFIC.
               If 0<curPos then ItemValue330 := Copy(ItemValue330, 0, curPos-1);
               ItemValue330 := StringReplace(ItemValue330, 'Know what this is about?', '', true, false, true);  //Cleaning. WEB_SPECIFIC.
               ItemValue330 := StringReplace(ItemValue330, 'Be the first one to add a plot.', '', true, false, true);  //Cleaning. WEB_SPECIFIC.
               ItemValue330 := StringReplace(ItemValue330, 'IMDb Answers surfaces high-value content that is missing from IMDb.', '', true, false, true);  //Cleaning. WEB_SPECIFIC.
               ItemValue330 := StringReplace(ItemValue330, ' -- ', ' — ', True, False, True);
               //AddFieldValueXML('description', ItemValue330);
               if ItemValue330 <> '' then LogMessage('Function ParsePage_IMDBMovieREFERENCE -      added result for ~description~ from the "Storyline": ' + #13 + ItemValue330 + ' | |');
            End;
            if (ItemValue330 = '') AND (ItemValue22 <> '') then
            AddFieldValueXML('description', ItemValue22);
            AddCustomFieldValueByName('Description', ItemValue22);
            if (ItemValue330 <> '') AND (ItemValue22 <> '') then
            AddFieldValueXML('description', ItemValue330);
            AddCustomFieldValueByName('Description', ItemValue330);
7
PVD Python Scripts / Re: New IMDb Movie v4 Script Discussion
« Last post by Ivek23 on March 31, 2025, 07:18:18 am »
Due to certain changes in the source code of the page, certain information is now not transferred by the script.

This happens mainly where a certain part of the code needs to be changed as can be seen in the examples below.

This part of the code

Quote
'<span class="ipc-metadata-list-item__label"'
will need to be changed with this part of the code
Quote
'<span class="ipc-metadata-list-item__label ipc-btn--not-interactable"'

or

This part of the code

Quote
'<span class="ipc-metadata-list-item__list-content-item"'
will need to be changed with this part of the code
Quote
'<span class="ipc-metadata-list-item__list-content-item ipc-btn--not-interactable"'

Once these changes are made, the script transfers information normally.

This will need to be done everywhere where the above parts of the code are.

And this:

First, it will be necessary to optimize the existing script so that it transfers all the information, because it currently does not transfer all of it due to code duplication, especially in the ParsePage_IMDBMovieREFERENCE Function.

Only then, when the script works optimally, should additional ParsePage_IMDB Functions be added.
8
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 30, 2025, 01:17:08 pm »
Function ParsePage_IMDBMovieMPAA

Minor code correction.

Quote
//(*
   // Get "Certification" (CF~Certification~) info
      If Pos('<span id="certificates">Certifications</span>', HTML) > 0 Then
      Begin
        curPos := Pos('<span id="certificates">Certifications</span>', HTML);
        EndPos := PosFrom('</section>', HTML, curPos);

        // Extract the relevant section
        Section := Copy(HTML, curPos, EndPos - curPos);
        //LogMessage('Function ParsePage_IMDBMovieMPAA - Extract the relevant Section: ' + Section + ' | |');

        curPos := 1;
        ItemValue1 := '';

        // Parse the certification items
        While PosFrom('"certificates-item">', Section, curPos) > 0 Do
        Begin
         // Move to the label
         curPos := PosFrom('<span class="ipc-metadata-list-item__label ipc-btn--not-interactable" aria-disabled="false"', Section, curPos) + Length('<span class="ipc-metadata-list-item__label ipc-btn--not-interactable" aria-disabled="false"');
         categoryName := TextBetween(Section, '>', '</span>', False, curPos);
         //LogMessage('Function ParsePage_IMDBMovieMPAA - categoryName after TextBetween: ' + categoryName + ' | |');

         // Move to the value
         curPos := PosFrom('href="', Section, curPos) + Length('href="');
         categoryValue := TextBetween(Section, '">', '</a>', False, curPos);
         //LogMessage('Function ParsePage_IMDBMovieMPAA - categoryValue after TextBetween: ' + categoryValue + ' | |');

         // Format the category link with proper spaces
         ItemValue1 := ItemValue1 + '   •   ' + categoryName + ': ' + categoryValue + '<br>';

         // Move to the next item
         curPos := PosFrom('</li>', Section, curPos) + Length('</li>');
        End;

        // Remove the trailing "   •   " if it exists and keep the last </br> intact
        If Copy(ItemValue1, Length(ItemValue1) - 14, 14) = '<br>   •   ' Then
        Begin
         ItemValue1 := Copy(ItemValue1, 1, Length(ItemValue1) - 14);
        End;

        AddCustomFieldValueByName('Certification', 'Certification<br>' + ItemValue1);
        If ItemValue1 <> '' Then
         LogMessage('Function ParsePage_IMDBMovieMPAA - Certification:<br>' + ItemValue1 + ' | |');
      End
      Else
      Begin
        LogMessage('Function ParsePage_IMDBMovieMPAA - Certification section not found');
        Result := prError; // Set to error if Certification section is not found
      End;
//*)
    LogMessage('Function ParsePage_IMDBMovieMPAA END=====================| |');
  End; //BlockClose
9
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Confusion
« Last post by Ivek23 on March 30, 2025, 12:53:48 pm »
Function ParsePage_IMDBMovieAKA

Minor code correction.

Quote
//(*   
    //Get ~aka~ (multiple values in a line break separated list) Be careful don't repeat #13
   // Note that "For" loop iterates through each element in the ItemArray and checks if it is already present in the ItemValue string. If it's not present, it adds it to ItemValue. only unique AKA values are stored and logged!
    //if (Pos('It looks like we don' + Chr(39) + 't have any AKAs for this title yet.', HTML)>0) then Exit;
    //Go to "Also Known As"
    curPos := Pos('<h3 class="ipc-title__text"><span id="akas">Also Known As (AKA)</span>', HTML);                      //Strings start which opens the block content data. WEB_SPECIFIC
   If 0<curPos then begin
      EndPos := curPos;
      //ItemList := HTMLValues2(HTML, '<h3 class="ipc-title__text"><span id="akas">Also Known As (AKA)</span>', '</section>', '<label class="', '</label>', '*', EndPos);
      ItemList := HTMLValues2(HTML, '<h3 class="ipc-title__text"><span id="akas">Also Known As (AKA)</span>', '</section>', '<span class="ipc-metadata-list-item__list-content-item ipc-btn--not-interactable"', '</span>', '*', EndPos);
      //LogMessage('Function ParsePage_IMDBMovieAKA -      Get result ItemList: ' + ItemList);
      ItemValue1 := ItemList;
      ExplodeString(ItemList, ItemArray, '*');
      ItemValue := '';
      For index := Low(ItemArray) To High(ItemArray) Do Begin        //Remember index begins at 0
         //LogMessage('Function ParsePage_IMDBMovieAKA -      Get result ItemArray[index]*: ' + ItemArray[index]);
         If (Pos(ItemArray[index], ItemValue)=0) Then ItemValue := ItemValue + '<br>' + ItemArray[index];
      End;
      //ItemValue := StringReplace(ItemValue, '', '', True, True, False);
      AddFieldValueXML('aka', ItemValue);
      AddCustomFieldValueByName('Imdb Aka', ItemValue);
      if ItemValue <> '' then LogMessage('Function ParsePage_IMDBMovieAKA -      Get results ~aka~ & (CF~Imdb Aka~) : ' + ItemValue);
   End;
//*)
//(*   
// Initialize the string to collect all entries
allItemValues := '';

// Get "Also Known As (AKA)" information with countries
curPos := Pos('>Also Known As (AKA)<', HTML);
If 0 < curPos Then Begin
    EndPos := PosFrom('</section>', HTML, curPos);

    While curPos < EndPos Do Begin
        // Find each list item
        curPos := PosFrom('<li role="presentation" class="ipc-metadata-list__item', HTML, curPos);
        If (curPos = 0) Or (curPos > EndPos) Then Break;

        // Extract the country or label
        countryStart := PosFrom('<span class="ipc-metadata-list-item__label ipc-btn--not-interactable"', HTML, curPos) + Length('<span class="ipc-metadata-list-item__label ipc-btn--not-interactable" aria-disabled="false">');
        countryEnd := PosFrom('</span>', HTML, countryStart);
        countryValue := Copy(HTML, countryStart, countryEnd - countryStart);

        // Extract the AKA title
        akaStart := PosFrom('<span class="ipc-metadata-list-item__list-content-item ipc-btn--not-interactable"', HTML, countryEnd) + Length('<span class="ipc-metadata-list-item__list-content-item ipc-btn--not-interactable" aria-disabled="false">');
        akaEnd := PosFrom('</span>', HTML, akaStart);
        akaValue := Copy(HTML, akaStart, akaEnd - akaStart);

        // Move curPos past the end of the AKA title span
        curPos := akaEnd + Length('</span>');

        // Extract any subText (like (English), (Japanese), etc.)
        subTextStart := PosFrom('<span class="ipc-metadata-list-item__list-content-item--subText"', HTML, akaEnd);
        If (subTextStart > 0) And (subTextStart < PosFrom('</li>', HTML, akaStart)) Then Begin
            subTextStart := subTextStart + Length('<span class="ipc-metadata-list-item__list-content-item--subText">');
            subTextEnd := PosFrom('</span>', HTML, subTextStart);
            subText := Copy(HTML, subTextStart, subTextEnd - subTextStart);
            akaValue := akaValue + ' ' + subText;
            // Move curPos past the end of the subText span
            curPos := subTextEnd + Length('</span>');
        End Else
            subText := '';

        // Combine country and AKA for the custom field
        ItemValue := countryValue + ' - ' + akaValue;

        // Collect the result
        allItemValues := allItemValues + ItemValue + #13#10;

        // Move to the next list item
        curPos := PosFrom('</li>', HTML, curPos) + Length('</li>');
    End;

    // Add the collected results to the custom field
    AddCustomFieldValueByName('IMDbCountryAKA', allItemValues);
    LogMessage('Function ParsePage_IMDBMovieAKA - Get result IMDbCountryAKA: ' + allItemValues);
End;
//*)
//(*
   // Get (CF~IMDbPremiereDates~) information with countries and dates
      // Initialize the string to collect all entries
      allItemValues := '';

      curPos := Pos('<h3 class="ipc-title__text"><span id="releases">Release Date</span>', HTML);
      LogMessage('Function ParsePage_IMDBMovieAKA - CurPos initial: ' + IntToStr(curPos));
      If 0 < curPos Then Begin
         EndPos := PosFrom('</section>', HTML, curPos);
         //LogMessage('Function ParsePage_IMDBMovieAKA - EndPos: ' + IntToStr(EndPos));

         While curPos < EndPos Do Begin
            // Find each list item
            curPos := PosFrom('<li role="presentation" class="ipc-metadata-list__item ipc-metadata-list', HTML, curPos);
            //LogMessage('Function ParsePage_IMDBMovieAKA - CurPos list item: ' + IntToStr(curPos));
            If (curPos = 0) Or (curPos > EndPos) Then Break;

            // Extract the country or label
            countryStart := PosFrom('aria-label="', HTML, curPos) + Length('aria-label="');
            countryEnd := PosFrom('"', HTML, countryStart);
            countryValue := Copy(HTML, countryStart, countryEnd - countryStart);
            //LogMessage('Function ParsePage_IMDBMovieAKA - CountryValue for (CF~IMDbPremiereDates~): ' + countryValue);

            // Extract the release date
            dateStart := PosFrom('<span class="ipc-metadata-list-item__list-content-item ipc-btn--not-interactable" aria-disabled="false">', HTML, countryEnd) + Length('<span class="ipc-metadata-list-item__list-content-item ipc-btn--not-interactable" aria-disabled="false">');
            dateEnd := PosFrom('</span>', HTML, dateStart);
            dateValue := Copy(HTML, dateStart, dateEnd - dateStart);
            //LogMessage('Function ParsePage_IMDBMovieAKA - DateValue for (CF~IMDbPremiereDates~): ' + dateValue);

            // Move curPos past the end of the date span
            curPos := dateEnd + Length('</span>');
            //LogMessage('Function ParsePage_IMDBMovieAKA - CurPos after date for (CF~IMDbPremiereDates~): ' + IntToStr(curPos));

            // Extract any subText (like (limited), (Fantasia International Film Festival), etc.)
            subTextStart := PosFrom('<span class="ipc-metadata-list-item__list-content-item--subText"', HTML, dateEnd);
            //LogMessage('Function ParsePage_IMDBMovieAKA - SubTextStart for (CF~IMDbPremiereDates~): ' + IntToStr(subTextStart));
            If (subTextStart > 0) And (subTextStart < PosFrom('</li>', HTML, dateStart)) Then Begin
               subTextStart := subTextStart + Length('<span class="ipc-metadata-list-item__list-content-item--subText">');
               subTextEnd := PosFrom('</span>', HTML, subTextStart);
               subText := Copy(HTML, subTextStart, subTextEnd - subTextStart);
               dateValue := dateValue + ' ' + subText;
               // Move curPos past the end of the subText span
               curPos := subTextEnd + Length('</span>');
               //LogMessage('Function ParsePage_IMDBMovieAKA - SubText for (CF~IMDbPremiereDates~): ' + subText);
               //LogMessage('Function ParsePage_IMDBMovieAKA - CurPos after subText for (CF~IMDbPremiereDates~): ' + IntToStr(curPos));
            End Else
               subText := '';

            // Combine country, date, and subText for the custom field
            ItemValue := countryValue + ' - ' + dateValue;
            //LogMessage('Function ParsePage_IMDBMovieAKA - ItemValue for (CF~IMDbPremiereDates~): ' + ItemValue);

            // Collect the result
            allItemValues := allItemValues + ItemValue + #13#10;

            // Move to the next list item
            curPos := PosFrom('</li>', HTML, curPos) + Length('</li>');
            //LogMessage('Function ParsePage_IMDBMovieAKA - CurPos after </li>: ' + IntToStr(curPos));
         End;

         // Add the collected results to the custom field
         AddCustomFieldValueByName('IMDbPremiereDates', allItemValues);
         LogMessage('Function ParsePage_IMDBMovieAKA - Get result (CF~IMDbPremiereDates~): ' + allItemValues);
      End;
//*)

    LogMessage('Function ParsePage_IMDBMovieAKA END=====================| |');
   //LogMessage('Function ParsePage_IMDBMovieAKA: Ending processing.')
  End; //BlockClose
10
PVD Python Scripts / Re: PVD Selenium MOD v4 IMDb Movie Script Custom Fields
« Last post by Ivek23 on March 29, 2025, 04:11:46 pm »
ParsePage_IMDBMoviePLOTKEYWORDS

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • Title1 (Multiselect list)
  • Plot Keywords (Memo)


ParsePage_IMDBMovieTECHNICAL

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • mdb Runtime1 (Multiselect list)
  • Imdb SoundMix (Memo)
  • Imdb Sound Mix (Multiselect list)
  • Imdb_Color (Multiselect list)
  • Imdb Color: (Multiselect list)
  • Imdb_Aspect Ratio (Multiselect list)
  • Imdb Aspect Ratio (Multiselect list)
  • Aspect Ratio (Multiselect list)
  • ImdbTechSpecs (Memo)
  • Run time (Short Text)


ParsePage_IMDBMovieAWARDS

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • IMDbAwards1 (Memo) or (Long Text)


ParsePage_IMDBMovieCONNECTIONS

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • Connect (Multiselect list)


ParsePage_IMDBMoviePLOTSUMMARY

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • Plot Summary (Memo) or (Long Text)
  • IMDB Synopsis (Memo) or (Long Text)


ParsePage_IMDBMovieCRITICREVIEWS

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • Metascore (Rating)


Function ParsePage

PVD custom field for Type/Comments in Preferences/Movies/Custom Items:

  • IMDbID or IMDbID: (Short Text)
  • IMDb.com (Memo)
  • WaybackArchive IMDb URLs (Memo)
  • IMDbMovieLinksInfo (Memo)
  • IMDbSearchUrl (Memo)
  • IMDbMoviesUrl (Memo)
  • CompE or IMDb_Movies_ Urls (Memo)
  • Plotsummary_URL (Memo)
  • Download_URL (Memo)
  • IUpdated (Long Text)
Pages: [1] 2 3 4 5 6 ... 10