How to get only the first description?
Posted: 2003-02-26 00:15:45
Hi, I've been trying to modify the imdb to make it get automatically the first description for the movie instead of giving the option to choose since I always pick that one.
I saw a script by joanzito in which he make it to select the last one by adding one line (PickListClear) on the procedure GetDescriptions:
Is there a way to do it the other way round? picking the first description instead?
Thanks in advance,
Mguel
I saw a script by joanzito in which he make it to select the last one by adding one line (PickListClear) on the procedure GetDescriptions:
Code: Select all
procedure GetDescriptions(Address: string);
var
Line, Value: string;
LineNr: Integer;
BeginPos, EndPos: Integer;
Page: TStringList;
begin
Page := TStringList.Create;
Page.Text := GetPage('http://us.imdb.com' + Address);
LineNr := FindLine('<p class="plotpar">', Page, 0);
while LineNr > -1 do
begin
Value := '';
repeat
Line := Page.GetString(LineNr);
BeginPos := pos('"plotpar">', Line);
if BeginPos > 0 then
BeginPos := BeginPos + 10
else
BeginPos := 1;
EndPos := pos('</p>', Line);
if EndPos < 1 then
EndPos := Length(Line) + 1;
if Value <> '' then
Value := Value + ' ';
Value := Value + copy(Line, BeginPos, EndPos - BeginPos);
LineNr := LineNr + 1;
until (pos('</p>', Line) > 0) or (LineNr = Page.Count);
HTMLDecode(Value);
PickListClear; //(joazito) I'm only interested in 1 description... this will clear all but the last
PickListAdd(Value);
LineNr := FindLine('<p class="plotpar">', Page, LineNr);
end;
Page.Free;
end;
Thanks in advance,
Mguel