Page 1 of 1

[REQ] Fetch IMDb Plot Keywords

Posted: 2017-10-01 22:03:47
by tiagoaquino
Would be great to fetch movies plot keywords from IMDb. In this example: http://www.imdb.com/title/tt0211915/keywords

There are 145 plot Keywords that would make browsing for a movie more accurate.

Looking into its html code, it's a matter of finding 'data-item-keyword' term. I'd love to know how to do it. In fact I could try for a while but having it made by someone who already know how to do it (and updating IMDb script for everyone) would be better.

In general it could be stored in Description field. I would change it here manually to write it in a custom field.

Posted: 2017-10-02 03:38:54
by tiagoaquino
I ended up doing it:

Code: Select all

  // Keywords
  begin
    sleep(50);
    Value := MovieUrl;
    FullValue := ConvertToASCII(GetPage(Value+'/keywords'));
    Value := TextBetween(FullValue, 'soda sodavote','</table>');
    FullValue := '';
    Value2 := StringReplace(TextBetween(Value, 'data-item-keyword="','">'),'-',' ');
    while Value2 <> '' do
    begin
      Value := RemainingText;
      if FullValue <> '' then
        FullValue := FullValue + ', ';
      FullValue := FullValue + Value2;
      Value2 := StringReplace(TextBetween(Value, 'data-item-keyword="','">'),'-',' ');
    end;
    HTMLDecode(FullValue);
    SetCustomField('Keywords', FullValue);
  end;
  // Trivia
However, that code saves into a must-create-CustomField named Keywords[/code]