(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=Antoine Potten Title=MovieMeter.nl Description=MovieMeter.nl import script Site=www.moviemeter.nl Language=NL Version=2.7.5 Requires=3.5.0 Comments=Fixed by tsjarlie / Miss_Kitty (v 2.7.3)|Fixed by Kaas (v 2.7.1)|Updated/Fixed by bad4u (v 2.7)|Previous version made by JanC and corrections by rolandb5@hotmail.com, rewritten by Antoine Potten after a site change (v 2.0) License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | GetInfo=1 [Options] AllCountries=0|0|0=Take only first country|1=Take all countries (separated by "/") ImportComments=0|0|0=Do not import users' comments|1=Import users' comments ***************************************************) program MovieMeter; uses StringUtils1; var MovieName: string; procedure AnalyzeMoviePage(Address: string); var PageText, Line, Value: string; begin PageText := GetPage(Address); // URL SetField(fieldURL, Address); // title & year Line := TextBetween(PageText, '

', '

'); Value := TextBetween(Line, '(', ')'); SetField(fieldYear, Value); Value := Trim(TextBefore(Line, '(', '')); HTMLDecode(Value); SetField(fieldOriginalTitle, Value); // translated title Line := TextBetween(PageText, 'Alternatieve titel', ' 

'); if Line <> '' then begin Line := TextAfter(Line, ': '); if Line <> '' then begin HTMLDecode(Line); SetField(fieldTranslatedTitle, Line); end; end; Value := TextBetween(PageText, '
'); Line := RemainingText; Value := TextAfter(Value, '
'); // Country if (GetOption('AllCountries') = 0) and (Pos(' / ', Value) > 0) then Value := TextBefore(Value, ' / ', ''); HTMLDecode(Value); SetField(fieldCountry, Value); // Category Value := TextBefore(Line, '
', ''); Line := RemainingText; HTMLDecode(Value); SetField(fieldCategory, Value); // Length Value := TextBefore(Line, ' minuten', ''); Line := RemainingText; HTMLDecode(Value); SetField(fieldLength, Value); // Director Value := TextBetween(Line, 'geregisseerd door ', '
'); Line := RemainingText; HTMLRemoveTags(Value); HTMLDecode(Value); SetField(fieldDirector, Value); // Actors Value := TextBetween(Line, 'met ', '
'); Line := RemainingText; HTMLDecode(Value); SetField(fieldActors, Value); // Description Value := TextBetween(Line, '
', ''); HTMLRemoveTags(Value); HTMLDecode(Value); SetField(fieldDescription, Value); // Picture Value := TextBetween(PageText, ' '' then begin GetPicture(Value); end; // Rating Value := TextBetween(PageText, 'gemiddelde ', '<'); Value := StringReplace(FloatToStr(StrToFloat(StringReplace(Value, ',', '.')) * 2), ',', '.'); SetField(fieldRating, Value); // Comments if GetOption('ImportComments') = 1 then begin Value := TextBetween(PageText, '
', '
'); Value := StringReplace(Value, ' uur', ' uur : ' + #13#10); // Value := StringReplace(Value, '
', #13#10); Value := StringReplace(Value, '
0 then begin PickTreeClear; PickTreeAdd('Zoekresultaten voor ' + MovieName, ''); // get results page Page.Text := GetPage('http://www.moviemeter.nl/film/searchresults#results'); if Pos('Populaire zoekresultaten in films:', Page.Text) > 0 then Line := TextBetween(Page.Text, 'Populaire zoekresultaten in films:

', '
0 then Line := TextBetween(Page.Text, 'Alle zoekresultaten in films:

', ' 0 then Line := TextBetween(Page.Text, 'Zoekresultaten in films:

', '
', '


'); while Pos('filmresults_row', Line) > 0 do begin MovieAddress := TextBetween(Line, 'href="', '" >'); MovieTitle := TextBefore(Line, '

', ''); Line := RemainingText; HTMLRemoveTags(MovieTitle); HTMLDecode(MovieTitle); PickTreeAdd(Trim(MovieTitle), MovieAddress); aantal := aantal + 1; end; if aantal = 0 then begin ShowMessage('Geen resultaten gevonden...'); Page.Free; exit; end; // if user picks a movie from the results list, import movie details if PickTreeExec(Address) then AnalyzeMoviePage(Address); end else begin MovieAddress := TextBetween(Line, '("', '");'); if MovieAddress <> 'http://www.moviemeter.nl/film/' then // if only 1 movie found --> redirect to movie page AnalyzeMoviePage(MovieAddress) else // no movies found ShowMessage('Geen zoekresultaat voor "'+MovieName+'".'); end; Page.Free; end; begin if CheckVersion(3,5,0) then begin if StringUtils1_Version >= 2 then begin MovieName := GetField(fieldOriginalTitle); if MovieName = '' then MovieName := GetField(fieldTranslatedTitle); if Input('MovieMeter.nl Import', 'Geef de titel van de film:', MovieName) then begin AnalyzeResultsPage('http://www.moviemeter.nl/film/search/'+UrlEncode(MovieName)); end; end else ShowMessage('The file "StringUtils1.pas" is outdated, please find a new version of it (at least version 2)'); end else ShowMessage('Dit script vereist een nieuwere versie van Ant Movie Catalog (minstens versie 3.5.0)'); exit; end.