Thanks,
i'll see that later becaause i live in the middle of nowhere and the connection is very very slow during the day!
For "role" in egafd movie :
// -------------- Procedure ParseMovie --------------//
// - after searchlist selection this function is called with the new html content
procedure ParseMovie(MovieURL : String; HTML : String);
var
curPos, EndPos, P, P2, L: Integer;
actPosStart,actPosStart2,
actPosEnd, UrlPosStart,UrlPosEnd,debug_pos1:Integer;
Tmp, URL, Name,dbgstrg,tmpstrg, Role : String;
ActorNames: TWideArray;
ActorNumber,I,J: Integer;
/////
begin
AddFieldValue(mfURL, MovieURL);
LogMessage('Page parsing started');
EndPos := 1;
//Check for title. No orig. title info present, so duplicate..
dbgstrg:= TextBetween(HTML, '<title>', '</title>', False, EndPos);
LogMessage('Title: ' + dbgstrg);
If dbgstrg <> '' then begin
AddFieldValue(mfOrigTitle,dbgstrg);
AddFieldValue(mfTitle,dbgstrg);
end;
//Year
dbgstrg := '';
CurPos := Pos('Released: ', HTML);
endpos := CurPos;
LogMessage('getting year');
dbgstrg := TextBetween(HTML, '">', '</td>', False, CurPos);
LogMessage('YEAR:' + dbgstrg);
If dbgstrg <> '' then
AddFieldValue(mfYear,dbgstrg);
//Director
dbgstrg := '';
curPos := Pos('Director: ', HTML);
EndPos := curPos;
LogMessage('getting Director');
dbgstrg:= TextBetween(HTML, '">', '</td>', False, CurPos);
LogMessage('DIRECTOR:' + dbgstrg);
If dbgstrg <> '' then
AddMoviePerson(dbgstrg, '', '', '', ctDirectors);
//Notes
dbgstrg := '';
curpos := Pos('Notes: ' , HTML);
EndPos := curPos;
LogMessage('Notes')
dbgstrg := TextBetween(HTML, '">', '</td>', False, CurPos);
LogMessage('Notes :' + dbgstrg);
If dbgstrg <> '' then
AddFieldValue(mfDescription, dbgstrg);
//AKA - Titles...
dbgstrg := '';
LogMessage('getting all titles')
Curpos := Pos('<th>Alternate Titles</th>' ,HTML);
EndPos := curPos;
////
while (curPos > 0) AND (curPos < PosFrom('<th>Actresses</th>', HTML, EndPos)) do begin
EndPos := curPos;
actPosStart := PosFrom('class="flma"', HTML, EndPos);
actPosEnd := PosFrom('</span>', HTML, actPosStart);
dbgstrg := Trim(Copy(HTML, (actPosstart + 13), (actPosEnd - actPosStart - 13) ));
LogMessage('AKA: ' + dbgstrg);
If dbgstrg <> '' then
AddFieldValue(mfAka, dbgstrg);
curpos := PosFrom('class="flma"', HTML, actPosEnd);
////
end;
//Cast
curPos:= Pos('<th>Actresses</th>', HTML);
LogMessage('Cast readout');
/////
if curPos > 0 then begin
EndPos := curPos;
///
while (curPos > 0) AND (curPos < PosFrom('<th>Notes</th>', HTML, EndPos)) do begin
EndPos := curPos;
// get url
UrlPosStart := PosFrom('href="', HTML, EndPos);
UrlPosEnd := PosFrom('">', HTML, UrlPosStart);
URL := BASE_URL + Trim(Copy(HTML, UrlPosStart + 6, (UrlPosEnd - UrlPosStart - 7) ));
LogMessage(URL);
// Get Name
//actPosStart := PosFrom('href="', HTML, EndPos); // search for url start;
//actPosStart2 := PosFrom('">', HTML, actPosStart)
//actPosEnd:=PosFrom('</a>', HTML, actPosStart2); // search for url end
//Name := Trim(Copy(HTML, (actPosStart2 + 2), (actPosEnd - actPosStart2 - 2) ));
//LogMessage(Name);
{Name := TextBetween(HTML, '">', '</a>', false, urlpostart);}
// Get Name
actposstart := urlposend + 2;
actposend := Posfrom('</a>', HTML, actposstart);
Name := Trim(Copy(HTML, actposstart, (actposend-actposstart)));
Logmessage('Name: ' + Name);
debug_pos1:=Pos('(',Name);
if debug_pos1 >0 then
Name := Copy(Name,0,debug_pos1-1);
LogMessage('Name:' + Name);
// Role
Role := '';
actposStart := actposend;
If (copy(HTML, actposstart + 4, 1)) <> '<' then begin
actposStart := actposstart -6;
Role := TextBetween(HTML, '<i>', '</i>', false, actposstart);
end;
debug_pos1:=Pos('(',Role);
if debug_pos1 >0 then
Role := Copy(Role,0,debug_pos1-1);
LogMessage('Role:'+ Role);
If URL <> '' then
If Name <> '' then
AddMoviePerson(Trim(Name), '', Role, LowerCase(URL), ctActors);
curPos := PosFrom('href="', HTML, actPosEnd);
///
end;
/////
end;
/////
end;
It seems to be OK!