(* Additional types and functions that can be used in scripts: --------------------------------------------- SCRIPT: iafd_people script AUTHOR: SusiMeier DATE: 20/6/2010 VERSION: 0.0.1.1 MODIFICATION SCRIPT : iafd_people(pra15) script CO-AUTHOR: pra15 MODIFICATION DATE: 23/1/2012 MODIFICATION VERSION: 0.1.1.3 CO-AUTHOR: Ivek23 SCRIPT MODIFICATION: Pra15 MODIFICATION VERSION: 0.2.0.1 DATE: 01/02/2015 UPDATE: --------------------------------------------- //Types TWIDEARRAY : array of String //Field functions procedure AddSearchResult(Title1, Title2, Year, URL, PreviewURL : String) procedure AddFieldValue(AField: Integer; AValue : String) procedure AddMoviePerson(Name, TransName, Role, URL : String; AType : Byte) procedure AddPersonMovie(Title, OrigTitle, Role, Year, URL : String; AType : Byte) procedure AddAward(Event, Award, Category, Recipient, Year: String; const Won : Boolean) procedure AddConnection(Title, OrigTitle, Category, URL, Year: String) procedure AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode : String) //String functions function Pos(Substr : String; Str: String): Integer function PosFrom(const SubStr, Str : String; FromIndex : Integer) : Integer function LastPos(const SubStr, Str : String) : Integer function PrevPos(const SubStr, Str : String; APos : Integer) : Integer function RemoveTags(AText : String; doLineBreaks : Boolean) : String function ExplodeString(AText : String; var Items : TWideArray; Delimiters : String) : Integer function Copy(S: String; Index, Count: Integer): String procedure Delete(var S: String; Index, Count: Integer) procedure Insert(Source: String; var Dest: String; Index: Integer) function Length(S: String): Integer function Trim(S: String): String function CompareText(S1, S2: String): Integer function CompareStr(S1, S2: String): Integer function UpperCase(S: String): String function LowerCase(S: String): String function StringReplace(S, OldPattern, NewPattern: String; ReplaceAll : Boolean; IgnoreCase : Boolean; WholeWord: Boolean): String function StrToInt(const S: String): Integer function IntToStr(const Value: Integer): String function StrToFloat(const S: String): Extended function FloatToStr(const Value: Extended): String function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String function HTMLValues2(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String function TextBetween(const HTML : String; ABegin, AEnd : String; doLineBreaks : Boolean; var Pos : Integer) : String function HTMLToText(const HTML : String) : String procedure ShowMessage(const Msg, Head : String) *) //Costanti utili const //Script types stMovies = 0; stPeople = 1; stPoster = 2; //Script modes smSearch = 0; smNormal = 1; smPhoto = 2; smFinished = 3; //Parse results prError = 0; prFinished = 1; prList = 2; prListImage = 3; prDownload = 4; //Download methods dmGET = 0; dmPOST = 1; //Prefix modes pmNone = 0; pmEnd = 1; pmBegin = 2; pmRemove = 3; //Movie fields mfURL = 0; mfTitle = 1; mfOrigTitle = 2; mfAka = 3; mfYear = 4; mfGenre = 5; mfCategory = 6; mfCountry = 7; mfStudio = 8; mfMPAA = 9; mfRating = 10; mfTags = 11; mfTagline = 12; mfDescription = 13; mfDuration = 14; mfFeatures = 15; //People fields pfURL = 0; pfName = 1; pfTransName = 2; pfAltNames = 3; pfBirthday = 4; pfBirthplace = 5; pfGenre = 6; pfBio = 7; pfDeathDate = 8; //Credits types ctActors = 0; ctDirectors = 1; ctWriters = 2; ctComposers = 3; ctProducers = 4; //Script data SCRIPT_VERSION = '0.3.0.1'; SCRIPT_NAME = 'IAFD_people(TABINFO)_NEW2015'; SCRIPT_DESC = '[EN] Get people full information from IAFD.com'; SCRIPT_LANG = $09; //English SCRIPT_TYPE = stPeople; BASE_URL = 'http://www.iafd.com'; RATING_NAME = 'ADE'; SEARCH_STR = 'www.iafd.com/results.asp?SearchType=Mozilla-search&SearchString=%s'; CODE_PAGE = 0; //Use 0 for Autodetect //OPTIONS GET_THEMES = True; //Set to False if you do not want Themes in Category field GET_REVIEW = True; GET_CREDITS = True; GET_FULL_FILMOGRAPHY = False; //Add All movies in Biography field GET_DOUBLONS = True; //Info double in comments and in field GET_GENRE = True; //Apply IAFD in Genre //Global variables var Mode : Byte; PhotoURL : String; tabI: array[1..28] of string; TabFilm, TabYear, TabDist, TabNote, TabAKA : Array of String; //////////Ajout TabAKA //Functions function GetScriptVersion : String; //obbligatoria begin Result := SCRIPT_VERSION; end; function GetScriptName : String; //obbligatoria begin Result := SCRIPT_NAME; end; function GetScriptDesc : String; //obbligatoria begin Result := SCRIPT_DESC; end; function GetBaseURL : AnsiString; //obbligatoria begin Result := BASE_URL; end; function GetScriptLang: Cardinal; //obbligatoria begin Result := SCRIPT_LANG; end; function GetScriptType : Byte; //obbligatoria begin Result := SCRIPT_TYPE; end; function GetCurrentMode : Byte; //obbligaotoria begin Result := Mode; end; function GetDownloadURL : AnsiString; //obbligatoria begin logmessage('URL DE LA PHOTO: ' + PhotoURL); if Mode > 0 then begin if PhotoURL <> '' then begin LogMessage('Url di download: Foto'); Result := PhotoURL; Exit; end; end else begin LogMessage('Url di download: Search'); Result := SEARCH_STR; end; end; function GetRatingName : String; begin Result := RATING_NAME; end; function GetCodePage : Cardinal; begin Result := CODE_PAGE; end; function GetDownloadMethod : Byte; begin Result := dmGET; end; function GetPrefixMode : Byte; begin Result := pmBegin; end; function GetIAFDValue ( HTML : String; StartString : String) : String; var curPos,EndPos: Integer; begin curPos := Pos(StartString, HTML); if curPos>0 then begin CurPos := PosFrom('',HTML,curPos); CurPos := PosFrom('>',HTML,curPos)+1; EndPos := PosFrom('',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 ('

Birthday

',HTML,curPos)+34; if curPos > 0 then begin curPos := PosFrom('">',HTML,curPos)+2; EndPos := PosFrom(' ',HTML,curPos); Mese := Copy(HTML,curPos,EndPos-curPos); // Mois en lettre If Mese = '',HTML,curPos)+2; EndPos := PosFrom(' ',HTML,curPos); Mese := Copy(HTML,curPos,EndPos-curPos); end; curPos := EndPos; EndPos := PosFrom(',',HTML,curPos); Giorno := Copy(HTML,curPos,EndPos-curPos); //Jour 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); LogMessage(Giorno); curPos := EndPos + 1; EndPos := PosFrom('',HTML,curPos); Anno := Copy(HTML,curPos, EndPos-curPos); //Année 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,'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); Datanascita:=(Giorno + '.' + Mese + '.' + Anno); if Length(Datanascita) < 20 then begin tabI [4] := Mese; tabI [5] := Giorno; tabI [6] := Anno; tabI [7] := Datanascita; AddFieldValue(pfBirthday, Datanascita); end; end; //Astrology (copy from nome) curPos := Pos('>Astrology

0 then begin curPos := PosFrom('class="biodata">', HTML, curPos)+16; logmessage('CCCC: '+ copy(HTML,curPos,2)); if copy(HTML,curPos,2) = '',HTML,curPos); curPos := PrevPos('">',HTML,endPos)+2; NomeAlt := Trim(copy(HTML,curPos,endPos-curPos)); end else begin endPos := 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 Active2005-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', HTML) + 19; //curPos := PosFrom('(', HTML, curPos) + 1; //endPos := PosFrom(')', HTML, curpos); //NomeAlt := Trim(copy(HTML, curpos, EndPos - Curpos)); tabI [18] := Nomealt; end; //Weight (copy from nome) //Nomealt := (GetIAFDValue(HTML,'Weight')); curPos := Pos('>Weight

',HTML); endPos := PosFrom('

','

',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', HTML)+19; //curPos := PosFrom('(', HTML, curPos) + 1; //endPos := PosFrom(')', HTML, curpos); //NomeAlt := Trim(copy(HTML, curpos, EndPos - Curpos)); //end; tabI[19] := Nomealt; end; //Measurements (copy from nome) //Nomealt := (GetIAFDValue(HTML,'Measurements')); curPos := Pos('>Measurements

',HTML); NomeAlt := textBetween(HTML,'">','

',true,curPos); if Nomealt <> '' then begin LogMessage('Measurements:' + Nomealt); Nomealt := StringReplace(Nomealt, 'No data', '', true,true,true); Nomealt := StringReplace(Nomealt,'-',' - ',true,true,true); tabI [17] := Nomealt; end; //Tattoos (copy from nome)// ')); 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('Website0 then begin curPos := PosFrom('', HTML, endPos)) do begin curPos := curPos + Length('', HTML, curPos); Nomealt1 := Copy(HTML, curPos, endPos - curPos); curPos := PosFrom('">', HTML,CurPos)+2; endPos := PosFrom('', HTML, curPos); Nomealt2 := Copy(HTML, curPos, endPos - curPos); curPos := endPos + 4; endPos := PosFrom('
', HTML, curPos); Nomealt3 := Copy(HTML, curPos, endPos - curPos); if Nomealt3 <> '' then Nomealt0 := Nomealt0 + #13#10 + '' + Nomealt2 + ' ' + Nomealt3 else Nomealt0 := Nomealt0 + #13#10 + '' + Nomealt2 + ' '; LogMessage('Website:' + Nomealt0); curPos := PosFrom('Performer Credits', HTML, endPos); if curPos > 0 then begin endPos := curPos; // Nbr Movies: Curpos := PosFrom('">Performer Credits', HTML,Endpos); EndPos := PosFrom('',HTML,CurPos); nbMovStr := TextBetween(HTML,'(',')',true,curpos); logmessage('NBR MOVIE STR: '+nbMovStr); If curPos < EndPos then begin nbMov := StrToInt(nbMovStr)+1 If nbMov = 2 then fullinfo := fullinfo+'Performer Credits: 1 Title' + #13#10 + #13#10; If nbMov > 2 then fullinfo := fullinfo+'Performer Credits: ' + NbMovStr + ' Titles' + #13#10 + #13#10; SetLength (TabFilm, nbMov); SetLength (TabDist, nbMov); SetLength (TabYear, nbMov); SetLength (TabNote, nbMov); end; curPos := PosFrom('', HTML, endPos); if curPos > 0 then begin endPos := curPos; curPos := PosFrom(' 0) AND (curPos < PosFrom('', HTML, endPos)) do begin Endpos := PosFrom('">', HTML, Curpos); URL := BASE_URL + Trim(Copy(HTML, Curpos+6, Endpos- Curpos-6)); // 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 Year : Year := textBetween(HTML,'','',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 := '

Directors

'; //////// end else begin //////// StrDir := '

Reviews

'; //////// end; //////// LogMessage('Search Results...'); curPos := Pos('

Performers

', 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.