//SCRIPT INFO================================================================================================== BlockOpen (*Following until 'SCRIPT CONSTANTS...' is documentation. Please see 'USER OPTIONS' in the body of the script. --------------------------------------------- AUTHORS: VVV_Easy Contact Web: http://contactbyweb.com/vvv-easy --------------------------------------------- CHANGE LOG : v 1.0.0.0 (20/05/2018) VVV: Initial public release --------------------------------------------- FIELD USE: 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 byd 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 passeded 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. If desired, you needs Custom Fields ~IMDB_Votes~,~TOP_250~ for storing the number of votes and TOP250 IMDB list. 4. If not or bad MPAA USA then get Spain certification (if exist) and convert in USA-KODI values. If even this fails try to get of the "user" folders name. s try to get of the "user" folders name. 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; //Miscelanea script types //Script Obligatory Infos---------------------------------------------------------------------------------------------- SCRIPT_NAME = 'IMDB [EN][HTTPS]'; //The most complete information provider SCRIPT_DESC = 'IMDB download Movie info [EN]'; SCRIPT_VERSION = '1.0.0.0'; SCRIPT_TYPE = stMovies; SCRIPT_LANG = $09; //English //$0a es-Spanish $0c fr-French $09 en-English RATING_NAME = 'IMDB'; //PVD has ~imdbrating~ for this value CODE_PAGE = 65001; //28591=ISO 8859-1 Latin 1; Western European (ISO). Use: 65001=Unicode (UTF-8) | 0=for Autodetect Autodetect //Script Options------------------------------------------------------------------------------------------------------- //Retreive Data Config GET_FULL_MPAA = True ; //Download Certification provider page for retreive the MPAA info. Otherwise only the info of the principal movie page. GET_FULL_AKA = True ; //Download 'Also Known As' provider page for retreive the info. Otherwise only the info of the principal movie page. GET_FULL_CREDIT = True ; //Download Cast or Credit provider page for retreive the info. Otherwise only the info of the principal movie page. PEOPLE_LIMIT = 25; //Limit of number of actors (cast) or of credits (crew) retrieved. GET_FULL_AWARDS = True ; //Download Awards provider page for retreive the info. Otherwise doesn't do nothingh because no info in the principal movie page. EVENTS_LIMIT = 100; //Limit of number of events (USA Academy Awards, Golden Globes, etc) to retrive awards. GET_LENGTH = True ; //Retreive the original movie length. Otherwise doesn't do nothingh even if 'Overwrite fields' setting allows it. //Process Data Config //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 = True ; //Add to SearchResult List the true HTTPS links 'Just to check the website' with the browser SEARCH_ENGINE = True ; //If there isn't provider search results, try with Bing search engine //Script data------------------------------------------------------------------------------------------------------------ //Used Web URL BASE_URL_PRE = 'http://www.imdb.com/title/'; //The traditional BASE_URL_PREFIX used to get movie ID if the movie is stored for instance 'http://www.imdb.com/title/ tt0068646/'. BASE_URL_PRE_TRUE = 'https://www.imdb.com/title/'; //True actual link to movie ID 'httpS://www.imdb.com/title/ tt0068646/' BASE_URL_SUF = '/'; //Suffix in the link after MovieID 'http://www.imdb.com/title/ tt0068646 /' BASE_URL_PERSON_PRE = 'https://www.imdb.com/name/'; //The traditional BASE_UR to person ID 'httpS://www.imdb.com/name/ nm0094036/' BASE_URL_PERSON_PRE_TRUE = 'https://www.imdb.com/name/'; //True actual link to person ID 'httpS://www.imdb.com/name/ nm0094036/' BASE_URL_IMAGE_PRE = 'http://ia.media-imdb.com/images/M/'; //IMDB posters format: Full image: 'https://ia.media-imdb.com/images/M/MV5BMTI2MjI4NTgyNF5BMl5BanBnXkFtZTcwOTM5NzQ5MQ@@.jpg. BASE_URL_IMAGE_PRE_TRUE = 'https://ia.media-imdb.com/images/M/'; //Resized image: 'https://ia.media-imdb.com/images/M/MV5BMTI2MjI4NTgyNF5BMl5BanBnXkFtZTcwOTM5NzQ5MQ@@._V1_UY50_CR0,0,34,50_AL_.jpg // where the two last number are width and heigth BASE_URL_MPAA ='http://www.imdb.com/title/%IMDB_ID/parentalguide?ref_=tt_stry_pg#certification'; //Certification provider page. WEB_SPECIFIC. BASE_URL_AKA ='https://www.imdb.com/title/%IMDB_ID/releaseinfo?ref_=tt_dt_dt#akas'; //Also Known As provider page. WEB_SPECIFIC. BASE_URL_CAST ='https://www.imdb.com/title/%IMDB_ID/fullcredits?ref_=tt_cl_sm#cast'; //Cast provider page. WEB_SPECIFIC. BASE_URL_AWARDS='https://www.imdb.com/title/%IMDB_ID/awards?ref_=tt_awd'; //Awards provider page. WEB_SPECIFIC. BASE_URL_SEARCH_PROV ='https://www.imdb.com/search/title?title=%s&title_type=feature&release_date=%y,%y&view=simple'; //Search string for '%s' title and '%y' year. WEB_SPECIFIC //BASE_URL_SEARCH_PROV = 'https://www.imdb.com/search/title?title=%s&title_type=feature&release_date=%y,%y&countries=%C2%B7%C2%B7%C2%B7%C2%A0Common+Countries%C2%A0%C2%B7%C2%B7%C2%B7&languages=%C2%B7%C2%B7%C2%B7%C2%A0Common+Languages%C2%A0%C2%B7%C2%B7%C2%B7&view=simple' //Not used because not improvement results. WEB_SPECIFIC //BASE_URL_SEARCH_PROV = 'http://www.imdb.com/find?q=%s&s=tt&view=simple'; //Ivek23 proposition //BASE_URL_SEARCH_ENGI = 'http://www.bing.com/Search?q=site%3A%p%20%s+(%y)'; // Search string for '%p' web information provider, '%s' title , '%y' year. 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 = '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. INTERNET_TEST_ITERATIONS = 5; //Number of iterations to alert user that not internet connection detected. CHEAT_PREFIX_URL = 'http://www.jsontest.com/'+' '; //Working http URL + space 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.ss 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.hat smCast. //Votes (AddValueField): ~rating~,~imdbrating~,~orname~,~orating~ and related custom PVdB fields ~IMDB_Votes~,~TOP_250~,~FilmAffinity_Votes~.otes~,~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)SearchResult) smFinished = 9; //For set script finish. //Parse results (return of Script)--------------------------------------------------------------------------------------- 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; //Movie fields---------------------------------------------------------------------------------------------------------- mfURL = 0; mfTitle = 1; mfOrigTitle = 2; mfAka = 3; mfYear = 4; mfGenre = 5; mfCategory = 6; mfCountry = 7; mfStudio = 8; mfMPAA = 9; mfRating = 10; //This is 'Additional rating', not 'Rating' mfTags = 11; mfTagline = 12; mfDescription = 13; mfDuration = 14; mfFeatures = 15; //Credits types---------------------------------------------------------------------------------------------------------- ctActors = 0; ctDirectors = 1; ctWriters = 2; ctComposers = 3; ctProducers = 4; //Image types------------------------------------------------------------------------------------------------------------ itPoster = 0; itScreenShot = 1; itFrontCover = 2; itDiscImage = 3; itPhoto = 4; //SCRIPT CONSTANTS============================================================================================= BlockClose //SCRIPT GLOBAL VARIABLES=======================================================================================BlockOpen Var Mode:Byte; DownloadURL:String; //SCRIPT GLOBAL VARIABLES=======================================================================================BlockClose //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 GetDownloadURL:AnsiString; //BlockOpen Var curPos:Integer; ScriptPath,MovieID:String; Begin LogMessage('Function GetDownloadURL BEGIN======================|'); LogMessage('Global Var-Mode|'+IntToStr(Mode)+'|'); LogMessage('Global Var-DownloadURL|'+DownloadURL+'|'); //Comprobation of needed external files. ScriptPath:=GetAppPath+'Scripts\'; If Not(FileExists(ScriptPath+'PVdBDownPage.exe')) Then Begin ShowMessage ('This script needs the external file for work.'+Chr(13)+'• PVdBDownPage.exe'+Chr(13)+'Read script text for futher information',SCRIPT_NAME); Mode:=smFinished; Result:=''; //If error returns empty string exit; End; If (Mode=smSearch) Then Begin //Get Movie URL if exist. curPos:=Pos(BASE_URL_PRE, GetFieldValueXML('url')); 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. //ShowMessage('No IMDB URL.',SCRIPT_NAME); LogMessage(' No IMDB URL.'); Mode:=smSearch; //->Go to function ParsePage for search the URL (in this funtion you can't not use user funtions)ntions) 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 possible modes 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 necesarye 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)(AddSearchResult) Mode:=smFinished; Result:=''; LogMessage('Function GetDownloadURL END====================== with Mode='+IntToStr(Mode)+' Result='+Result+'|'); exit; End; //BlockClose Function GetRatingName:String; //BlockOpen Begin Result:=RATING_NAME; End;//BlockClose Function GetCodePage:Cardinal; //BlockOpen Begin Result:=CODE_PAGE; End; //BlockClose //OBLIGATORY CALLBACK FUNCTIONS=================================================================================BlockClose //USER FUNCTIONS AND PROCEDURES=================================================================================BlockOpen Function DownloadPage(URL:AnsiString):String; //BlockOpen //Returns the URL page text. If error returns empty string Var i:Integer; ScriptPath,WebText:String; Begin LogMessage('Function DownloadPage BEGIN======================|'); LogMessage('Global Var-DownloadURL|'+DownloadURL+'|'); LogMessage(' Local Var-URL|'+URL+'|'); ScriptPath:=GetAppPath+'Scripts\'; //LogMessage(' 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(' Waiting 1s for delete:'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); wait (1000); End; //Download the URL page. LogMessage(' 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. Powershell always create a file even if not internet connection.tion. i:=0; // INTERNET_TEST_ITERATIONS While Not(FileExists(ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM)) Do Begin LogMessage(' 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('Too many faulty attempts to internet connection.'+Chr(13)+ 'Retry or Cancel?',SCRIPT_NAME,5) then begin LogMessage('Function DownloadPage END with NOT INTERNET connection ===============|'); Result:=''; exit; End; i:=0; End; End; LogMessage(' Now present file: '+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); //Even when exists, need some time to write. WebText:=FileToString(ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); i:=0; While (Length(WebText)=0) Do Begin LogMessage(' Waiting 2s for writing downloaded file:'+ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); wait (2000); i:=i+1; If i=INTERNET_TEST_ITERATIONS Then Begin if 2=MessageBox('Too many faulty attempts to internet connection.'+Chr(13)+ 'Retry or Cancel?',SCRIPT_NAME,5) then begin LogMessage('Function DownloadPage END with NOT INTERNET connection ===============|'); Result:=''; exit; End; i:=0; End; WebText:=FileToString(ScriptPath+BASE_DOWNLOAD_FILE_NO_BOM); End; LogMessage(' Now present complete page file: '+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(' 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('404 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('The URL has HTTP method problems (405 Method not allowed).'+Chr(13)+'Go to the provider web in order to in order to'+Chr(13)+'find the good page',SCRIPT_NAME); LogMessage('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('The provider has banned your IP (Too many request).'+Chr(13)+'Go to the provider web and resolve the captcha in order to'+Chr(13)+'demostrate you are not a robot',SCRIPT_NAME); LogMessage('Banned IP|'); Result:=''; //Fatal error End; LogMessage('Function DownloadPage END======================|'); exit; End; //BlockClose Function TextBetWeenFirst(_HTML:string;_ABegin,_AEnd:String):String; //BlockOpen //Returns the first extract part of a given _HTML between _Abegin and _AEnd and removes all tags from the result substring. //In order to avoid set the Pos variable in TextBetween Var _Pos:Integer; Begin _Pos:=0; Result:=TextBetWeen(_HTML,_ABegin,_AEnd,false,_Pos); Exit; End; //BlockClose Function ParsePage_BingSearch(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prDownload; (Global var-DownloadURL=IMDB page) if there is one results. // Result:=prList; if there are several results. (Don't work with Preferences/Plugings/Silent Mode). // Result:=prError; If not results Var curPos,endPos:Integer; ItemValue,ItemList:String; Title,Year,MovieURL:String; Begin LogMessage('Function ParsePage_BingSearch BEGIN======================|'); LogMessage('Global Var-Mode|'+IntToStr(Mode)+'|'); LogMessage('Global Var-DownloadURL|'+DownloadURL+'|'); //First manager the results, second other situation (No results or fail -> Finish) If ((Pos(BASE_URL_PRE, HTML)>0) Or (Pos(BASE_URL_PRE_TRUE, HTML)>0)) Then Begin //Not movie URL found. WEB_SPECIFIC LogMessage(' BASE_URL_PRE results detectes.'); ItemList:=TextBetWeenFirst(HTML,'
    '); //String which opens-closes thesearch List results. WEB_SPECIFIC curPos:=PosFrom('
  1. ',ItemList,curPos); //String which opens the Web result Movie info (Poster and details text). WEB_SPECIFIC While (0','',false,curPos); //String which opens-closes the Web result Movie link. WEB_SPECIFIC //LogMessage(' Parse Results ItemValue:'+ ItemValue+'||'); endPos:=LastPos('(', ItemValue); //Not use curPos for not loosing text position when searching in ItemValue If (0',ItemList,curPos); //String which opens the Web result HTML file data. WEB_SPECIFIC End; Result:=prList; //Don't work with Preferences/Plugings/Silent Mode. LogMessage(' After parsing Bing search Movies go to choose List Results'); LogMessage('Function ParsePage_BingSearch END=====================||'); Exit; End Else Begin if BYPASS_SILENT then ShowMessage('Not results even with Bing search engine.'+Chr(13)+'Try again or make an advanced search out of the script.'+Chr(13)+'Write the movie URL (http) in the PVdB manually (remember separated by spaces) and run again.',SCRIPT_NAME); Result:=prError; LogMessage(' Not results|'); LogMessage('Function ParsePage_BingSearch END=====================||'); Exit; End; End; //BlockClose Function ParsePage_IMDBSearchTitle(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prDownload; (Global var DownloadURL=IMDB page) if there is one results. // Result:=prList; if there are several results. (Don't work with Preferences/Plugings/Silent Mode). // Result:=prError; If not results Var curPos,ResultsNumber:Integer; ItemValue:String; Title,Year,MovieURL,PreviewURL:String; Begin LogMessage('Function ParsePage_IMDBSearchTitle BEGIN======================|'); LogMessage('Global Var-Mode|'+IntToStr(Mode)+'|'); LogMessage('Global Var-DownloadURL|'+DownloadURL+'|'); If (Pos('No results',HTML)<>0) Then Begin //WEB_SPECIFIC LogMessage(' No Movies results'); Result:=prError; End Else Begin LogMessage(' Parsing search Movies results'); curPos:=Pos('
    ',HTML); //String which opens the Web Search List data. WEB_SPECIFIC //Get first item ResultsNumber:=0; curPos:=PosFrom('
    ',HTML,curPos); //String which opens the Web Result List data. WEB_SPECIFIC While curPos>0 Do Begin ResultsNumber:=ResultsNumber+1; LogMessage(' Parsing search movie results in '+IntToStr(curPos)+' ...'); curPos:=PosFrom('
    ',HTML,curPos); //String which opens the Web URL+Title+URL+PreviewURL data. WEB_SPECIFIC //Get PreviewURL ItemValue:=TextBetWeen(HTML,'loadlate="','"',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC If (Pos(BASE_URL_IMAGE_PRE_TRUE,ItemValue)>0) Then Begin //Http image YES: 'loadlate="https://ia.media-imdb.com/images/M/ ....' exists working http; //Http image NO: 'loadlate="https://m.media-amazon.com/images/...' NOT exists working httpS curPos:=curPos-Length(ItemValue); //Recover the good position. PreviewURL:=TextBetWeen(HTML,BASE_URL_IMAGE_PRE_TRUE,'.',false,curPos); //Get poster code. Strings which opens/closes the data. WEB_SPECIFIC PreviewURL:=BASE_URL_IMAGE_PRE + PreviewURL + '.jpg' //Fortunately the http links for the pics are availables. WEB_SPECIFIC End Else Begin PreviewURL:=''; End; If (Not POSTER_IN_SEARCH) Then PreviewURL:=''; LogMessage(' Parse Results PreviewURL:'+PreviewURL+'||'); //Get MovieURL (Always must it has) MovieURL:=TextBetWeen(HTML,'','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Title:'+Title+'||'); //Get Year Year:=TextBetWeen(HTML,'(',')',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results in Year:'+Year+'||'); AddSearchResult(Title,'',Year,MovieURL,PreviewURL); //Just to check the website (Only to check the web page) not PVdB valid result. if CHECK_WEBSITE then AddSearchResult(' '+#8729+' Just to check the website: '+StringReplace(MovieURL,CHEAT_PREFIX_URL,'',True,False,False),'','',StringReplace(MovieURL,CHEAT_PREFIX_URL,'',True,False,False),''); curPos:=PosFrom('
    ',HTML,curPos) //String which opens the Web Result item List data. WEB_SPECIFIC End; If ResultsNumber=1 Then Begin DownloadURL:=StringReplace(MovieURL,CHEAT_PREFIX_URL,'',True,False,False); //Eliminate the CHEAT_PREFIX_URL for get the true movie link DownloadURL:=StringReplace(DownloadURL,'http','https',True,True,False); //The direct url needed (no https redirection) Result:=prDownload; //One result in the DownloadURL. LogMessage(' After parsing search Movies,only one result detected'); End Else Begin Result:=prList; //Don't work with Preferences/Plugings/Silent Mode. LogMessage(' After parsing search Movies go to choose List Results'); End; End; LogMessage('Function ParsePage_IMDBSearchTitle END=====================||'); Exit; End; //BlockClose Function ParsePage_IMDBMovieBASE(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prFinished; Script has finished gathering data // Result:=prError; If not results //Retrieve: ~title~, ~year~, ~origtitle~, ~poster~ / ~imdbrating~, ~IMDB_Votes~ (Custom Field) / ~TOP_250~(Custom Field) / // If Not(GET_FULL_CREDIT): ~crew~ctDirectors,ctWriters,ctComposers,ctProducers(Not in base page), ctActors // ~description~ / ~category~ "keywords" / ~tagline~ / ~genre~ // If Not(GET_FULL_MPAA) ~mpaa~ // ~country~ / ~rdate~ in contry provider local IP geolocation // If Not(GET_FULL_AKA) ~aka~. // ~budget~ / ~money~ / ~studio~ "Production Co" // If Not(GET_LENGTH) ~lenght~ Var curPos,endPos,index:Integer; ItemValue,ItemList:String; titleValue:String; Name,Role,PersonURL:String; Begin LogMessage('Function ParsePage_IMDBMovieBASE BEGIN======================|'); //Because the script don't retreives the data in the page order a token search for the first curPos position is mandatory //Get ~title~, ~year~, ~origtitle~, ~poster~ curPos:=Pos('

    ',HTML); //WEB_SPECIFIC. If 0','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC AddFieldValueXML('title',titleValue); LogMessage(' Get result title:'+titleValue+'||'); ItemValue:=TextBetWeen(HTML,'(',')',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC AddFieldValueXML('year',ItemValue); LogMessage(' Get result year:'+ItemValue+'||'); ItemValue:=TextBetWeen(HTML,'
    ','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC If (Length(ItemValue)=0) Then ItemValue:=titleValue; //Provider hides the original title if same that title. WEB_SPECIFIC AddFieldValueXML('origtitle',ItemValue); LogMessage(' Get result origtitle:'+ItemValue+'||'); If 0=Pos('Add an image',HTML) Then Begin //If no demand of images then exists poster ItemValue:=TextBetWeen(HTML,BASE_URL_IMAGE_PRE_TRUE,'.',false,curPos); //Get poster code. Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=BASE_URL_IMAGE_PRE + ItemValue + '.jpg' //WEB_SPECIFIC AddImageURL(itPoster,ItemValue); LogMessage(' Get result poster:'+ItemValue+'||'); End; End; //Get ~imdbrating~, ~IMDB_Votes~ curPos:=Pos('',HTML); //WEB_SPECIFIC. If 0','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,',','.',True,True,False); //Decimal comma spanish separator to point english separator. AddFieldValueXML('imdbrating',ItemValue); LogMessage(' Get result imdbrating:'+ItemValue+'||'); ItemValue:=TextBetWeen(HTML,'','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,'.','',True,True,False); //Remove thousand point spanish separator. ItemValue:=StringReplace(ItemValue,',','',True,True,False); //Remove thousand comma english separator. AddCustomFieldValueByName('IMDB_Votes',ItemValue); LogMessage(' Get result IMDB_Votes:'+ItemValue+'||'); End; //Get ~TOP_250~ curPos:=Pos('Top Rated Movies #',HTML); //WEB_SPECIFIC. If 0Director',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('

    ',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ n the ~crew~ endPos:=PosFrom('
    ',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');List+'||'); curPos:=Pos('',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'
    ','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Name:'+Name+'||'); //Get Role NO: PVD don't save Role in crew people AddMoviePerson(Name,'','',PersonURL,ctDirectors); LogMessage(' Get results Director:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctDirectors'); curPos:=PosFrom('',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Go to "Writer:" or "Writers:" ~crew~ctWriters curPos:=Pos('

    Writer',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('

    ',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ n the ~crew~ endPos:=PosFrom('
    ',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');List+'||'); curPos:=Pos('',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Name:'+Name+'||'); //Get Role NO: PVD don't save Role in crew people AddMoviePerson(Name,'','',PersonURL,ctWriters); LogMessage(' Get results Writer:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctWriters'); curPos:=PosFrom('',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Go to "Soundtracks" ~crew~ctComposers curPos:=Pos('
    ',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length('
    '); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ n the ~crew~ endPos:=PosFrom('
    ',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');List+'||'); curPos:=Pos('Composed by',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'
    ','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Name:'+Name+'||'); //Get Role NO: PVD don't save Role in crew people AddMoviePerson(Name,'','',PersonURL,ctComposers); LogMessage(' Get results Composers:#'+IntToStr(index)+'|'+Name+'|'+PersonURL+'||ctComposers'); curPos:=PosFrom('Composed by',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Go to "Producers" ~crew~ctProducers //No Producers in principal page. //Get to "Cast" ~actors~ ctActors //Go Cast list curPos:=Pos('',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length('
    '); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ endPos:=PosFrom('',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');List+'||'); curPos:=Pos('
    ',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Name:'+Name+'||'); //Get Role NO: PVD don't save Role in crew people AddMoviePerson(Name,'','',PersonURL,ctActors); LogMessage(' Get results cast:#'+IntToStr(index)+'|'+Name+'|'+Role+'|'+PersonURL+'||ctActors'); curPos:=PosFrom('',ItemList,curPos); //String which opens the Web Result item List data. WEB_SPECIFIC index:=index+1; End; End; //Get ~description~ curPos:=Pos('',HTML); //WEB_SPECIFIC. If 0','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC AddFieldValueXML('description',ItemValue); LogMessage(' Get result description:'+ItemValue+'||'); End; //Get ~category~ "keywords" (field with several values in a comma separated list) curPos:=Pos('

    Plot Keywords:

    ',HTML); //WEB_SPECIFIC.IC. If 0Plot Keywords:','Taglines:',HTML); //WEB_SPECIFIC. If 0Taglines:','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC AddFieldValueXML('tagline',ItemValue); LogMessage(' Get result tagline:'+ItemValue+'||'); End; //Get ~genre~ (field with several values in a comma separated list) curPos:=Pos('

    Genres:

    ',HTML); //WEB_SPECIFIC. If 0Genres:','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,'|',',',True,True,False); //Change the separator to comma AddFieldValueXML('genre',ItemValue); LogMessage(' Get results Genre:'+ItemValue+'||'); End; //Get ~mpaa~. GET_FULL_MPAA = False only the info of the principal movie page. If Not(GET_FULL_MPAA) Then Begin //The text can be "Certificate:" or "Motion Picture Rating" but alway after genres. If 0','
    ',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC AddFieldValueXML('mpaa',ItemValue); LogMessage(' Get result mpaa:'+ItemValue+'||'); End; End; //Get ~country~ (several values in a comma separated list) curPos:=Pos('

    Country:

    ',HTML); //WEB_SPECIFIC. If 0Country:','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,'|',',',True,True,False); //Change the separator to comma AddFieldValueXML('country',ItemValue); LogMessage(' Get results Country:'+ItemValue+'||'); End; //Get ~origlang~ (several values in a comma separated list) curPos:=Pos('

    Language:

    ',HTML); //WEB_SPECIFIC. if 0Language:','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC //ItemValue:=StringReplace(ItemValue,'|',',',True,True,False); //Change the separator to comma ItemValue:=StringReplace(ItemValue, ' | ', ', ', true, false, true); AddFieldValueXML('origlang',ItemValue); LogMessage(' Get results Language:'+ItemValue+'||'); end; //Get ~rdate~ in contry provider local IP geolocation. See: http://sobizarre-en.blogspot.fr/2014/12/how-to-easily-defeat-imdb-geolocation.html curPos:=Pos('

    Release Date:

    ',HTML); //WEB_SPECIFIC If 0Release Date:','(',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,'January','1',true,true,true); //Format web corrections. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,'February','2',true,true,true); ItemValue:=StringReplace(ItemValue,'March','3',true,true,true); ItemValue:=StringReplace(ItemValue,'April','4',true,true,true); ItemValue:=StringReplace(ItemValue,'May','5',true,true,true); ItemValue:=StringReplace(ItemValue,'June','6',true,true,true); ItemValue:=StringReplace(ItemValue,'July','7',true,true,true); ItemValue:=StringReplace(ItemValue,'August','8',true,true,true); ItemValue:=StringReplace(ItemValue,'September','9',true,true,true); ItemValue:=StringReplace(ItemValue,' October ',' 10 ',true,true,true); ItemValue:=StringReplace(ItemValue,' November ',' 11 ',true,true,true); ItemValue:=StringReplace(ItemValue,' December ',' 12 ',true,true,true); //ItemValue:=StringReplace(ItemValue, ' ', '.', true, false, true); ItemValue:=StringReplace(ItemValue, ' ', #46, true, false, true); AddFieldValueXML('rdate',ItemValue); AddCustomFieldValueByName('Imdb Release Date',ItemValue); LogMessage(' Get results Release Date:'+ItemValue+'||'); End; //Get ~aka~. GET_FULL_AKA = False only the info of the principal movie page. If Not(GET_FULL_AKA) Then Begin curPos:=Pos('

    Also Known As:

    ',HTML); //WEB_SPECIFIC If 0Also Known As:','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC AddFieldValueXML('aka',ItemValue); LogMessage(' Get result aka:'+ItemValue+'||'); End; End; //Get ~budget~ curPos:=Pos('

    Budget:

    ',HTML); //WEB_SPECIFIC If 0Budget:','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(TextBetWeen(HTML,'

    Budget:

    ','<',false,curPos),',','.',true, false, true); ItemValue:=StringReplace(ItemValue,#36,'',True,True,False); //Eliminate '$' if exists //ItemValue:=StringReplace(ItemValue,',','.',True,True,False); //Eliminate ',' if exists AddFieldValueXML('budget',ItemValue); AddCustomFieldValueByName('Imdb Budget',#36+ItemValue); LogMessage(' Get results Budget:'+ItemValue+'||'); End; //Get ~money~ Gross USA curPos:=Pos('

    Gross USA:

    ',HTML); //WEB_SPECIFIC If 0Gross USA:','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(TextBetWeen(HTML,'

    Gross USA:

    ',', <',false,curPos),',','.',true, false, true); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,#36,'',True,True,False); //Eliminate '$' if exists //ItemValue:=StringReplace(ItemValue,',','.',True,True,False); //Eliminate ',' if exists AddFieldValueXML('money',ItemValue); AddCustomFieldValueByName('Gross USA:',#36+ItemValue); LogMessage(' Get results Gross USA:'+ItemValue+'||'); End; //Get ~money~ Box Office worldwide curPos:=Pos('

    Cumulative Worldwide Gross:

    ',HTML); //WEB_SPECIFIC //curPos:=Pos('

    Cumulative Worldwide Gross:

    $',HTML); //WEB_SPECIFIC If 0Cumulative Worldwide Gross:','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(TextBetWeen(HTML,'

    Cumulative Worldwide Gross:

    ',', <',false,curPos),',','.',true, false, true); //Strings which opens/closes the data. WEB_SPECIFIC //ItemValue:=StringReplace(ItemValue,#36,'',True,True,False); //Eliminate '$' if exists ItemValue:=StringReplace(ItemValue,', ','',True,True,False); //Eliminate ',' if exists //AddFieldValueXML('money',ItemValue); AddCustomFieldValueByName('Imdb Box Office:',ItemValue); LogMessage(' Get results Box Office worldwide:'+ItemValue+'||'); End; //Get ~studio~ "Production Co" (several values in a comma separated list) curPos:=Pos('

    Production Co:

    ',HTML); //WEB_SPECIFIC.IC. If 0Production Co:','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=StringReplace(ItemValue,'See more','',True,True,False); //Eliminate 'See more' if exists AddFieldValueXML('studio',ItemValue); LogMessage(' Get results Studio/Production Co:'+ItemValue+'||'); End; //Get ~lenght~ (User option GET_LENGTH) //If GET_LENGTH Then Begin curPos:=Pos('

    Runtime:

    ',HTML); //WEB_SPECIFIC. If 0',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemValue:=TextBetWeen(HTML,'M">',' min',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC //AddFieldValueXML('lenght',IntToStr(StrToInt(ItemValue)*60)); AddFieldValue(mfDuration,ItemValue); AddCustomFieldValueByName('IMDB_Run Time',ItemValue); LogMessage(' Get result lenght:'+ItemValue+'||'); End; //End; //Get ~sound mix~ (several values in a comma separated list) curPos:=Pos('

    Sound Mix:

    ',HTML); if 0Sound Mix:','',false,curPos), false); ItemValue:=StringReplace(ItemValue,'| ',',',True,True,False); AddCustomFieldValueByName('Sound Mix:',ItemValue); LogMessage(' Get results Sound Mix:'+ItemValue+'||'); end; //Get ~color~ (several values in a comma separated list) curPos:=Pos('

    Color:

    ',HTML); if 0Color:','',false,curPos); AddCustomFieldValueByName('Color:',ItemValue); LogMessage(' Get results Color:'+ItemValue+'||'); end; //Get ~aspect ratio~ (several values in a comma separated list) curPos:=Pos('

    Aspect Ratio:

    ',HTML); if 0Aspect Ratio: ','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC //ItemValue:=StringReplace(ItemValue,'|',',',True,True,False); //ItemValue:=StringReplace(ItemValue, '/ (high definition)', ' HD', true, false, true); //ItemValue:=StringReplace(ItemValue, '16:9 HD', '16 : 9 HD', true, false, true); //ItemValue:=StringReplace(ItemValue, '4:3', '4 : 3', true, false, true); //ItemValue:=StringReplace(ItemValue, '2.55: 1', '2.55 : 1', true, false, true); //ItemValue:=StringReplace(ItemValue, '2.39: 1', '2.39 : 1', true, false, true); //ItemValue:=StringReplace(ItemValue, '2.39:1', '2.39 : 1', true, false, true); //ItemValue:=StringReplace(ItemValue, '2.40:1', '2.40 : 1', true, false, true); AddCustomFieldValueByName('Imdb Aspect Ratio',ItemValue); LogMessage(' Get results Aspect Ratio:'+ItemValue+'||'); end; Result:=prFinished; LogMessage('Function ParsePage_IMDBMovieBASE END=====================||'); End; //BlockClose Function ParsePage_IMDBMovieAKA(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prFinished; Script has finished gathering data // Result:=prError; If not results //Retrieve: ~aka~ "Also Known As" Var curPos,endPos,index:Integer; ItemValue,ItemList:String; ItemArray: TWideArray; Begin LogMessage('Function ParsePage_IMDBMovieAKA BEGIN=====================||'); //Get ~aka~ (several values in a line break separated list) Be careful don't repeat //Go to "Also Known As" curPos:=Pos('

    Also Known As (AKA)',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('

    ',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" list aka for create good values separators endPos:=PosFrom('
    ',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); ItemList:=StringReplace(ItemList,'',';',True,True,False); //WEB_SPECIFIC //Get all aka list (NOT necesary in raw because: Several couple of valors (Country/title) but the first is the original title ItemList:=RemoveTags(ItemList, False); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');List+'||'); ExplodeString(ItemList,ItemArray,';'); ItemValue:=''; For index:=(Low(ItemArray)+1) To (High(ItemArray)/2) Do Begin //Remember index begin in 0 If index=1 Then Begin // The first is the original title. WEB_SPECIFIC AddFieldValueXML('origtitle',ItemArray[(index*2-1)]); LogMessage(' Get result origtitle:'+ItemArray[(index*2-1)]+'||'); End Else Begin //Verify if we get before the same title If Pos(ItemArray[(index*2-1)],ItemValue)=0 Then ItemValue:=ItemValue+'
    '+ItemArray[(index*2-1)]; End; End; AddFieldValueXML('aka',ItemValue); LogMessage(' Get results aka:'+ItemValue+'||'); Result:=prFinished; LogMessage('Function ParsePage_IMDBMovieAKA END=====================||'); End; //BlockClose Function ParsePage_IMDBMovieCREDIT(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prFinished; Script has finished gathering data // Result:=prError; If not results //Retrieve: ~crew~ctDirectors,ctWriters,ctComposers,ctProducers // ~actors~ ctActors Var curPos,endPos,index:Integer; ItemList:String; Name,Role,PersonURL:String; Begin LogMessage('Function ParsePage_IMDBMovieCREDIT BEGIN=====================||'); //Get ~crew~ctDirectors,ctWriters,ctComposers,ctProducers //Go to "Directed by" ~crew~ctDirectors curPos:=Pos('Directed by',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ n the ~crew~ endPos:=PosFrom('',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||'); curPos:=Pos('',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'
    ',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Go to "Writer:" or "Writers:" ~crew~ctWriters curPos:=Pos('Writing',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ endPos:=PosFrom('',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||'); curPos:=Pos('',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Go to "Producers" ~crew~ctProducers curPos:=Pos('Produced',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ endPos:=PosFrom('',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');; curPos:=Pos('',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Go to "Music" ~crew~ctComposers curPos:=Pos('Music',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ endPos:=PosFrom('',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||');List+'||'); curPos:=Pos('',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'',ItemList,curPos) //String which opens the subList data. WEB_SPECIFIC index:=index+1; End; //Get to "Cast" ~actors~ ctActors //Go Cast list curPos:=Pos('',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length('
    '); //Strings end which opens the block content data. WEB_SPECIFIC //Get all "raw" crew summary (in raw because we need the hidden person links) May one person or severals in the ~crew~ endPos:=PosFrom('',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex ItemList:'+ItemList+'||'); curPos:=Pos('
    ',ItemList) //String which opens the subList data. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>PEOPLE_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Get PersonURL (Always must it has) PersonURL:=BASE_URL_PERSON_PRE + TextBetWeen(ItemList,'','<',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Name:'+Name+'||'); //Get Role Role:=TextBetWeen(ItemList,'','',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Parse Results Role:'+Role+'||'); AddMoviePerson(Name,'',Role,PersonURL,ctActors); LogMessage(' Get results cast:#'+IntToStr(index)+'|'+Name+'|'+Role+'|'+PersonURL+'||ctActors'); curPos:=PosFrom('',ItemList,curPos); //String which opens the Web Result item List data. WEB_SPECIFIC index:=index+1; End; Result:=prFinished; LogMessage('Function ParsePage_IMDBMovieCREDIT END=====================||'); End; //BlockClose Function ParsePage_IMDBMovieAWARDS(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prFinished; Script has finished gathering data // Result:=prError; If not results //Retrieve: AddAward(Event, Award, Category, Recipient, Year, Won) Var curPos,endPos,endPosAux,index,curPos1,curPos2,curPos3,curPos4,endPos1,endPos2:Integer; ItemList:String; ItemArray: TWideArray; EventBlock,AwardBlock,EventName,AwardName,AwardCategory,AwardRecipient,EventYear:String; AwardWon: Boolean; Begin LogMessage('Function ParsePage_IMDBMovieAWARDS BEGIN=====================||'); //Get award (several values save in PVD with AddAward(Event, Award, Category, Recipient, Year, Won) // Parameters: Example Godfather //Event (Academy Awards, USA): Name of the event //Award (Oscar): Best award name //Category (Best Picture): award category //Recipient (Albert S. Rudddy): for movie records this variable should contain the name of a specific person who won the award // for people records the variable should contain the title of a movie for which the person won the award //Year (1973): release year of a movie (only applicable when adding award to a person record) //Won (True,Winner/Nominee) set to true if the recipient won the award and to false otherwise //Go to "Awards" There is 3 levels: 1) Event (with name and year) 2) Award (with outcome-Winner and name) 3) Recipient (award_description and name) curPos:=Pos('

    Awards',HTML); //Strings start which opens the block content data. WEB_SPECIFIC curPos:=PosFrom('

    ',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFIC //Event Level curPos:=PosFrom('' is very inconsistent. WEB_SPECIFIC index:=1; While curPos>0 Do Begin If (index>EVENTS_LIMIT) Then break; //Limited depassed (Remember index begin in 0). //Go back for get the EventName and EventYear (Get all "raw" list data for create good values separators) curPos:=PrevPos('

    ',HTML,curPos); //String which opens the EventName and EventYear list data. WEB_SPECIFIC endPos:=PosFrom('

    ',HTML,curPos)+Length(''); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(HTML,curPos,endPos-curPos); ItemList:=StringReplace(ItemList,'year','>;<',True,True,False); //WEB_SPECIFIC ItemList:=RemoveTags(ItemList, False); ExplodeString(ItemList,ItemArray,';'); EventName:=ItemArray[0]; EventYear:=ItemArray[1]; //Get all "raw" Event data for create good values separators curPos:=PosFrom('
    ',HTML,curPos); //Strings which opens/closes the data. WEB_SPECIFIC EventBlock:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex EventBlock:'+EventBlock+'||'); //Award Level curPos1:=Pos('',EventBlock,curPos1)+Length(''); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(EventBlock,curPos1,endPos1-curPos1); ItemList:=StringReplace(ItemList,'category','>;<',True,True,False); //WEB_SPECIFIC ItemList:=RemoveTags(ItemList, False); //LogMessage(' Parse results ('+IntToStr(curPos1)+','+IntToStr(endPos1)+') complex ItemList:'+ItemList+'||'); ExplodeString(ItemList,ItemArray,';'); AwardWon:= False; //Normaly in 'Nominee' case. WEB_SPECIFIC If Pos('Winner',ItemArray[0])>0 Then AwardWon:= True; //WEB_SPECIFIC AwardName:=ItemArray[1]; //Get all "raw" Award data for create good values separators endPosAux:=PosFrom('',AwardBlock,curPos2)+Length(''); //Strings which opens/closes the data. WEB_SPECIFIC ItemList:=Copy(AwardBlock,curPos2,endPos2-curPos2); //LogMessage(' Parse results ('+IntToStr(curPos2)+','+IntToStr(curPos2)+') complex ItemList:'+ItemList+'||'); //The Receipt awards ItemList may have: 1) empty description or not have name (not interesting) and break ItemArray[]. 2) Several names 3) Detail o full Notes //So is better search sequentily by token in a block than with ItemArray endPosAux:=PosFrom(#13,ItemList,2); //Strings which opens/closes the data. WEB_SPECIFIC curPos3:=PosFrom('name',ItemList,2); //Strings which opens/closes the data. WEB_SPECIFIC If (endPosAux',#13,false,curPos4); //Strings which opens/closes the data. WEB_SPECIFIC End Else Begin AwardCategory:=''; End; If curPos3=0 Then Begin //Award without Recipient AddAward(EventName, AwardName, AwardCategory, '', EventYear, AwardWon); LogMessage(' Get results Awards:#'+IntToStr(index)+'|'+EventName+'|'+AwardName+'|'+AwardCategory+'|'+''+'|'+EventYear+'|'); //+BoolToStr(AwardWon)+'||'); End; While curPos3>0 Do Begin AwardRecipient:=TextBetWeen(ItemList,'>','<',false,curPos3); //Strings which opens/closes the data. WEB_SPECIFIC AddAward(EventName, AwardName, AwardCategory, AwardRecipient, EventYear, AwardWon); LogMessage(' Get results Awards:#'+IntToStr(index)+'|'+EventName+'|'+AwardName+'|'+AwardCategory+'|'+AwardRecipient+'|'+EventYear+'|'); //+BoolToStr(AwardWon)+'||'); endPosAux:=PosFrom('note',ItemList,curPos3); //Strings which opens/closes the data. WEB_SPECIFIC curPos3:=PosFrom('name',ItemList,curPos3); //Strings which opens/closes the data. WEB_SPECIFIC If curPos3>endPosAux Then curPos3:=0 //Avoid Names in notes. WEB_SPECIFIC End; curPos2:=PosFrom('',HTML)) Then Begin //WEB_SPECIFIC mpaaValue:=TextBetWeenFirst(HTML,'',''); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' MPAA:'+mpaaValue+'||'); End Else If (0'); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' MPAA.USA:'+mpaaValue+'||'); End; //Corrections of string and standarize the result mpaaValue:=StringReplace(mpaaValue,' -','-',False,False,True); //Avoid spaces between arround '-' mpaaValue:=StringReplace(mpaaValue,'- ','-',False,False,True); //Avoid spaces between arround '-' If (1=Pos(': ',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,': ','',False,False,True); //Avoid the initial ':' in Official or Suggested (there are ' : ' and ': '). mpaaValue:=StringReplace(mpaaValue,'Suggested Rating','. Suggested Rating',False,False,False); //Avoid union in films with 'Suggested Rating' If (mpaaValue='Approved') Then mpaaValue:='Rated G'; If (mpaaValue='Passed') Then mpaaValue:='Rated G'; If (1=Pos('G',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'G','Rated G',False,False,True); If (1=Pos('PG',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'PG','Rated PG',False,False,True); If (1=Pos('TV-PG',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'TV-PG','Rated PG',False,False,True); If (1=Pos('PG-13',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'PG-13','Rated PG-13',False,False,True); If (1=Pos('"PG-13"',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'"PG-13"','Rated PG-13',False,False,True); If (1=Pos('TV-14',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'TV-14','Rated PG-13',False,False,True); If (1=Pos('NC-17',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'NC-17','Rated NC-17',False,False,True); If (1=Pos('R ',mpaaValue)) Then mpaaValue:=StringReplace(mpaaValue,'R ','Rated R ',False,False,True); If (mpaaValue='R') Then mpaaValue:='Rated R'; LogMessage(' MPAA.USA.Corrected:'+mpaaValue+'||'); //Not or bad MPAA USA then get Spain certification (if exist) and convert in USA-KODI values if ((mpaaValue='') or (0',false,curPos); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' MPAA.Spain.Original:'+mpaaValue+'||'); if (mpaaValue='T') or (mpaaValue='T/i') or (mpaaValue='7') or (mpaaValue='7/i') then mpaaValue:='Rated G'; If (mpaaValue='12') Or (mpaaValue='13') Then mpaaValue:='Rated PG-13'; If (mpaaValue='16') Then mpaaValue:='Rated NC-17'; If (mpaaValue='18') Then mpaaValue:='Rated R'; LogMessage(' MPAA.Spain.Converted:'+mpaaValue+'||'); End; AddFieldValueXML('mpaa',mpaaValue); LogMessage(' Get result MPAA='+mpaaValue+'||'); Result:=prFinished; LogMessage('Function ParsePage_IMDBMovieMPAA END=====================||'); End; //BlockClose //USER FUNCTIONS AND PROCEDURES==================================================================================BlockClose //OBLIGATORY CALLBACK PRINCIPAL FUNCTION=========================================================================BlockOpen Function ParsePage(HTML:String;URL:AnsiString):Cardinal; //BlockOpen Var MovieID,titleValue,yearValue:String; Begin LogMessage('Function ParsePage BEGIN======================|'); LogMessage('Global Var-Mode|'+IntToStr(Mode)+'|'); LogMessage('Global Var-DownloadURL|'+DownloadURL+'|'); LogMessage('Local Var-URL|'+URL+'|'); //Parse return in mode 'Search Movie URL'-------------------------------------------------------------------------------- If (Mode=smSearch) Then Begin titleValue:=GetFieldValueXML('origtitle'); If (Length(titleValue)=0) Then titleValue:=GetFieldValueXML('title'); yearValue:=GetFieldValueXML('year'); If yearValue='0' Then yearValue:=''; // Better no Year (blank) for the searches. LogMessage(' ParsePage smSearch|'+IntToStr(Mode)+'|. Searching DownloadURL for MovieTitle |'+ titleValue+'|'+' MovieYear |'+ yearValue+'|'); //Download Provider search page. DownloadURL:=StringReplace(BASE_URL_SEARCH_PROV,'%s',titleValue,True,True,False); DownloadURL:=StringReplace(DownloadURL,' ','+',True,True,False); //Better list of results without spaces. DownloadURL:=StringReplace(DownloadURL,'%y',yearValue,True,True,False); LogMessage(' Searching in Provider:|' + DownloadURL + '||'); HTML:=DownloadPage(DownloadURL); //True page for parsing the search //HTML:=FileToString( GetAppPath + '\Scripts\IMDB_[EN][HTTPS].v.1.0.0.0\' + 'V.1.0.0.0-IMDb-[Advanced.Search]-Padrino.htm'); //Debug HTML:=HTMLToText(HTML); Result:=ParsePage_IMDBSearchTitle(HTML); If ((Result=prError) and SEARCH_ENGINE) Then Begin //No results or Redirection -> Search Engine needed LogMessage(' Not results or Redirection in Provider search, try with Bing'); //Download Bing search page. DownloadURL:=StringReplace(BASE_URL_SEARCH_ENGI,'%p',BASE_URL_PRE_TRUE,True,True,False); //WEB_SPECIFIC DownloadURL:=StringReplace(DownloadURL,'%s',titleValue,True,True,False); //WEB_SPECIFIC DownloadURL:=StringReplace(DownloadURL,' ','+',True,True,False); //Better list of results without spaces. WEB_SPECIFIC DownloadURL:=StringReplace(DownloadURL,'%y',yearValue,True,True,False); //WEB_SPECIFIC LogMessage(' Searching in Bing:|' + DownloadURL + '||'); HTML:=DownloadPage(DownloadURL); //True page for parsing the search HTML:=HTMLToText(HTML); Result:=ParsePage_BingSearch(HTML); End; //Parse the returned result of the search list. If Result=prError Then Begin LogMessage('Function ParsePage prError END======================|'); exit; //Not movie found, script finish in error. End; If Result=prList Then Begin Mode:=smSearchList; //One list of results loaded, needed user choice exit in the script mode. LogMessage('Function ParsePage smSearchList END======================|'); exit; End; If Result=prDownload Then Mode:=smNormal; //One results, not exit needed only continue the script. End; //Parse return of 'SearchList Movie URL'----------------------------------------------------------------------- If (Mode=smSearchList) Then Begin //The user have choose the link. LogMessage(' ParsePage mode smSearchList. Getting DownloadURL from the return of smSearchList'); DownloadURL:=StringReplace(URL,CHEAT_PREFIX_URL,'',True,False,False); //Eliminate the CHEAT_PREFIX_URL for get the true movie link DownloadURL:=StringReplace(DownloadURL,'http','https',True,True,False); //The direct url needed (no https redirection) DownloadURL:=StringReplace(DownloadURL,'httpss','https',True,True,False); //The direct url needed (no https redirection) LogMessage(' Global Var-DownloadURL|'+DownloadURL+'|'); Mode:=smNormal; Result:=prDownload; //But not exit needed for download the page because is HTTPS LogMessage(' With the good movie URL it demand download the movie page'); End; //Parse with the Movie URL 'smNormal'------------------------------------------------------------------------------------ If (Mode=smNormal) Then Begin //Information in several page. Needs Provider MovieID MovieID:=TextBetWeenFirst(DownloadURL,BASE_URL_PRE_TRUE,BASE_URL_SUF); LogMessage(' ParsePage mode smNormal|'+IntToStr(Mode)+'|. Getting provider data for MovieID|'+ MovieID +'|'); //Get ~url~ AddFieldValueXML('url',StringReplace(DownloadURL,BASE_URL_PRE_TRUE,BASE_URL_PRE,True,False,False)); LogMessage(' Get result url:'+StringReplace(DownloadURL,BASE_URL_PRE_TRUE,BASE_URL_PRE,True,False,False)+'||'); //Parse principal provider page = BASE_URL_PRE_TRUE------------------------------------------------------------------ HTML:=DownloadPage(DownloadURL); //True page for parsing HTML:=HTMLToText(HTML); Result:=ParsePage_IMDBMovieBASE(HTML); //Parse Also Known As provider page = BASE_URL_AKA------------------------------------------------------------------- If GET_FULL_AKA Then Begin DownloadURL:=StringReplace(BASE_URL_AKA,'%IMDB_ID',MovieID,True,True,False); HTML:=DownloadPage(DownloadURL); //True page for parsing HTML:=HTMLToText(HTML); Result:=ParsePage_IMDBMovieAKA(HTML); End; //Parse Cast provider page = BASE_URL_CAST--------------------------------------------------------------------------- If GET_FULL_CREDIT Then Begin DownloadURL:=StringReplace(BASE_URL_CAST,'%IMDB_ID',MovieID,True,True,False); HTML:=DownloadPage(DownloadURL); //True page for parsing HTML:=HTMLToText(HTML); Result:=ParsePage_IMDBMovieCREDIT(HTML); End; //Parse Awards provider page = BASE_URL_AWARDS----------------------------------------------------------------------- If GET_FULL_AWARDS Then Begin DownloadURL:=StringReplace(BASE_URL_AWARDS,'%IMDB_ID',MovieID,True,True,False); HTML:=DownloadPage(DownloadURL); //True page for parsing HTML:=HTMLToText(HTML); Result:=ParsePage_IMDBMovieAWARDS(HTML); End; //Parse Certification provider page = BASE_URL_MPAA------------------------------------------------------------------ If GET_FULL_MPAA Then Begin DownloadURL:=StringReplace(BASE_URL_MPAA,'%IMDB_ID',MovieID,True,True,False); HTML:=DownloadPage(DownloadURL); //True page for parsing HTML:=HTMLToText(HTML); Result:=ParsePage_IMDBMovieMPAA(HTML); End; //Date ~Updated~ (choose simple or verbose version) //AddFieldValueXML('viewdate',DateToStr(CurrentDateTime)); //Only date, don't admit time-. Set Seen value at the same time. //AddFieldValueXML('moddate',DateToStr(CurrentDateTime)+' '+TimeToStr(CurrentDateTime)); //Block the dB saving //AddCustomFieldValueByName('Updated',DateToStr(CurrentDateTime)); // Simple //AddCustomFieldValueByName('Updated',DateToStr(CurrentDateTime)+' at '+TimeToStr(CurrentDateTime)); // Verbose AddCustomFieldValueByName('Updated',DateToStr(CurrentDateTime)+' at '+TimeToStr(CurrentDateTime)+' • '+SCRIPT_NAME+' '+SCRIPT_VERSION); // Annoying LogMessage(' Provider data info retreived Ok in '+DateToStr(CurrentDateTime)+' '+TimeToStr(CurrentDateTime)+'|'); Result:=prFinished; LogMessage('Function ParsePage NORMAL END======================|'); exit; End; //Parse with unknow mode----------------------------------------------------------------------------------------------- Result:=prError; exit; End; //BlockClose //OBLIGATORY CALLBACK PRINCIPAL FUNCTION=========================================================================BlockClose
    0 Do Begin //Get AwardWon and AwardName endPos1:=PosFrom('',AwardBlock); //String which opens the AwardCategory and AwardRecipient list data. WEB_SPECIFIC While curPos2>0 Do Begin //Get all "raw" list data for create good values separators (not use TextBetWeen) endPos2:=PosFrom('',AwardBlock,endPos2); //String which opens the AwardCategory and AwardRecipient list data. WEB_SPECIFIC End; curPos1:=PosFrom('' is very inconsistent. WEB_SPECIFIC index:=index+1; End; Result:=prFinished; LogMessage('Function ParsePage_IMDBMovieAWARDS END=====================||'); End; //BlockClose Function ParsePage_IMDBMovieMPAA(HTML:String):Cardinal; //BlockOpen //Returns: // Result:=prFinished; Script has finished gathering data // Result:=prError; If not results //Retrieve: ~MPAA~ Var curPos:Integer; mpaaValue:String; Begin LogMessage('Function ParsePage_IMDBMovieMPAA BEGIN=====================||'); mpaaValue:=''; //Get ~MPAA~ from IMDB If (0'); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Official MPAA Rating:'+mpaaValue+'||'); End Else If (0'); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Suggested MPAA Rating:'+mpaaValue+'||'); End Else If (0'); //Strings which opens/closes the data. WEB_SPECIFIC LogMessage(' Suggested updated MPAA rating:'+mpaaValue+'||'); End Else If (0MPAAMPAA