procedure ParseCast(HTML : String);
var
curPos, endPos : Integer;
TmpStr : String;
Name, Role, URL : String;
begin
curPos := Pos('<div class="tabset-content main-tab-pane">', HTML);
if curPos < 1 then
curPos := Pos('<div class="description-box">', HTML);
if curPos < 1 then
Exit;
TmpStr := '';
endPos := curPos;
curPos := PosFrom('http://www.allrovi.com/name/', 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('>', HTML, endPos);
if curPos > 0 then begin
curPos := curPos + 2;
endPos := PosFrom('</td', HTML, curPos);
Role := Copy(Trim(Copy(HTML, curPos + 4, endPos - curPos - 4)), 5, endPos - curPos - 4);
end else begin
Role := '';
curPos := endPos;
end;
if GET_ACTORS then
AddMoviePerson(Name, '', '', 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.allrovi.com/name/', HTML, curPos)
else
Exit;
end;
AddCustomFieldValueByName('Cast', TmpStr);
Perhaps you will keep this code something to help, how to integrate TmpStr and then how to continue, is copy that URL, that you want to copy in the database.