IMDB - Goofs

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
spikeus7
Posts: 4
Joined: 2013-08-07 15:46:32

IMDB - Goofs

Post by spikeus7 »

Is there any chance to add 'GOOFS' in the comment box, after Trivia? :??:
fagnerpc
Posts: 40
Joined: 2015-04-23 05:07:08

Post by fagnerpc »

Add the following code between // Trivia and // Awards on the IMDB's script:

Code: Select all

 // Goofs
  if GetOption('Trivia') > 0 then
  begin
    sleep(50);
    Value := MovieUrl;
    FullValue := ConvertToASCII(GetPage(Value+'/goofs'));
    case GetOption('Trivia') of
      1,2:
        Value := TextBetween(FullValue, '<div class="sodatext">', '</div>');
      3,4:
        Value := TextBetween(FullValue, '<div class="list">', '<div class="article" id="see_also">');
    end;
    if Value <> '' then
    begin
      Value := StringReplace(Value, #13#10, '');
      while Pos('  ', Value) > 0 do
        Value := StringReplace(Value, '  ', '');
      while Pos('<span class="linksoda">', Value) > 0 do
      begin
        Value := StringReplace(Value, TextBetween(Value, '<span class="linksoda">', '</div>'), '');
        Value := StringReplace(Value, '<span class="linksoda"></div>', '');
      end;
      Value := StringReplace(Value, 'See also Trivia', '');
      Value := StringReplace(Value, '<div class="sodatext">', #13#10 + '- ');
      Value := StringReplace(Value, '<h4 class="li_group">', #13#10);
      Value := StringReplace(Value, TextBetween(Value, '<div class="did-you-know-actions">', '</div>'), '');
      HTMLRemoveTags(Value);
      HTMLDecode(Value);
      Value := RegExprSetReplace('\s[\d,]+\s+of\s+[\d,]+\sfound\sthis\sinterestingInteresting\?YesNo\|', Value, '', false);
      Value := RegExprSetReplace('\s*Is\sthis\sinteresting\?Interesting\?YesNo\|', Value, '', false);
      Value := RegExprSetReplace('Spoilers\sThe\strivia\sitems?\sbelow\smay\sgive\saway\simportant\splot\spoints\.\s*', Value, #13#10 + 'Spoilers:' + #13#10, false);
      Value := RegExprSetReplace('\s*See\salsoGoofs.*', Value, '', false);     

      if (GetOption('Trivia') = 1) or (GetOption('Trivia') = 2) then
        Value := ' ' + Value;

      case GetOption('Trivia') of
        1,3:
          begin
            if GetField(fieldDescription) <> '' then
              Value := GetField(fieldDescription) + #13#10 + #13#10 + 'IMDB GOOFS:' + Trim(Value)
            else
              Value :=  'IMDB GOOFS: ' + Value;
            SetField(fieldDescription, Value);
          end;
        2,4:
          begin
            if GetField(fieldComments) <> '' then
              Value := GetField(fieldComments) + #13#10 + #13#10 + 'IMDB GOOFS:' + Trim(Value)
            else
              Value :=  'IMDB GOOFS: ' + Value;
            SetField(fieldComments, Value);
          end;
      end;
    end;
  end; 
Will import the 'Goofs' under the same format as 'Trivia' :grinking:
Post Reply