Author Topic: IMDb [EN][HTTPS](series) issues and support  (Read 1269 times)

0 Members and 2 Guests are viewing this topic.

Offline afrocuban

  • Older Power User
  • *****
  • Posts: 362
    • View Profile
IMDb [EN][HTTPS](series) issues and support
« on: December 08, 2021, 09:16:11 pm »
In all IMDB_ [EN] [HTTPS], IMDB_ [EN] (HTTPS] (series) and IMDB_ [EN] [HTTPS] (episodes) scripts, Runtime information is now incorrectly downloaded. The reason is a change in the source code of the primary Imdb web pages. I have fixed this bug and all Imdb scripts may be added to the forum tonight or tomorrow.

I have a custom field Run time for runtime. In IMDB_ [EN] [HTTPS] I added
Quote
AddCustomFieldValueByName('Run time',ItemValue);

I did analog in IMDB_ [EN] (HTTPS] (series) by adding

Quote
1104      AddCustomFieldValueByName('Run time',ItemValue1);

but for some reason it doesn't work.

Since the only way to record actual media length in PVD is to record it to Duration field, I'd prefer IMDb length to be recorded to a custom field Run time

Any help on this, please?

EDIT:

If I put
Quote
1111     AddCustomFieldValueByName('Run time',ItemValue00);

I get length 1 hour for https://www.imdb.com/title/tt8694364/, but not 60 minutes???
« Last Edit: December 08, 2021, 10:32:31 pm by afrocuban »

Offline afrocuban

  • Older Power User
  • *****
  • Posts: 362
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #1 on: December 09, 2021, 12:35:53 am »
Also, IMDB_Series-year custom field doesn't import category and year as it did until recent layout changes.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2511
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #2 on: December 09, 2021, 08:49:20 am »
I will edit AllMovie scripts first, then I will edit your requests and problems with Imdb scripts.
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: 2511
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #3 on: December 17, 2021, 08:13:39 am »
In all IMDB_ [EN] [HTTPS], IMDB_ [EN] (HTTPS] (series) and IMDB_ [EN] [HTTPS] (episodes) scripts, Runtime information is now incorrectly downloaded. The reason is a change in the source code of the primary Imdb web pages. I have fixed this bug and all Imdb scripts may be added to the forum tonight or tomorrow.

I have a custom field Run time for runtime. In IMDB_ [EN] [HTTPS] I added
Quote
AddCustomFieldValueByName('Run time',ItemValue);

I did analog in IMDB_ [EN] (HTTPS] (series) by adding

Quote
1104      AddCustomFieldValueByName('Run time',ItemValue1);

but for some reason it doesn't work.

Since the only way to record actual media length in PVD is to record it to Duration field, I'd prefer IMDb length to be recorded to a custom field Run time

Any help on this, please?

EDIT:

If I put
Quote
1111     AddCustomFieldValueByName('Run time',ItemValue00);

I get length 1 hour for https://www.imdb.com/title/tt8694364/, but not 60 minutes???

For afrocuban

In IMDB_ [EN] [HTTPS] script it is necessary to change the Runtime code in Function ParsePage_IMDBMovieBASE.
Quote
    //Get the original "Runtime" (in minutes) as ~length~ (in seconds) instead of the duration of the user movie copy
   StartPos:=Pos('<span class="ipc-metadata-list-item__label">Runtime</span>',HTML);
   if StartPos>0 then begin
      Hours:=StrToInt(HTMLValue(HTML,StartPos,0,'<div class="ipc-metadata-list-item__content-container">','<!-- --> <!-- -->hour'));
      Minutes:=StrToInt(HTMLValue(HTML,StartPos,0,'hour<!-- --> <!-- -->','<!-- --> <!-- -->minutes'));
      ItemValue:=IntToStr(Hours*60 + Minutes);
      If ItemValue = '0' then ItemValue:='';
      If ItemValue = '' then Minutes:=StrToInt(HTMLValue(HTML,StartPos,0,'<div class="ipc-metadata-list-item__content-container">','<!-- --> <!-- -->minutes'));
      ItemValue:=IntToStr(Hours*60 + Minutes);      
      //LogMessage('duration: '+ItemValue);
      if ItemValue <> '' then LogMessage('      Get result Original Runtime:'+ItemValue+'||');
      //AddFieldValueXML('duration', ItemValue);
       AddFieldValueXML('length',IntToStr(60*StrToInt(ItemValue))); //~length~ Value in seconds.
      if ItemValue <> '' then AddCustomFieldValueByName('Run time1',ItemValue);
      if ItemValue <> '' then LogMessage('      Get result lenght:'+ItemValue+'||');
   end else
      LogMessage('duration not found');

Function ParsePage_IMDBMovieTECHNICAL
is such a code for the "Run time" custom field.
Quote
    //Get "Runtime" info
   curPos:=Pos('<td class="label"> Runtime </td>',HTML);                                    //WEB_SPECIFIC.
   If 0<curPos Then Begin 
      ItemValue:=TextBetWeen(HTML,' (',' min)',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
        //Get the original "Runtime" (in minutes) as ~length~ instead of the duration of the user movie copy
        AddFieldValueXML('length',IntToStr(60*StrToInt(ItemValue))); //~length~ Value in seconds.
        //AddFieldValue(14,ItemValue);  //Field number 14 = Duration, value in minutes
      if ItemValue <> '' then AddCustomFieldValueByName('Run time',ItemValue);
        if ItemValue <> '' then LogMessage('      Get result lenght from Original Runtime:'+ItemValue+'||');
   End;      
    LogMessage('Function ParsePage_IMDBMovieTECHNICAL END=====================||');

For IMDB_ [EN] [HTTPS] (episodes) script

V Function ParsePage_IMDBMovieTECHNICAL is such a code for the "Run time" custom field.
Quote
    //Get "Runtime" info
   curPos:=Pos('<td class="label"> Runtime </td>',HTML);                                    //WEB_SPECIFIC.
   If 0<curPos Then Begin 
      ItemValue0:=TextBetWeen(HTML,' (',' min)',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
        //Get the original "Runtime" (in minutes) as ~length~ instead of the duration of the user movie copy
        AddFieldValueXML('length',IntToStr(60*StrToInt(ItemValue0))); //~length~ Value in seconds.
        //AddFieldValue(14,ItemValue);  //Field number 14 = Duration, value in minutes
      if ItemValue0 <> '' then AddCustomFieldValueByName('Run time',ItemValue0);
        if ItemValue0 <> '' then LogMessage('      Get result lenght from Original Runtime:'+ItemValue0+'||');
   End;   
    //Get "Runtime" info
   curPos:=Pos('<td class="label"> Runtime </td>',HTML);                                    //WEB_SPECIFIC.
   If 0<curPos Then Begin 
      ItemValue1:=TextBetWeen(HTML,'<td>',' min',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
        //Get the original "Runtime" (in minutes) as ~length~ instead of the duration of the user movie copy
        AddFieldValueXML('length',IntToStr(60*StrToInt(ItemValue1))); //~length~ Value in seconds.
        //AddFieldValue(14,ItemValue);  //Field number 14 = Duration, value in minutes
      if ItemValue1 <> '' then AddCustomFieldValueByName('Run time1',ItemValue1);      
        if ItemValue1 <> '' then LogMessage('      Get result lenght from Original Runtime0:'+ItemValue1+'||');
   End;   
    LogMessage('Function ParsePage_IMDBMovieTECHNICAL END=====================||');

Here are two pieces of code for "RUNTIME" information transfer. Both are needed. that there will always be information transfer. if the Runtime record is present in the Technical Specifications web pages.

And this one.

The "runtime" custom fields here may be named differently because I wrote them them that way because of the tests, if the information is transmitted correctly.
Therefore, each user should change the names of the custom fields that they already use now.
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: 2511
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #4 on: December 17, 2021, 08:38:12 am »
For afrocuban

However, in the IMDB_ [EN] (HTTPS) (series) script, several pieces of code need to be changed.

In Function ParsePage_IMDBMovieBASE, the following pieces of code change.
Quote




Function ParsePage_IMDBMovieBASE(HTML:String):Cardinal; //BlockOpen
    //Returns:
    //     Result:=prFinished; Script has finished gathering data
    //     Result:=prError; If żany big problem? with exit;
    //Retrieve: ~title~, ~year~, ~origtitle~, ~poster~ / ~imdbrating~, ~IMDB_Votes~ (Custom Field) / ~TOP_250~(Custom Field) /
    //          If Not(GET_FULL_CREDIT): ~crew~ctDirectors,ctWriters,ctComposers,ctProducers(Not in base page), ctActors
    //         ~description~ / ~category~ "keywords" / ~tagline~ / ~genre~
    //         If Not(GET_FULL_MPAA) ~mpaa~
    //         ~country~ / ~rdate~ in contry provider local IP geolocation
    //         If Not(GET_FULL_AKA) ~aka~.
    //         ~budget~ / ~money~ / ~studio~ "Production Co"
    //         If Not(GET_FULL_FEATURES) ~features~
  Var
      curPos,endPos,index:Integer;
     debug_pos1:Integer;
     StartPos:Integer;
     //Hours,Minutes:Integer;
      ItemValue,ItemValue0,ItemValue1,ItemValue2,ItemList,ImageFile:String;
     ItemValue00:String;
      titleValue:String;
     yearValue:String;
     seriesValue,yearsValue:String;
      Name,Role,PersonURL:String;
     ItemList2,ItemList12,day_s,month_s,year_s:String;
     //ItemList1,ItemList11:String;
      ItemArray:TWideArray;
  Begin
.
.
.
   //Go to "Tv Mode"    
   StartPos:=Pos('<h1 textlength="',HTML);
   if StartPos>0 then begin   
      ItemValue:=HTMLValue(HTML,StartPos,0,'<li role="presentation" class="ipc-inline-list__item">','releaseinfo?ref_=tt_ov_rdat');
      if ItemValue <> '' then LogMessage('      Get result Tv Mode1:'+ItemValue+'||');
      debug_pos1:=Pos('<a href="',ItemValue);
      if debug_pos1 >0 then ItemValue:=Copy(ItemValue,0,debug_pos1-1);
      //ItemValue:=StringReplace(ItemValue,'','',True,False,True);
      //ItemValue:=StringReplace(ItemValue,'</a>','',True,False,True);      
      AddCustomFieldValueByName('Tv',ItemValue);   
      if ItemValue <> '' then LogMessage('      Get result Tv Mode (CF~Tv~):'+ItemValue);
      if Pos('TV Mini Series',ItemValue)>0 then yearsValue:=yearsValue+'TV Mini Series ';
      if Pos('TV Series',ItemValue)>0 then yearsValue:=yearsValue+'TV Series ';
      if yearsValue <> '' then LogMessage('      Get result yearsValue:'+yearsValue);      

      //ItemValue1:=HTMLValue(HTML,StartPos,0,'<li role="presentation" class="ipc-inline-list__item','</ul>');
      ItemValue1:=HTMLValues(HTML,'<h1 textlength="','</ul>','"ipc-inline-list__item">','</',', ',StartPos);
      //ItemValue1:=HTMLValues2(HTML,'<h1 textlength="','</ul>','<li role="presentation" class="ipc-inline-list__item">','</li>',', ',StartPos);      
      AddCustomFieldValueByName('Tv2',ItemValue1);   
      if ItemValue1 <> '' then LogMessage('      Get result Tv Mode01:'+#13+ItemValue1+'||'+#13);      
   end else
      LogMessage('tv-metadata not found');         
   //Go to "Tv Mode" Series-year
   StartPos:=Pos('releaseinfo?ref_=tt_ov_rdat',HTML);
   if StartPos>0 then begin
      yearValue:=HTMLValue(HTML,StartPos,0,'</a>','</span></li><li role="presentation" class="ipc-inline-list__item"><a href="/title/');
      //AddCustomFieldValueByName('IMDB_year',yearValue);
      //AddCustomFieldValueByName('IMDB Year',yearValue);
      AddCustomFieldValueByName('IMDB_Series-year',yearValue);
      if yearsValue <> '' then seriesValue:=yearsValue+'('+yearValue+')' else seriesValue:='';
      AddCustomFieldValueByName('IMDB_Series-year1',seriesValue);
      if seriesValue <> '' then LogMessage('      Get result seriesValue:'+#13+seriesValue+'||'+#13);   

      if yearValue <> '' then LogMessage('      Get result Tv Mode (CF~IMDB_year~)+:'+yearValue);   
   end else
      LogMessage('tv-metadata-a not found');   
.
.
.
    //Get the original "Runtime" (in minutes) as ~length~ (in seconds) instead of the duration of the user movie copy                                        //WEB_SPECIFIC.   
    curPos:=Pos('<span class="ipc-metadata-list-item__label">Runtime</span>',HTML);                                        //WEB_SPECIFIC.
    If 0<curPos Then Begin 
        ItemValue1:=TextBetWeen(HTML,'<div class="ipc-metadata-list-item__content-container">','minutes</div></li>',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
        //ItemList:=ItemList+'Original Runtime: '+ItemValue1+' min.<br>';
        LogMessage('      Get result Original Runtime11:'+ItemValue1+'||');
      //If GET_FULL_FEATURES Then
      if ItemValue1 <> '' then
        AddFieldValueXML('length',IntToStr(60*StrToInt(ItemValue1))); //~length~ Value in seconds.
      if ItemValue1 <> '' then AddCustomFieldValueByName('Run time1',ItemValue1);
        //AddFieldValue(14,ItemValue1);  //Field number 14 = Duration, value in minutes
        if ItemValue1 <> '' then LogMessage('      Get result lenght011:'+ItemValue1+'||');
      //LogMessage('      Get result lenght012:'+HTMLValues(HTML,'<span class="ipc-metadata-list-item__label">Runtime</span>','</ul>','<li role="presentation" class="ipc-inline-list__item">','</li>',', ',endPos)+'||');      
        ItemValue00:=TextBetWeen(HTML,'<div class="ipc-metadata-list-item__content-container">','hour</div></li>',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC   
      LogMessage('      Get result Original Runtime111:'+ItemValue00+'||');      
      if ItemValue00 <> '' then
      AddFieldValueXML('length',IntToStr(3600*StrToInt(ItemValue00))); //~length~ Value in seconds.
      if ItemValue00 <> '' then AddCustomFieldValueByName('Run time1',IntToStr(60*StrToInt(ItemValue00)));
      if ItemValue00 <> '' then LogMessage('      Get result Original Runtime111:'+ItemValue00+'||');
        if ItemValue00 <> '' then LogMessage('      Get result lenght0111:'+ItemValue00+'||');      
    End;

For a possible error in the code part for the series, you can also add it yourself or report the problem and I added it.

And this one.

The "runtime" and "IMDB_Series-year" custom fields here may be named differently because I wrote them them that way because of the tests, if the information is transmitted correctly.
Therefore, each user should change the names of the custom fields that they already use now.
« Last Edit: December 17, 2021, 08:42:17 am 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

  • Older Power User
  • *****
  • Posts: 362
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #5 on: February 09, 2022, 02:59:17 am »
Thank you Ivek. I will try this!

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2511
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #6 on: February 10, 2022, 09:15:45 am »
Thank you Ivek. I will try this!

OK, we’re waiting for your news on how this works for you.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline afrocuban

  • Older Power User
  • *****
  • Posts: 362
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #7 on: February 13, 2022, 02:25:31 am »
Dear Ivek, here I am with the feedback.

Everything works perfect, and I admit I wasn't expected that, because of lot of code to change.


The only thing that doesn't work for me is Runtime for series. This piece of code doesn't import run time for me, although I renamed custom field to Run time instead of Run time1

Quote
    //Get the original "Runtime" (in minutes) as ~length~ (in seconds) instead of the duration of the user movie copy                                        //WEB_SPECIFIC.   
    curPos:=Pos('<span class="ipc-metadata-list-item__label">Runtime</span>',HTML);                                        //WEB_SPECIFIC.
    If 0<curPos Then Begin
        ItemValue1:=TextBetWeen(HTML,'<div class="ipc-metadata-list-item__content-container">','minutes</div></li>',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC
        //ItemList:=ItemList+'Original Runtime: '+ItemValue1+' min.<br>';
        LogMessage('      Get result Original Runtime11:'+ItemValue1+'||');
      //If GET_FULL_FEATURES Then
      if ItemValue1 <> '' then
        AddFieldValueXML('length',IntToStr(60*StrToInt(ItemValue1))); //~length~ Value in seconds.
      if ItemValue1 <> '' then AddCustomFieldValueByName('Run time1',ItemValue1);
        //AddFieldValue(14,ItemValue1);  //Field number 14 = Duration, value in minutes
        if ItemValue1 <> '' then LogMessage('      Get result lenght011:'+ItemValue1+'||');
      //LogMessage('      Get result lenght012:'+HTMLValues(HTML,'<span class="ipc-metadata-list-item__label">Runtime</span>','</ul>','<li role="presentation" class="ipc-inline-list__item">','</li>',', ',endPos)+'||');     
        ItemValue00:=TextBetWeen(HTML,'<div class="ipc-metadata-list-item__content-container">','hour</div></li>',false,curPos);  //Strings which opens/closes the data. WEB_SPECIFIC   
      LogMessage('      Get result Original Runtime111:'+ItemValue00+'||');     
      if ItemValue00 <> '' then
      AddFieldValueXML('length',IntToStr(3600*StrToInt(ItemValue00))); //~length~ Value in seconds.
      if ItemValue00 <> '' then AddCustomFieldValueByName('Run time1',IntToStr(60*StrToInt(ItemValue00)));
      if ItemValue00 <> '' then LogMessage('      Get result Original Runtime111:'+ItemValue00+'||');
        if ItemValue00 <> '' then LogMessage('      Get result lenght0111:'+ItemValue00+'||');     
    End;

But, I can live without that and I am immensely grateful to you
« Last Edit: February 13, 2022, 02:27:36 am by afrocuban »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2511
    • View Profile
Re: IMDb [EN][HTTPS](series) issues and support
« Reply #8 on: February 13, 2022, 08:23:37 am »
Welcome.

When I have the option of free time, I'll check why this does not work properly.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD