',HTML,curPos);
Result := HTMLToText(Trim(Copy(HTML,curPos,(EndPos-curPos))));
end
else
Result := '';
LogMessage(StartString + ':' + Result);
end;
function pTab (strBefore:String; ValueTab:String; strAfter:string; ifPrt:Integer; nbSpace:Integer; TypS:string) : String;
//Manage displaying of a data
Var
x : integer;
strSpace : string;
Begin
strSpace := '';
If TypS = '' then TypS := ' ';
If nbSpace > 0 then begin
For x := 1 to nbSpace do
strSpace := strSpace + TypS;
end;
If ValueTab <> '' then result:= strBefore+ValueTab+strAfter;
If ValueTab = '' then
begin
Case ifPrt of
1 : Result:= strBefore+strSpace+strAfter;
2 : Result:= strBefore+strSpace;
3 : Result:= strSpace+strAfter;
4 : Result:= '';
5 : Result := strSpace;
end;
end;
end;
function ftLine(enTete : String; TxtSep : String; TabTxtLine : TwideArray) : String;
//Manage displaying of a line:
// enTete : Fisrt string put at start of a line : ex: entete Data1 Data2 ....
// TxtSep : String repeat between each data (if TxtSep = '/' give Data1/Data2 etc...
// Value of the different data of the line put in a tab (ex: [height,weight]
Var
i, LastVal : integer;
strLine : string;
ifExist : Boolean;
Begin
strLine := '';
ifExist := False;
For i:= 1 to High(TabtxtLine) do begin
If TabtxtLine[i] <> '' then begin
ifExist := True;
LastVal := i;
end;
end;
For i:= 0 to High(TabtxtLine) do begin
If TabtxtLine[i] <> '' then begin
If LastVal <> i then begin
If ifExist = True then begin
strLine := strLine + TabtxtLine[i] + TxtSep;
end else begin
strLine := strLine + TabtxtLine[i];
end;
end else begin
strLine := strLine + TabtxtLine[i];
end;
end;
end;
If strLine <> '' then begin
Result := enTete + strLine + #13#10;
end else begin
Result := '';
end;
End;
function Format_Num (numMax: Integer; ActualNum:Integer) : String;
Var
lmax, lnow : integer;
strValue : String;
Begin
lmax := length(inttostr(numMax));
lnow := length(inttostr(ActualNum));
strValue := inttostr(ActualNum);
while lnow < lmax do begin
strValue := '0'+strValue;
lnow := lnow+1;
end;
Result := strValue;
End;
//---------------------- Parse Photo -----------------
procedure ParsePhoto(PhotoURL : String);
begin
LogMessage('PARSING PHOTO...' + PhotoURL);
PhotoURL:=HTMLToText (PhotoURL);
AddImageURL(4,PhotoURL);
end;
//////////////////PARSE PEOPLE////////////////////////
procedure ParsePeople(MovieURL : String; HTML : String);
var
curPos, EndPos, AkaPos, EndAkaPos, I, nbMov, J: Integer; //////Ajout AkaPos and EndAkaPos
Nome, Nomealt,Nomealt0,Nomealt1,Nomealt2,Nomealt3,Nomealt4,
Datanascita1, Datanascita, Giorno, Mese, Anno, NumM, nbMovStr: String;
details,fullinfo : String;
URL, Name, Distrib, Year, Notes, Titles: String;
debug_pos1 : Integer;
begin
AddFieldValue(pfURL,MovieURL);
LogMessage('PARSING PEOPLE...');
fullinfo:= '';
tabI[24] := 'Biographical data courtesy of the IAFD'+ #13#10 + ' ~~ Internet Adult Film Database ~~ ' + #13#10 + #13#10;
curpos := 0;
// Ajout genre IAFD
if GET_GENRE then AddFieldValue(pfGenre,'IAFD');
//Nom :
curPos := Pos('
',HTML);
EndPos := PosFrom('
',HTML,curPos);
Nome := Trim(Copy(HTML,curPos+4,EndPos-curPos-4));
tabI [1] := Nome;
AddFieldValue(pfName, Nome );
LogMessage('Name: '+Nome);
//Nome alternativo
curPos := Pos('AKA
0 then begin
Nomealt4 := TextBetween(HTML, '"biodata">', '
', True, curPos);
if Nomealt4 <> '' then begin
Nomealt4:= StringReplace(Nomealt4,'No data','No known aliases',true,true,true);
AddFieldValue(pfAltNames, StringReplace(Nomealt4,'No known aliases','',true,true,true) );
LogMessage('Nome alternativo:' + Nomealt4);
/////////////////////////////////////////////////////////////////////////////////////////////////
ExplodeString(Nomealt4, TabAKA, ',');
If High(TabAKA) > 1 then begin
Nomealt4 := '';
For i := 0 to High(TabAKA) do begin
AkaPos := Pos('(', TabAKA[i])+1;
If AkaPos <> 1 then begin
EndAkaPos := PosFrom(')', TabAKA[i], AkaPos);
TabAKA[i] := Copy(TabAKA[i],0,AkaPos-1) + ''+Copy(TabAKA[i],AkaPos,EndAkaPos-AkaPos)+')';
end;
Case i of
0 : NomeAlt4 := TabAka[i];
else begin
NomeAlt4 := NomeAlt4 + ', ' + TabAka[i];
end;
end;
end;
end;
Logmessage('AAAA AKA: ' + Nomealt4);
////////////////////////////////////////////////////////////////////////////////////////////////
tabI [2] := Nomealt4;
end;
end;
/////// A VERIFIER NOM DIRECTOR
//Nome alternativo Director
curPos := Pos('Director AKA', HTML);
if curPos>0 then begin
//curPos := PosFrom('
',HTML,curPos)+17;
//EndPos := PosFrom('
',HTML,curPos);
//Nomealt4 := RemoveTags(Trim(Copy(HTML,curPos,EndPos-curPos-4)), false);
Nomealt4 := Trim(TextBetween(HTML, '"biodata">', '', True, curPos));
Nomealt4:= StringReplace(Nomealt4,'No data','No known aliases',true,true,true);
AddFieldValue(pfAltNames, StringReplace(Nomealt4,'No known aliases','',true,true,true) );
LogMessage('Nome alternativo:' + Nomealt4);
end;
//Nome alternativo Director
curPos := Pos('Director AKA', HTML);
if curPos>0 then begin
//curPos := PosFrom('
',HTML,curPos)+17;
//EndPos := PosFrom('
',HTML,curPos);
//Nomealt := Trim(Copy(HTML,curPos,EndPos-curPos-4));
//Nomealt4 := Trim(Copy(HTML,curPos,EndPos-curPos-4));
Nomealt4 := Trim(TextBetween(HTML, '"biodata">', '', True, curPos));
Nomealt4:= StringReplace(Nomealt4,'No data','No known aliases',true,true,true);
AddFieldValue(pfAltNames, StringReplace(Nomealt4,'No known aliases','',true,true,true) ); //aggiungi il nome alternativo
LogMessage('Nome alternativo:' + Nomealt4);
end;
if Nomealt <> '' then begin
LogMessage('Nome alternativo:' + Nomealt);
Nomealt := StringReplace(Nomealt, '', +'">', true, false, true);
Nomealt := StringReplace(Nomealt, '', '', true, false, true);
LogMessage('Nome alternativo:' + Nomealt);
Nomealt:= StringReplace(Nomealt,'No known aliases','',true,true,true);
end;
//Birthday
curPos := PosFrom ('
',HTML,curPos);
curPos := PrevPos('">',HTML,endPos)+2;
NomeAlt := Trim(copy(HTML,curPos,endPos-curPos));
end;
if (Length(Nomealt) < 20) AND (NomeAlt <> 'No data')then begin
LogMessage('Astrology: '+Nomealt);
tabI [8]:= NomeAlt;
end;
end;
//Lieu de naissance
//CurPos := PosFrom('Astrology', HTML, endPos);
//Nomealt := (GetIAFDValue(HTML,'Birthplace'));
CurPos := PosFrom('>Birthplace', HTML, EndPos);
NomeAlt := TextBetween(HTML,'">','',true,CurPos);
if Nomealt <> '' then begin
AddFieldValue(pfBirthplace, StringReplace(Nomealt,'No data','',true,true,true)); //Aggiungi il paese di nascita
LogMessage('Birtplace found: ' + Nomealt);
Nomealt:= StringReplace(Nomealt,'No data','-',true,true,true);
tabI [9] := NomeAlt;
end
else
LogMessage('Paese di nascita: NESSUNO');
//Date of death
curPos := PosFrom ('>Date of Death',HTML,curPos)+18;
if curPos > 0 then
begin
LogMessage('Date of death: start...');
curPos := PosFrom('">',HTML,curPos)+2;
EndPos := PosFrom(' ',HTML,curPos+1);
Mese := Trim(Copy(HTML,curPos,EndPos-curPos));// Month
tabI[26] := Mese;
LogMessage(Mese);
curPos := EndPos;
EndPos := PosFrom(',',HTML,curPos);
Giorno := Copy(HTML,curPos+1,EndPos-curPos-1);//Copia mese
tabI[27] := Giorno
LogMessage(Giorno);
curPos := EndPos;
EndPos := PosFrom(' ',HTML,curPos);
Anno := Copy(HTML,curPos+2,4);//Copia anno
tabI[25] := Anno;
LogMessage(Anno);
Mese := StringReplace(Mese,'January','1',true,true,true);
Mese := StringReplace(Mese,'February','2',true,true,true);
Mese := StringReplace(Mese,'March','3',true,true,true);
Mese := StringReplace(Mese,'April','4',true,true,true);
Mese := StringReplace(Mese,'May','5',true,true,true);
Mese := StringReplace(Mese,'June','6',true,true,true);
Mese := StringReplace(Mese,'July','7',true,true,true);
Mese := StringReplace(Mese,'August','8',true,true,true);
Mese := StringReplace(Mese,'Septembre','9',true,true,true);
Mese := StringReplace(Mese,'September','9',true,true,true);
Mese := StringReplace(Mese,'October','10',true,true,true);
Mese := StringReplace(Mese,'November','11',true,true,true);
Mese := StringReplace(Mese,'December','12',true,true,true);
Giorno:= StringReplace(Giorno,'01','1',true,true,true);
Giorno:= StringReplace(Giorno,'02','2',true,true,true);
Giorno:= StringReplace(Giorno,'03','3',true,true,true);
Giorno:= StringReplace(Giorno,'04','4',true,true,true);
Giorno:= StringReplace(Giorno,'05','5',true,true,true);
Giorno:= StringReplace(Giorno,'06','6',true,true,true);
Giorno:= StringReplace(Giorno,'07','7',true,true,true);
Giorno:= StringReplace(Giorno,'08','8',true,true,true);
Giorno:= StringReplace(Giorno,'09','9',true,true,true);
Datanascita:=(Giorno+'.'+Mese+'.'+Anno);
LogMessage('Day of death: '+Datanascita);
AddFieldValue(pfDeathDate, Datanascita);//aggiungi la data di nascita
(*
//details
curPos := PosFrom('Date of Death',HTML,curPos);
curPos := PosFrom('(', +'">', true, false, true);
details := StringReplace(details, '', '', true, false, true);
LogMessage(details);
tabI [10] := Datanascita1;
tabI [11] := details;
*)
end
else
LogMessage('Day of death: none');
//Years active (copy from nome)
// Years Active
2005-2010 (Started around 22 years old)
curPos := Pos('>Years Active', HTML);
if curPos>0 then begin
NomeAlt := Trim(TextBetween(HTML,'">','',true,curPos));
if Nomealt <> '' then begin
LogMessage('Years active as Performer:' + Nomealt);
tabI[12] := NomeAlt;
end;
end;
curPos := Pos('>Years Active as Performer ', HTML);
if curPos>0 then begin
NomeAlt := Trim(TextBetween(HTML,'">','',true,curPos));
if Nomealt <> '' then begin
LogMessage('Years active as Performer:' + Nomealt);
tabI[12] := NomeAlt;
end;
end;
curPos := Pos('>Years Active as Director', HTML);
if curPos>0 then begin
NomeAlt := Trim(TextBetween(HTML,'">','',true,curPos));
if Nomealt <> '' then begin
LogMessage('Years active as Performer:' + Nomealt);
tabI[13] := NomeAlt;
end;
end;
(*
//Years active (copy from nome)
curPos := Pos('
Year Active as Performer
', HTML);
if curPos>0 then begin
curPos := PosFrom('
', HTML,curPos)+4;
EndPos := PosFrom('
',HTML,curPos);
Nomealt1 := Trim(Copy(HTML,curPos,(EndPos-curPos)));
end;
//Years active (copy from nome)
curPos := Pos('
Year Active as Performer
', HTML);
if curPos>0 then begin
curPos := PosFrom('
', HTML,curPos)+4;
EndPos := PosFrom(')
',HTML,curPos)+1;
Nomealt2 := Trim(Copy(HTML,curPos,(EndPos-curPos)));
Nomealt2 := StringReplace(Nomealt2,')', ' )',true,true,true);
Nomealt2 := StringReplace(Nomealt2,' (', ' ( ',true,true,true);
end;
//Years active (copy from nome)
curPos := Pos('Years Active
', HTML);
if curPos>0 then begin
curPos := PosFrom('
', HTML,curPos)+4;
EndPos := PosFrom('
',HTML,curPos);
Nomealt := Trim(Copy(HTML,curPos,(EndPos-curPos)));
Nomealt := StringReplace(Nomealt,'-',' - ',true,true,true);
Nomealt := StringReplace(Nomealt,')', ' )',true,true,true);
Nomealt := StringReplace(Nomealt,' (', ' ( ',true,true,true);
logmessage('years active 1: '+ Nomealt);
tabI[12] := NomeAlt;
end;
curPos := Pos('Years Active as Performer', HTML);
if curPos>0 then begin
curPos := PosFrom('
', HTML,curPos)+4;
EndPos := PosFrom('
',HTML,curPos);
Nomealt := Trim(Copy(HTML,curPos ,(EndPos-curPos)));
Nomealt := StringReplace(Nomealt,'-',' - ',true,true,true);
Nomealt := StringReplace(Nomealt,')', ' )',true,true,true);
Nomealt := StringReplace(Nomealt,' (', ' ( ',true,true,true);
LogMessage('Years active as Performer 2:' + Nomealt);
if tabI[12] = '' then tabI[12] := Nomealt;
end;
*)
//Years active (copy from nome)
curPos := Pos('Active as Director
', HTML);
if curPos>0 then begin
curPos := PosFrom('
', HTML,curPos)+4;
EndPos := PosFrom('
',HTML,curPos);
Nomealt := Trim(Copy(HTML,curPos ,(EndPos-curPos)));
Nomealt := StringReplace(Nomealt,'-',' - ',true,true,true);
LogMessage('Years active as Director :' + Nomealt);
tabI [13] := Nomealt;
end;
//Ethnicity (copy from nome)
//Nomealt := (GetIAFDValue(HTML,'Ethnicity'));
curPos := Pos('>Ethnicity
','
',true,curPos);
if Nomealt <> '' then begin
LogMessage('Ethnicity:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
tabI [14] := Nomealt;
end;
//Nationality/Heritage (copy from nome)
//Nomealt := (GetIAFDValue(HTML,'Nationality/Heritage'));
curPos := Pos('>Nationality',HTML);
NomeAlt := textBetween(HTML,'">','',true,curPos);
if Nomealt <> '' then begin
LogMessage('Nationality/Heritage:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
tabI [15] := Nomealt;
end;
//Hair Colors (copy from nome)
//Nomealt := (GetIAFDValue(HTML,'Hair Color'));
curPos := Pos('>Hair Color',HTML);
NomeAlt := textBetween(HTML,'">','',true,curPos);
if Nomealt <> '' then begin
LogMessage('Hair Colors:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
tabI [16] := NomeAlt;
end;
//Height (copy from nome)
//Nomealt := (GetIAFDValue(HTML,'Height'));
curPos := Pos('>Height',HTML)+13;
endPos := PosFrom('
'') AND (curPos < EndPos) then begin
LogMessage('Height:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
//if Nomealt <> '' then begin
//curPos := Pos('Height
',true,curPos);
if (Nomealt <> '') AND (curPos < EndPos) then begin
LogMessage('Weight:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
//if Nomealt <> '' then begin
//curpos := Pos('Weight
'));
curPos := Pos('>Tattoos',HTML);
NomeAlt := textBetween(HTML,'">','',true,curPos);
if Nomealt <> '' then begin
LogMessage('Tattoos:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
Nomealt := StringReplace(Nomealt, 'None', '', true,true,true);
tabI [20] := Nomealt;
end;
//Non-Ear Piercings (copy from nome)
//Nomealt := (GetIAFDValue(HTML,'Non-Ear Piercings'));
curPos := Pos('>Piercings',HTML);
NomeAlt := textBetween(HTML,'">','',true,curPos);
if Nomealt <> '' then begin
LogMessage('Non-Ear Piercings:' + Nomealt);
Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true);
Nomealt := StringReplace(Nomealt, 'None', '', true,true,true);
tabI [21] := Nomealt;
end;
(*
//Comments
curPos := Pos('There are no comments for this performer', HTML);
if curPos>0 then begin
Nomealt := 'There are no comments for this performer';
LogMessage('Comments:' + Nomealt);
end
else
begin
//Comments with content(copy from nome)
curPos := Pos('Comments
', HTML);
if curPos>0 then begin
curPos := PosFrom('"cmt">',HTML,curPos)+6;
EndPos := PosFrom('',HTML,curPos);
Nomealt := Trim(Copy(HTML,curPos ,(EndPos-curPos)));
Nomealt := StringReplace(Nomealt, '', +'">', true, false, true);
Nomealt := StringReplace(Nomealt, '', '', true, false, true);
LogMessage('Comments:' + Nomealt);
tabI [22] := Nomealt;
end;
end;
*)
(*
//Website (copy from nome)
curPos := Pos('Website
',true,curPos);
Debug_pos1 := Pos('(', Year);
If Debug_pos1 > 0 then Name := Copy(Year, 0, debug_Pos1-1);
// Get Distributeur
Curpos := PosFrom('href="', HTML, Endpos);
Curpos := PosFrom('">', HTML, Curpos) + 2;
Endpos := PosFrom('', HTML, Curpos);
Distrib := Trim(Copy(HTML, Curpos, (Endpos - Curpos)));
Debug_pos1 := Pos('(', Distrib);
If Debug_pos1 > 0 then Name := Copy(Distrib, 0, debug_Pos1-1);
// Get Notes
Notes:= textBetween(HTML,'','
',true,curPos);
If Notes = ' ' then Notes := '';
// Ajout film dans filmographie field
//AddPersonMovie(Trim(Name), '', Notes, Year, LowerCase(URL), ctActors);
//Affect Info to Tabs :
TabFilm [I]:= '' + Name + '';
TabYear [I] := Year;
TabNote [I] := Notes;
TabDist[I] := Distrib;
Curpos := Posfrom('href="/title.rme/', HTML, Curpos);
I := I + 1;
end;
//Write info :
For J := 1 to (I-1) do begin
numM := Format_Num(nbMov-1,J);
fullinfo := fullinfo+numM+pTab(' - ',TabYear[J],' ',1,4,'?')+ #2286 +pTab(' ',TabFilm[J],' ',4,0,'');
fullinfo := fullinfo+pTab(#8226+' ',TabDist[J],' ',4,0,'')+pTab(#8226+' (',TabNote[J],')',4,0,'')+#13#10;
end;
end;
end else
curPos := endPos;
end else
curPos := endPos;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DIRECTORS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Years active (copy from nome)
curPos := Pos('>Director Credits', HTML);
(*
if curPos>0 then begin
curPos := PosFrom('
', HTML,curPos)+4;
EndPos := PosFrom('
',HTML,curPos);
Nomealt := Trim(Copy(HTML,curPos ,(EndPos-curPos)));
Nomealt := StringReplace(Nomealt,'-',' - ',true,true,true);
tabI[13]:= Nomealt;
end;
*)
fullinfo := fullinfo+#13#10+pTab('Years active as Director: ',tabI[13],#13#10,4,0,'')+pTab('',tabI[28],#13#10,3,82,'-');
//Filmographie as Director in AWARDS Comments:
//curPos := PosFrom('">Director Credits', HTML, endPos);
if curPos > 0 then begin
// Nbr Movies:
//Curpos := PosFrom('">Director Credits', HTML,Endpos);
EndPos := PosFrom('',HTML,CurPos);
nbMovStr := TextBetween(HTML,'(',')',true,curpos);
logmessage('NBR MOVIE DIRECTOR STR: '+nbMovStr);
If curPos < EndPos then begin
If nbMov = 2 then fullinfo := fullinfo+'Director Credits: 1 Title' + #13#10 + #13#10;
If nbMov > 2 then fullinfo := fullinfo+'Director Credits: ' + NbMovStr + ' Titles' + #13#10 + #13#10;
SetLength (TabFilm, nbMov);
SetLength (TabDist, nbMov);
SetLength (TabYear, nbMov);
end;
curPos := Pos(HTML,'
0 then begin
I := 1;
CurPos := Posfrom('', HTML,curPos);
// Get URL
Curpos := Posfrom('href="/title.rme/', HTML, Curpos);
while (curPos > 0) AND (curPos < PosFrom('
', HTML, endPos)) do begin
Endpos := PosFrom('">', HTML, Curpos);
URL := BASE_URL + Trim(Copy(HTML, Curpos+6, Endpos- Curpos-6));
logmessage('CCC URL :'+URL);
// Get Name
curPos := endPos + 2;
endPos := PosFrom('', HTML, curPos);
Name := Trim(Copy(HTML, curPos, (endPos-curPos)));
Debug_pos1 := Pos('(', Name);
If Debug_pos1 > 0 then Name := Copy(Name, 0, debug_Pos1-1);
// Get Distributeur
Curpos := PosFrom('href="', HTML, Endpos);
Curpos := PosFrom('">', HTML, Curpos) + 2;
Endpos := PosFrom('', HTML, Curpos);
Distrib := Trim(Copy(HTML, Curpos, (Endpos - Curpos)));
Debug_pos1 := Pos('(', Distrib);
If Debug_pos1 > 0 then Name := Copy(Distrib, 0, debug_Pos1-1);
// Get Notes
Notes:= textBetween(HTML,'','',true,curPos);
If Notes = ' ' then Notes := '';
// Get Year :
Year := textBetween(HTML,'
','
',true,curPos);
Debug_pos1 := Pos('(', Year);
If Debug_pos1 > 0 then Name := Copy(Year, 0, debug_Pos1-1);
//Affectation des valeurs
TabFilm[I] := '' + Name + '';
TabYear[I] := Year;
TabDist[I] := Distrib;
I := I+1;
end;
//Write info :
For J := 1 to (I-1) do begin
numM := Format_Num(nbMov-1,J);
fullinfo := fullinfo+numM+pTab(' - ',TabYear[J],' ',1,4,'?')+ #8622 +pTab(' ',TabFilm[J],' ',4,0,'')+pTab(#8226+' ',TabDist[J],' ',4,0,'')+#13#10;
end;
end;
end;
AddFieldValueXML('comment',fullinfo);
//Foto
curPos :=Pos('id="headshot">',HTML);
if curPos >0 then begin
PhotoURL := TextBetween(HTML,'src="','">',True,curpos);
LogMessage ('URL Foto: '+PhotoURL);
ParsePhoto(PhotoURL);
end
else
begin
PhotoURL := '';
LogMessage ('URL Foto: NESSUNO');
end;
end;
//--------------- Parsing Search Results --------------------
procedure ParseSearchResults(HTML : String); //Procedura di parsing dei risultati di ricerca
var
curPos, EndPos, Counter : Integer;
Name, URL, Name1, URL1, ImageURL,gender: String;
actPosStart,actPosEnd, UrlPosStart,UrlPosEnd,debug_pos1:Integer;
strDir : String; ////////
begin
CurPos := Pos('
Directors', HTML); ////////
If Curpos > 0 then begin ////////
strDir := '
', HTML); //ricerca la posizione della stringa
if curPos < 1 then //se non esiste tale stringa
Exit; //termina
LogMessage('Parsing performers...');
//Cast
//curPos := Pos('
Females
', HTML);
LogMessage('Cast readout');
if curPos > 0 then begin
EndPos := curPos;
while (curPos > 0) AND (curPos < PosFrom('
Reviews
', HTML, EndPos)) do begin
//while (curPos > 0) AND (Counter < 50) AND (curPos < PosFrom('
Reviews
', HTML, EndPos)) do begin
//LogMessage('Intepreting site');
//Counter := Counter +1;
EndPos := curPos; // Set last position to actual position
// get url
UrlPosStart := PosFrom('href="', HTML, EndPos); // search for url start
UrlPosEnd := PosFrom('>', HTML, UrlPosStart); // search for url start
URL := BASE_URL + Trim(Copy(HTML, UrlPosStart + 6, (UrlPosEnd - UrlPosStart - 7) ));
LogMessage(URL);
// Get Name
actPosStart:=PosFrom('.htm">', HTML, EndPos); // search for url start;
actPosEnd:=PosFrom('', HTML, actPosStart); // search for url end
Name := Trim(Copy(HTML, (actPosStart + Length('.htm">')), (actPosEnd - actPosStart - 6) ));
LogMessage(Name);
debug_pos1:=Pos('(',Name);
if debug_pos1 >0 then
Name := Copy(Name,0,debug_pos1-1);
LogMessage(Name);
// Get Gender
curPos := PosFrom('/gender=', HTML, curPos)+8;
EndPos:= PosFrom('/',HTML,curPos);
gender := RemoveTags(Trim(Copy(HTML, curPos, endPos - curPos)), false);
gender := StringReplace(gender, #39+',this);return false" onmouseout="ajax_hideTooltip()" href="', '', true, false, true);
gender := StringReplace(gender, 'f', 'Actress', true, false, true);
gender := StringReplace(gender, 'm', 'Males', true, false, true);
gender := StringReplace(gender, 'd', 'Directors', true, false, true);
LogMessage(gender);
AddSearchResult(Name, gender, '', URL, ImageURL);
LogMessage('Risultato aggiunto con successo.');
curPos := PosFrom('href="', HTML, actPosEnd);
end;
end;
curPos := PosFrom('
Reviews', HTML);
LogMessage('Reviews readout');
if curPos > 0 then begin
EndPos := curPos;
while (curPos > 0) AND (Counter < 50) AND (curPos < PosFrom('', HTML, EndPos)) do begin
LogMessage('Intepreting site');
Counter := Counter +1;
EndPos := curPos; // Set last position to actual position
// get url
UrlPosStart := PosFrom('href="', HTML, EndPos); // search for url start
UrlPosEnd := PosFrom('">', HTML, UrlPosStart); // search for url start
URL1 := BASE_URL + Trim(Copy(HTML, UrlPosStart + 6, (UrlPosEnd - UrlPosStart - 6) ));
LogMessage(URL1);
// Get Name
actPosStart:=PosFrom('">', HTML, EndPos); // search for url start;
actPosEnd:=PosFrom('', HTML, actPosStart); // search for url end
Name1 := Trim(Copy(HTML, (actPosStart + Length('">')), (actPosEnd - actPosStart - 6) ));
LogMessage(Name1);
debug_pos1:=Pos('(',Name1);
if debug_pos1 >0 then
Name1 := Copy(Name,0,debug_pos1-1);
LogMessage(Name1);
AddSearchResult(Name1, 'Reviews', '', URL1, '');
LogMessage('Risultato aggiunto con successo.');
curPos := PosFrom('href="', HTML, actPosEnd);
end;
end;
curPos := PosFrom('
Titles:', HTML) > 0 then begin
LogMessage('Search Results...');
ParseSearchResults(HTML);
Result := prList; //search results retrieved
end else
if Pos('Titles:', HTML) < 0 then begin
LogMessage('Error case...');
Result := prError; //error (person not found)
end
else
if (Pos('Performer Credits', HTML) > 0) then begin
LogMessage('Parsing people...');
Mode := smNormal;
ParsePeople(URL, HTML);
Result := prdownload; //script has finished it's job
//Result := prfinished; //script has finished it's job
end else
Result := prError; //error (unknown page retrieved)
end;
//--------------------------Inizia lo script-----------------------------
begin
Mode := smSearch; //Modo script inizializzato in ricerca
end.