//SCRIPT INFO================================================================================================== BlockOpen (*Following until 'SCRIPT CONSTANTS...' is documentation. Please see 'USER OPTIONS' in the body of the script. --------------------------------------------- AUTHORS: Pra15 & Ivek32 & VVV --------------------------------------------- CHANGE LOG : v 0.1.0.0 initial release --------------------------------------------- FIELD USE: This is a script designed to be easy to understand and to adapt. For this reason may be missing some fields and the programming may not be smart. It's a only "One Pass" Script and get data in WEB SECUENTIAL ORDER. The Personal Video DataBase field names in comments are enclosed in "~" so they are easier to find in the script. The WEB_SPECIFIC commentary points out the specific text for Web fields. Use Log PVdB debug Window for looking search errors. Important note: This scripts don't use the GET PVdB function for download page (this allows use HTTPS pages). For do that it use a specific program "PVdBDownPage" AutoHotKey script. You can get it from the authors page: http://vvveasy.altervista.org/personal-video-database/ NEEDED EXTERNAL FILES IN SCRIPTS FOLDER: • %Path%\PVdBDownPage.exe FOOTNOTES: 1.Control the use of standard fields using the "Overwrite Fields" plugin preferences in the main program PVD: Preferences > Plugins > 'Script Name' > Overwrite fields to control how these items are to be updated. 2.Hits for adapt the Script. 2.1. Search WEB_SPECIFIC comentary for adapt the specific Web text of fields. 2.2. Script execution: 0) Get results of "Obligatory callback Functions" 1) GetDownloadURL (Obligatory callback Functions) = This function should return URL that should be downloaded by the main application and then passed to the script’s ParsePage function as text. It may have several modes selon the Script mode (Global Var Mode = smSearch, smNormal, smFinished). 2) ParsePage (Obligatory callback Functions) = This function receives the text of the download web page passed to the main application in the GetDownloadURL function. It has several modes selon the Script mode (Global Var Mode = smSearch, smNormal, smFinished). KNOWN ISSUES: 1. For compiling cuestions functions must be defined in the script before use (not in order of execution). 2. For the search texts for locating the fields in Web page Null '' value it's not valid. You must replaces all escaped HTML characters (like <>&") with normal characters (like <, >,$, "). 3. It's a only "One Pass" Script: It DOES NOT makes several calls to the main program to scrape information from various pages of the movie in the same site. It only do that for searching mode in a movie list results. 4. If desired, you needs Custom Field ~FilmAffinity_Votes~ for storing the number of votes and ~Set~ for "GRUPOS". 5. Get Web "AKA" and "GRUPOS" not implemented SCRIPT STRUCTURE: 1.Script data and user options constants 2.Some useful generic constants 3.Global variables 4.Obligatory PVD callback Functions GetScriptVersion, GetScriptName, GetScriptDesc, GetBaseURL, GetScriptLang, GetScriptType, GetCurrentMode, GetDownloadURL. (Note: ParsePage is at the end of the file for compiling cuestions). 5.Optional PVD callback Functions GetRatingName ,GetCodePage, GetDownloadMethod, GetPrefixMode; 6.User Functions an procedures (with their constans) 7.Obligatory PVD callback function ParsePage (at the end of the file for compiling cuestions) *) //SCRIPT INFO================================================================================================== BlockClose //SCRIPT CONSTANTS============================================================================================= BlockOpen Const //Script types--------------------------------------------------------------------------------------------------------- stMovies = 0; stPeople = 1; stPoster = 2; stScreenShots = 3; stCover = 4; //Script Obligatory Infos---------------------------------------------------------------------------------------------- SCRIPT_NAME = 'Iafd People No Photo[HTTPS]';//The script of cinema fan community SCRIPT_DESC = 'Iafd download People info [EN]'; SCRIPT_VERSION = '0.1.0.0'; SCRIPT_TYPE = stPeople; SCRIPT_LANG = $0c; //Spanish //$0a es-Spanish $0c fr-French $09 en-English RATING_NAME = 'Iafd'; //PVD has ~orname~,~orating~ for this value.May be in user ~rating~ CODE_PAGE = 0; //28591=ISO 8859-1 Latin 1; Western European (ISO). Use: 65001=Unicode (UTF-8) | 0=for Autodetect //Script Options------------------------------------------------------------------------------------------------------- //Retreive Data Config //Process Data Config SET_AS_USER_RATING = False ; //Set Iafd rating as PVD user rating.. //Process Behaviour Config BYPASS_SILENT = True ; //Ensure critical ShowMessage alerts bypassing Silent PVdB preferences POSTER_IN_SEARCH = False ; //Download and show movie posters in the list of the SearchResult CHECK_WEBSITE = False ; //Add to SearchResult List the true HTTPS links 'Just to check the website' with the browser SEARCH_ENGINE = False ; //If there isn't provider search results, try with Bing search engine INTERNET_TEST_ITERATIONS = 6; //Attempts before to alert user that not internet connection detected. Increase if the provider has low speed. //User Options--------------------------------------------------------------------------------------------------------- //Script data---------------------------------------------------------------------------------------------------------- BASE_URL = 'http://www.iafd.com'; //The traditional BASE_URL used to get movie ID if the movie is stored for instance 'http://www.filmaffinity.com /en/film809297.html'. BASE_URL_TRUE = 'https://www.iafd.com'; //True actual link to movie ID 'httpS://www.filmaffinity.com /en/film809297.html'. BASE_URL_SEARCH_PROV = 'https://www.iafd.com/result.asp?searchtype=comprehensive&searchstring='; //'https://www.iafd.com/results.asp?'; //Search string for '%s' title and '%y' year. WEB_SPECIFIC. BASE_URL_PRE = 'http://www.iafd.com'; //For Bing search compatibility BASE_URL_PRE_TRUE = 'https://www.iafd.com'; //For Bing search compatibility BASE_URL_SUF = '.html'; //For Bing search compatibility BASE_URL_SEARCH_ENGI = 'http://www.bing.com/Search?q=%s%20+(%y)+site%3A%p'; // Search string: '%s' title , '%y' year and '%p' web information provider. //Download HTTPS needed parameters BASE_URL_ROUNDABOUT = 'ROUNDABOUT'; //Used for cheat GET PVdB funtion and rondabout the "https" fail. BASE_DOWNLOAD_FILE_NO_BOM = 'Tmp\downpage-UTF8_NO_BOM.htm'; //File to store curl page download in UTF8 without BOM and then it's not necesary use GET PVdB funtion to download. CHEAT_PREFIX_URL = 'http://httpbin.org/response-headers?key='; //Working http URL used for cheat GET PVdB funtion when it returns for SearchList choice. DUMMY_HTML_FILE = 'portable.bat'; //Any existing PVdV file (little) not used. If adapted, it may external file 'C:\Windows\notepad.exe' //Script movie modes.-------------------------------------------------------------------------------------------------- smSearch = 0; //Entry mode and search list mode (AddSearchResult) smNormal = 1; //This scripts download with external program (not with GetDownloadURL) so it only make one pass to ParsePage for retrieve all info, credits, poster, etc. other field modes aren't necesary. //Movie PVdB fields in http://www.videodb.info/help/hlp_scripting.html#fields: //Certification (AddValueField): ~mpaa~ //Credits (AddMoviePerson): ~Directors~,~Writers~,~Composers~,~Photographers~,~Actors~,~Producer~.Same that smCast. //Votes (AddValueField): ~rating~,~imdbrating~,~orname~,~orating~ and related custom PVdB fields ~IMDB_Votes~,~TOP_250~,~FilmAffinity_Votes~. //Poster (AddValueImageURL): ~poster~,~screenshots~,~froncover~,~cdcover~ //Review (AddValueField): ~comment~,~tags~ //Awards (AddAwards). smSearchList = 8; //Used in ParsePage for demands download the https link returned by user in the window of (AddSearchResult) smFinished = 9; //For set script finish. //Parse results (return of ParsePage)---------------------------------------------------------------------------------- prError = 0; //An error acquired while processing data prFinished = 1; //Script has finished gathering data prList = 2; //A list of search results is available. Use with (AddSearchResult) prListImage = 3; //A list of image search results is available. Use with? prDownload = 4; //Another URL needs to be downloaded //Download methods----------------------------------------------------------------------------------------------------- dmGET = 0; dmPOST = 1; //Credits types-------------------------------------------------------------------------------------------------------- ctActors = 0; ctDirectors = 1; ctWriters = 2; ctComposers = 3; ctProducers = 4; //Image types----------------------------------------------------------------------------------------------------------- itPoster = 0; itScreenShot = 1; itFrontCover = 2; itDiscImage = 3; itPhoto = 4; //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; //SCRIPT CONSTANTS============================================================================================= BlockClose //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 WRITE_BIO = True; //True if Fullinfo write in ~biography~ tab, False if Fullinfo write in ~comment~ Tab WRITE_DATE = True; //Add the date of the donwload in the comment //Global variables var Mode : Byte; PhotoURL, DownloadURL, StoredURL : String; tabI: array[1..28] of string; TabFilm, TabYear, TabDist, TabNote, TabAKA, TabtypFilm : Array of String; //////////Ajout TabAKA //OBLIGATORY CALLBACK FUNCTIONS=================================================================================BlockOpen Function GetScriptVersion:String; //BlockOpen begin Result:=SCRIPT_VERSION; end; //BlockClose Function GetScriptName:String; //BlockOpen begin Result:=SCRIPT_NAME; end; //BlockClose Function GetScriptDesc:String; //BlockOpen begin Result:=SCRIPT_DESC; end; //BlockClose Function GetBaseURL:AnsiString; //BlockOpen begin Result := BASE_URL_ROUNDABOUT; //Used for cheat GET PVdB funtion and rondabout the "https" fail. end; //BlockClose Function GetScriptLang:Cardinal; //BlockOpen begin Result:=SCRIPT_LANG; end; //BlockClose Function GetScriptType:Byte; //BlockOpen begin Result:=SCRIPT_TYPE; end; //BlockClose Function GetCurrentMode:Byte; //BlockOpen begin Result:=Mode; end; //BlockClose Function GetRatingName:String; //BlockOpen Begin Result:=RATING_NAME; End; //BlockClose Function GetCodePage:Cardinal; //BlockOpen begin Result:=CODE_PAGE; End; //BlockClose Function RealURL(URLs:AnsiString):String; //BlockOpen // Function to return only the URl of iafd (http) if there's several Urls in url field. //exemple : 'https://www.iafd.com/aaa http://www.egaf.com/bbb' return 'http://www.iafd.com/aaa' Var Site:String; i,j:Integer; TabURL : TwideArray; Begin LogMessage('Function RealURL Start :'); i:= 0; j:=0; ExplodeString(URLs,TabURL,' '); If High(TabURL) > 0 then Begin LogMessage('Plusieurs valeurs!'); For i:= 0 to High(TabURL) do begin Site:= trim(Copy(tabURL[i],5,1)); LogMessage('Site :'+ Site) If Site='s' then begin j:=13; end else begin j:=12; end; Site := trim(Copy(TabURL[i],j,4)) LogMessage('Site : '+Site) If Site='iafd' then begin result:= TabURL[i]; LogMessage(TabURL[i]); exit; end else begin result := ''; end; end; end; End; Function GetDownloadURL:AnsiString; //BlockOpen Var curPos:Integer; ScriptPath,MovieID:String; begin LogMessage('Function GetDownloadURL BEGIN======================|'); LogMessage('Global Var-Mode (GDU)|'+IntToStr(Mode)+'|'); LogMessage('Global Var-DownloadURL (GDU)|'+DownloadURL+'|'); //Comprobation of needed external files. ScriptPath:=GetAppPath+'Scripts\'; if Not(FileExists(ScriptPath+'PVdBDownPage.exe')) then begin ShowMessage ('Este script necesita archivos externos para funcionar:'+Chr(13)+'• PVdBDownPage.exe'+Chr(13)+'Lea el texto del script para más información',SCRIPT_NAME); Mode:=smFinished; Result:=''; //If error returns empty string exit; end; (*If PhotoURL <> '' then begin //Standarize the URL //PhotoURL:=LowerCase(StoredURL); //PhotoURL:=StringReplace(StoredURL,'https','http',True,True,False); LogMessage('Photo URL est: '+PhotoURL); Result := PhotoURL; Exit; end;*) if (Mode=smSearch) then begin //Get stored URL if exist. StoredURL:=GetFieldValueXML('url'); LogMessage('Stored URL is:'+StoredURL+'||'); StoredURL := RealURL(StoredURL); //Standarize the URL StoredURL:=LowerCase(StoredURL); StoredURL:=StringReplace(StoredURL,'https','http',True,True,False); LogMessage('Stored URL is: '+StoredURL); //Get FilmAffinity ID if exist. curPos:=Pos(BASE_URL,StoredURL); if 0Go to function ParsePage for parse the film information Result:=GetAppPath+DUMMY_HTML_FILE; //Any existing little file for cheating PVdB automatic download (little). LogMessage('Function GetDownloadURL END====================== with Mode='+IntToStr(Mode)+' Result='+Result+'|'); exit; end else begin //The movie URL not exist, search mode needed. Download the search page. LogMessage(' No iafd URL.'); Mode:=smSearch; //->Go to function ParsePage for search the URL (in this funtion you can't not use user funtions) DownloadURL:=''; //Has not movie URL. Result:=GetAppPath+DUMMY_HTML_FILE; //Any existing little file for cheating PVdB automatic download (little). LogMessage('Function GetDownloadURL END====================== with Mode='+IntToStr(Mode)+' Result='+Result+'|'); exit; //Go to the end; end; //Not other modes working needs in this function. //smNormal = 1; //This scripts download with external program (not with GetDownloadURL) so it only make one pass to ParsePage for retrieve all info, credits, poster, etc. other field modes aren't necesary //smSearchList = 8; //Used in ParsePage for demands download the https link returned by user in the window of (AddSearchResult) Result:=GetAppPath+DUMMY_HTML_FILE; //Any existing little file for cheating PVdB automatic download (little). LogMessage('Function GetDownloadURL END====================== with Mode='+IntToStr(Mode)+' Result='+Result+'|'); exit; end; //BlockClose Function DownloadPage(URL:AnsiString):String; //BlockOpen //Returns the URL page text. If error returns empty string Var i:Integer; ScriptPath,WebText:String; Begin LogMessage(Chr(9)+Chr(9)+'Function DownloadPage BEGIN======================|'); LogMessage(Chr(9)+Chr(9)+'Global Var-DownloadURL (DP)|'+DownloadURL+'|'); LogMessage(Chr(9)+Chr(9)+' Local Var-URL (DP)|'+URL+'|'); ScriptPath:=GetAppPath+'Scripts\'; //LogMessage(Chr(9)+Chr(9)+' Local Var-ScriptPath|'+ScriptPath+'|'); //Delete the ancient dowloaded page file. Needed for wait to curl download included in PowerShell command. While FileExists(ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM) Do Begin FileExecute('cmd.exe', '/C del "'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM+'"'); LogMessage(Chr(9)+Chr(9)+' Waiting 1s for delete:'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); wait (1000); End; //Download the URL page. LogMessage(Chr(9)+Chr(9)+' Download with PVdBDownPage in file:|'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM+' the information of:|'+URL+'||'); FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+URL+'" "'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM+'"'); //Wait download finish and exist the downloaded page. i:=0; // INTERNET_TEST_ITERATIONS While Not(FileExists(ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM)) Do Begin LogMessage(Chr(9)+Chr(9)+' Waiting 2s for exists of:'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); wait (2000); i:=i+1; If i=INTERNET_TEST_ITERATIONS Then Begin if 2=MessageBox('Demasiados intentos fallidos de conexión a internet.'+Chr(13)+ 'Reintentar o Cancelar?',SCRIPT_NAME,5) then begin LogMessage(Chr(9)+Chr(9)+'Function DownloadPage END with NOT INTERNET connection ===============|'); Result:=''; Exit; End; i:=0; End; End; LogMessage(Chr(9)+Chr(9)+' Now present complete page file: '+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); WebText:=FileToString(ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); WebText:=ConvertEncoding(WebText, 65001); //65001 utf-8 Unicode (UTF-8) ---> https://msdn.microsoft.com/en-us/library/dd317756(VS.85).aspxbrary/dd317756(VS.85).aspx //LogMessage(Chr(9)+Chr(9)+' Local Var-WebText|'+WebText+'|'); //Debug statement Result:=WebText; //Some download data comprobations. if (Pos('404 Not Found',Result)>0) then begin //Banned IP. WEB_SPECIFIC. If BYPASS_SILENT Then ShowMessage('The URL is not in use (404 Not Found).'+Chr(13)+'Go to the provider web in order to in order to'+Chr(13)+'find the good page',SCRIPT_NAME); LogMessage(Chr(9)+Chr(9)+' 404 Not Found|'); Result:=''; //Fatal error End; if (Pos('404 Error - IMDb',Result)>0) then begin //Banned IP. WEB_SPECIFIC. If BYPASS_SILENT Then ShowMessage('The URL is not in use (404 Error - IMDb).'+Chr(13)+'Go to the provider web in order to in order to'+Chr(13)+'find the good page',SCRIPT_NAME); LogMessage(Chr(9)+Chr(9)+' 404 Error - IMDb|'); Result:=''; //Fatal error End; if (Pos('Page not found',Result)>0) then begin //Banned IP. WEB_SPECIFIC. If BYPASS_SILENT Then ShowMessage('The URL is not in use (Page not found).'+Chr(13)+'Go to the provider web in order to in order to'+Chr(13)+'find the good page',SCRIPT_NAME); LogMessage(Chr(9)+Chr(9)+' Page not found|'); Result:=''; //Fatal error End; if (Pos('405 Method not allowed',Result)>0) then begin //Banned IP. WEB_SPECIFIC. If BYPASS_SILENT Then ShowMessage('La URL tiene problemas de HTTP metodo (405 Method not allowed).'+Chr(13)+'Ir a la página del proveedor para'+Chr(13)+'encontrar la página buena',SCRIPT_NAME); LogMessage(Chr(9)+Chr(9)+' 405 Method not allowed|'); Result:=''; //Fatal error End; if (Pos('Too many request',Result)>0) then begin //Banned IP. WEB_SPECIFIC. If BYPASS_SILENT Then ShowMessage('El proveedor ha prohibido su IP (Demasiadas peticiones).'+Chr(13)+'Ir a la página del proveedor y resolver el captcha para'+Chr(13)+'demostrar que no es un robot',SCRIPT_NAME); LogMessage(Chr(9)+Chr(9)+' Banned IP|'); Result:=''; //Fatal error End; LogMessage(Chr(9)+Chr(9)+'Function DownloadPage END======================|'); exit; End; //BlockClose //Fonctions perso 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;*) Procedure ParsePeople(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, typFilm: String; details,fullinfo, DateCourant : String; URLPP, Name, Distrib, Year, Notes, Titles: String; debug_pos1: Integer; DateParts:Twidearray; begin ////Date of the download info : If WRITE_DATE = True then DateCourant := DateToStr(CurrentDateTime); //LogMessage('Write XXXXXXXX :'+ Write); if DateCourant <> '' then begin ExplodeString(DateCourant, DateParts, '-'); DateCourant := DateParts[2] + '-' + DateParts[1] + '-' + DateParts[0]; DateCourant := 'Last Visit : ' + DateCourant + #13#10; end; ///////////////////////////////////// LogMessage('PARSING PEOPLE...'); fullinfo:= ''; fullinfo := DateCourant + #13#10; 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 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 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); if curPos > 0 then begin CurPos := CurPos+18; 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 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('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); tabI [18] := Nomealt; end; //Weight (copy from nome) //Nomealt := (GetIAFDValue(HTML,'Weight')); curPos := Pos('>Weight

',HTML)+13; 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); If curPos > endPos then begin NomeAlt := textBetween(HTML,'">','

',true,curPos); end; 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; //Website (copy from nome) curPos := Pos('>Website

', HTML); if curPos>0 then begin curPos := PosFrom('', HTML, curPos)) 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); SetLength (TabtypFilm, nbMov); end; curPos := PosFrom('', HTML, endPos); if curPos > 0 then begin endPos := curPos; curPos := PosFrom('title="Info on the movie', HTML, endPos); if curPos > 0 then begin I:= 1; endPos := curPos; // Get URL while (curPos > 0) AND (curPos < PosFrom('', HTML, endPos)) do begin Curpos := PrevPos('', HTML, Curpos); URLPP := 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; TabtypFilm[I] := typFilm; 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,'')+ ' ' + #8226 + ' ' + TabtypFilm [J]+ #13#10; logmessage (fullinfo); logmessage ('typfilm:' + typfilm); end; 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); URLPP := BASE_URL + Trim(Copy(HTML, Curpos+6, Endpos- Curpos-6)); logmessage('CCC URL :'+URLPP); // 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; If WRITE_BIO = True then AddFieldValue(pfBio,fullinfo) else AddFieldValueXML('comment',fullinfo); //AddFieldValueXML(Write,fullinfo); (*//Foto curPos :=Pos('id="headshot">',HTML); if curPos >0 then begin PhotoURL := TextBetween(HTML,'src="','">',True,curpos); LogMessage ('URL Foto XXXXXXXXX: '+PhotoURL); ParsePhoto(PhotoURL); end else begin PhotoURL := ''; LogMessage ('URL Foto: NESSUNO'); end;*) end; Function ParsePage(HTML:String;URL:AnsiString):Cardinal; //BlockOpen Var AppendOutPut:Boolean; begin LogMessage('Function ParsePage BEGIN======================|'); LogMessage('Global Var-Mode (PP)|'+IntToStr(Mode)+'|'); LogMessage('Global Var-DownloadURL (PP)|'+DownloadURL+'|'); LogMessage('Local Var-URL (PP)|'+URL+'|'); //Parse with the Movie URL 'smNormal'------------------------------------------------------------------------------------ If (Mode=smNormal) Then Begin LogMessage(' ParsePage mode smNormal. Getting provider data|'+IntToStr(Mode)+'|'); //Parse principal provider page = BASE_URL_PRE_TRUE------------------------------------------------------------------ HTML:=DownloadPage(DownloadURL); //True page for parsing HTML:=HTMLToText(HTML); LogMessage('HTML :'+HTML); Parsepeople(HTML); result:=prFinished; Mode:=smFinished; LogMessage('Function ParsePage smNormal END======================|'); Exit; End; end; //BlockClose