As the latest imdb script changed quite a lot, I haven't been able to make it work, I have tested lot's of combinations trying to use repeat - until and so, but I haven't find a solution (I'm not a programmer)
This is what I have till now, that makes import the complete actor list comma separated (Using the part of the code for: 0=Only actor names, separated by commas). But need to limit this to only the first five actors...
Code: Select all
  if CanSetField(fieldActors) then
  begin
    Value := TextBetween(PageText, 'ast overview', '</div>');
    if Value = '' then
      Value := TextBetween(PageText, 'redited cast', '</div>');
    if Value <> '' then
    begin
      Value := TextAfter(Value, '</tr> ');
      FullValue := '';
          while Pos('<tr>', Value) > 0 do
          begin
            Value2 := TextBetween(Value, '<tr>', '</tr>');
            Value := RemainingText;
            if Pos('<a href="fullcredits">(more)</a>', Value2) > 0 then
              Break;
            if FullValue <> '' then
              FullValue := FullValue + ', ';
            FullValue := FullValue + TextBefore(Value2, '</td>', '');
          end;
      end;
      HTMLRemoveTags(FullValue);
      HTMLDecode(FullValue);
      SetField(fieldProducer, FullValue);
  end;I used to use this code for that (with old script):
Code: Select all
 // Actors (short list) 
 LineNr := FindLine('ast overview', Page, 0);
 if LineNr = -1 then
  LineNr := FindLine('redited cast', Page, 0);
 if LineNr > -1 then
 begin
  FullValue := '';
  Line := Page.GetString(LineNr);
  nActors := 0;
  repeat
   BeginPos := Pos('<td valign="top">', Line);
   if BeginPos > 0 then
   begin
    Delete(Line, 1, BeginPos);
    Line := copy(Line, 25, Length(Line));
    BeginPos := pos('">', Line) + 2;
    EndPos := pos('</a>', Line);
    if EndPos = 0 then
     EndPos := Pos('</td>', Line);
    Value := copy(Line, BeginPos, EndPos - BeginPos);
    if (Value <> '(more)') and (Value <> '') then
    begin
     if FullValue <> '' then
      FullValue := FullValue + ', ';
     FullValue := FullValue + Value;
     nActors := nActors + 1;
    end;
    EndPos := Pos('</td></tr>', Line);
    Delete(Line, 1, EndPos);
   end else
   begin
    Line := '';
   end;
  until (Line = '') or (nActors >= 5);
  HTMLDecode(FullValue);
  SetField(fieldProducer, FullValue);
 end;Mguel