I have a question:
How this code
function RemoveTagsEx(AText : String) : String;
var
B, E : Integer;
begin
Result := AText;
B := PosFrom('<', Result, 1);
E := PosFrom('>', Result, B);
while (B > 0) AND (B < E) do begin
Delete(Result, B, E - B + 1);
B := Pos('<', Result);
E := Pos('>', Result);
end;
end;
procedure ParseBiography(HTML : String);
var
curPos, endPos : Integer;
TmpStr, TmpStr1, TmpStr2 : String;
begin
curPos := Pos('<div id="results-table">', HTML);
endPos := curPos
if curPos < 1 then
Exit;
//Biography
curPos := PosFrom('<td colspan="2">', HTML, curPos);
endPos := PosFrom('</p></td>', HTML, curPos);
TmpStr := Copy(HTML, curPos, EndPos - curPos);
TmpStr1 := StringReplace(TmpStr, ' -- ', '—', True, True, False);
TmpStr2 := StringReplace(TmpStr1, ' --- ', '—', True, True, False);
TmpStr := StringReplace(TmpStr2, '--', '—', True, True, False);
TmpStr1 := StringReplace(TmpStr, #13#13#13#13, #13#10#13#10, True, True, False);
TmpStr2 := RemoveTagsEx(TmpStr1);
AddFieldValue(pfBio, TmpStr2);
end;
and this code
procedure ParseFilmography(HTML : String);
var
curPos, EndPos : Integer;
TmpStr : String;
Name, Role, URL : String;
begin
curPos := Pos('<div id="results-table">', HTML);
if curPos < 1 then
Exit;
LogMessage('Pasrsing filmography...');
TmpStr := '';
EndPos := curPos;
curPos := PosFrom('http://www.allmovie.com/work/', HTML, curPos);
while (curPos > 0) AND (curPos < PosFrom('</table>', HTML, EndPos)) do begin
EndPos := PosFrom('">', HTML, curPos);
URL := Copy(HTML, curPos, EndPos - curPos);
curPos := EndPos + 2;
EndPos := PosFrom('</a>', HTML, curPos);
Name := Copy(HTML, curPos, EndPos - curPos);
curPos := PosFrom('<td>', HTML, EndPos);
if curPos > 0 then begin
curPos := curPos + 4;
EndPos := PosFrom('</td>', HTML, curPos);
Role := Trim(Copy(HTML, curPos, EndPos - curPos));
end else begin
Role := '';
curPos := EndPos;
end;
AddMoviePerson(Name, '', Role, URL, ctActors);
if TmpStr <> '' then
TmpStr := TmpStr + #13;
if URL <> '' then
TmpStr := TmpStr + '<link url="' + URL + '">';
TmpStr := TmpStr + Name ;
if Role <> '' then
TmpStr := TmpStr + ' - ' + Role;
if URL <> '' then
TmpStr := TmpStr + '</link>';
if curPos > 0 then
curPos := PosFrom('http://www.allmovie.com/work/', HTML, curPos)
else
Exit;
end;
AddFieldValue(pfFilmography, TmpStr);
end;
combine the information in the field pfBio (Biography).
Thanks for the help.