(* SCRIPT INFO: Following until 'SCRIPT BEGINS HERE...' is documentation. Please see 'USER OPTIONS' in the body of the script. --------------------------------------------- SCRIPT: Imdb Movie(awards) Script AUTHOR: Ivek23 CO-AUTHORS: VVV_Easy VERSION: 0.1.1.3 NEW_VERSION: 0.2.0.0 DATE: 25/06/2017 UPDATE: 26/05/2018 --------------------------------------------- TYPES AND FUNCTIONS Additional types and functions that can be used in scripts: Types TWIDEARRAY : array of String Field functions procedure AddSearchResult(Title1, Title2, Year, URL, PreviewURL : String) procedure AddFieldValue(AField: Integer; AValue : String) procedure AddMoviePerson(Name, TransName, Role, URL : String; AType : Byte) procedure AddPersonMovie(Title, OrigTitle, Role, Year, URL : String; AType : Byte) procedure AddAward(Event, Award, Category, Recipient, Year: String; const Won : Boolean) procedure AddAwardEx(Event, Award, Category, RecipientVal1, RecipientVal2, Year : String; const Won : Boolean); procedure AddConnection(Title, OrigTitle, Category, URL, Year: String) procedure AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode : String) String functions function Pos(Substr : String; Str: String): Integer function PosFrom(const SubStr, Str : String; FromIndex : Integer) : Integer function LastPos(const SubStr, Str : String) : Integer function PrevPos(const SubStr, Str : String; APos : Integer) : Integer function RemoveTags(AText : String; doLineBreaks : Boolean) : String function ExplodeString(AText : String; var Items : TWideArray; Delimiters : String) : Integer function Copy(S: String; Index, Count: Integer): String procedure Delete(var S: String; Index, Count: Integer) procedure Insert(Source: String; var Dest: String; Index: Integer) function Length(S: String): Integer function Trim(S: String): String function CompareText(S1, S2: String): Integer function CompareStr(S1, S2: String): Integer function UpperCase(S: String): String function LowerCase(S: String): String function AnsiString(S, OldPattern, NewPattern: String; All : Boolean; IgnoreCase : Boolean; WholeWord: Boolean): String function StrToInt(const S: String): Integer function IntToStr(const Value: Integer): String function StrToFloat(const S: String): Extended function FloatToStr(const Value: Extended): String function CurrentDateTime : Extended function DateToStr(Value : Extended) : String function TimeToStr(Value : Extended) : String function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String function HTMLValues2(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String function TextBetween(const HTML : String; ABegin, AEnd : String; doLineBreaks : Boolean; var Pos : Integer) : String function HTMLToText(const HTML : String) : String procedure ShowMessage(const Msg, Head : String) *) //SCRIPT BEGINS HERE... //Some useful constants const //Script types stMovies = 0; stPeople = 1; stPoster = 2; ///Script modes smSearch = 0; smNormal = 1; smCast = 2; smReview = 3; smCredits = 4; smSoundtracks = 5; smPoster = 6; smFinished = 7; //Parse results prError = 0; prFinished = 1; prList = 2; prListImage = 3; prDownload = 4; //Prefix modes pmNone = 0; pmEnd = 1; pmBegin = 2; pmRemove = 3; //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; mfTags = 11; mfTagline = 12; mfDescription = 13; mfDuration = 14; mfFeatures = 15; //People fields pfURL = 0; pfName = 1; pfTransName = 2; pfAltNames = 3; pfBirthday = 4; pfBirthplace = 5; pfGenre = 6; pfBio = 7; pfDeathDate = 8; //Credits types ctActors = 0; ctDirectors = 1; ctWriters = 2; ctComposers = 3; ctProducers = 4; //Script data SCRIPT_VERSION = '0.2.0.0'; SCRIPT_NAME = 'Imdb Movie Script(awards)'; SCRIPT_DESC = '[EN] Get Movie Information from Imdb.com(awards)'; SCRIPT_LANG = $09; //English SCRIPT_TYPE = stMovies; BASE_URL = 'http://www.imdb.com'; RATING_NAME = 'Imdb Movie Script'; SEARCH_STR = 'http://www.imdb.com/find?q=%s&s=tt'; CODE_PAGE = 65001; //Use 0 for Autodetect //User Options GET_THEMES = True; //Set to False to ensure ~mfCategory~ not added even if 'Overwrite fields' setting allows GET_POSTER = False; //Set to False or True EVENTS_LIMIT = 101; //Limit of number of events (USA Academy Awards, Golden Globes, etc) to retrive awards. //Script settings //Global variables var ELI : Integer; fullinfo : String; Mode : Byte; ExtraLinks : array [smCast..smPoster] of String; //Functions function GetScriptVersion : String; begin Result := SCRIPT_VERSION; end; function GetScriptName : String; begin Result := SCRIPT_NAME; end; function GetScriptDesc : String; begin Result := SCRIPT_DESC; end; function GetRatingName : String; begin Result := RATING_NAME; end; function GetScriptLang: Cardinal; begin Result := SCRIPT_LANG; end; function GetCodePage : Cardinal; begin Result := CODE_PAGE; end; function GetBaseURL : AnsiString; begin Result := BASE_URL; end; function GetDownloadURL : AnsiString; begin if (Mode = smSearch) then Result := SEARCH_STR else Result := ExtraLinks[Mode]; end; function GetDownloadMethod : Byte; begin Result := dmGET; end; function GetPrefixMode : Byte; begin Result := pmBegin; end; function GetScriptType : Byte; begin Result := SCRIPT_TYPE; end; function GetCurrentMode : Byte; begin Result := Mode; end; function RemoveTagsEx1(AText : String) : String; var B, E : Integer; begin Result := AText; B := PosFrom('
', Result, B); while (B > 0) AND (B < E) do begin Delete(Result, B, E - B + 3); B := Pos('', Result); end; end; function RemoveTagsEx2(AText : String) : String; var B, E : Integer; begin Result := AText; B := PosFrom('
"', Result, 2); E := PosFrom('."
', Result, B); while (B > 0) AND (B < E) do begin Delete(Result, B, E - B + 2); B := Pos('
"', Result); E := Pos('."
', Result); end; end; function RemoveTagsEx3(AText : String) : String; var B, E : Integer; begin Result := AText; B := PosFrom('

', Result, 39); E := PosFrom('More

', Result, B); while (B > 0) AND (B < E) do begin Delete(Result, B, E - B + 39); B := Pos('

', Result); E := Pos('More

', Result); end; end; function RemoveTagsEx4(AText : String) : String; var B, E : Integer; begin Result := AText; B := PosFrom('

', Result, 16); E := PosFrom('

', Result, B); while (B > 0) AND (B < E) do begin Delete(Result, B, E - B + 16); B := Pos('

', Result); E := Pos('

', Result); end; end; procedure ParseMovie(MovieURL : String; HTML : String); var curPos, endPos, debug_pos1, urlPos, urlendPos,startPos, lastPos, nextStart, nextEnd, i, j : Integer; Category7, Category6, Category5, Category4, Category3, Category2, Category1, tmpstring1, pURL1, Event1, pName1, Name1, Cat1, Year1, HTML1, tmpstring, pURL, awEvent, pName, awName, awCat, awYear, awHTML : String; awWon, Won: Boolean; names, categories, recipients : TWideArray; Date : String; DateParts: TWideArray; endPosAux,index,curPos1,curPos2,curPos3,curPos4,endPos1,endPos2:Integer; ItemValue,ItemList:String; ItemArray: TWideArray; MovieID,titleValue:String; Name,Role,PersonURL,mpaaValue,PathValue:String; EventBlock,AwardBlock,EventName,AwardName,AwardCategory,AwardRecipient,EventYear:String; AwardWon: Boolean; begin //Date ~Updated~ (choose simple or verbose version) Date := DateToStr(CurrentDateTime); if Date <> '' then begin ExplodeString(Date, DateParts, '-'); Date := DateParts[2] +'.'+ DateParts[1] +'.'+ DateParts[0]; Date := StringReplace(Date, '01.', '1.', True, True, False); Date := StringReplace(Date, '02.', '2.', True, True, False); Date := StringReplace(Date, '03.', '3.', True, True, False); Date := StringReplace(Date, '04.', '4.', True, True, False); Date := StringReplace(Date, '05.', '5.', True, True, False); Date := StringReplace(Date, '06.', '6.', True, True, False); Date := StringReplace(Date, '07.', '7.', True, True, False); Date := StringReplace(Date, '08.', '8.', True, True, False); Date := StringReplace(Date, '09.', '9.', True, True, False); //AddCustomFieldValueByName('IUpdated', Date); // Simple //AddCustomFieldValueByName('Updated',Date+' at '+TimeToStr(CurrentDateTime)); // Verbose AddCustomFieldValueByName('Updated0',Date+' at '+TimeToStr(CurrentDateTime)+' '+#8226+' '+SCRIPT_NAME+' '+SCRIPT_VERSION); // Annoying end else LogMessage('date not found'); fullinfo := fullinfo; MovieURL := StringReplace(MovieURL, 'fullcredits', '', true, false, true); MovieURL := StringReplace(MovieURL, 'combined', '', true, false, true); MovieURL := StringReplace(MovieURL, 'taglines', '', true, false, true); MovieURL := StringReplace(MovieURL, 'releaseinfo', '', true, false, true); MovieURL := StringReplace(MovieURL, 'soundtrack', '', true, false, true); MovieURL := StringReplace(MovieURL, 'technical', '', true, false, true); MovieURL := StringReplace(MovieURL, 'externalsites', '', true, false, true); MovieURL := StringReplace(MovieURL, 'awards', '', true, false, true); AddFieldValueXML('url', MovieURL); GetFieldValueXML('url'); //MovieID := StringReplace(MovieURL, 'http://www.imdb.com/title/', '', false, false, false ); //MovieID := StringReplace(MovieID, '?ref_=fn_tt_tt_', '', true, false, true); //~Awards 0~ //If Pos('Connections', HTML) > 0 then begin //EndPos := Pos('

Connections

', HTML); If Pos('', HTML) > 0 then begin curPos := Pos('', HTML); EndPos := curPos; Category7 := TextBetween(HTML, '', '', True, curPos); Category7 := StringReplace(Category7, ' ', #32#32#8226#32#32, true, false, true); Category7 := StringReplace(Category7, ' ', #32#32, true, false, true); Category7 := StringReplace(Category7, 'Another ', 'Another ', true, false, true); Category7 := StringReplace(Category7, '.', '', true, false, true); Category6 := TextBetween(HTML, '', 'class="btn-full" >See more awards', True, curPos); Category6 := StringReplace(Category6, 'See more awards', true, false, true); //Category6 := StringReplace(Category6, ',', '.', true, false, true); if Category6 = '' then Category6 := Category7 else Category6 := Category7+#32#32#8226#32#32+Category6; AddCustomFieldValueByName('IMDb Movie Awards1', Category6); curPos := EndPos; end; //~Awards 2~ //If Pos('Connections', HTML) > 0 then begin //EndPos := Pos('

Connections

', HTML); If Pos('', HTML) > 0 then begin curPos := Pos('', HTML); EndPos := curPos; Category2 := TextBetween(HTML, '', '', True, curPos); Category2 := StringReplace(Category2, ' ', #13#10, true, false, true); //Category2 := StringReplace(Category2, ' ', #32#32#8226#32#32, true, false, true); Category2 := StringReplace(Category2, ' ', #32#32, true, false, true); Category2 := StringReplace(Category2, 'Another ', 'Another ', true, false, true); Category2 := StringReplace(Category2, '.', '', true, false, true); Category1 := TextBetween(HTML, '', 'class="btn-full" >See more awards
', True, curPos); Category1 := StringReplace(Category1, 'See more awards', true, false, true); //Category1 := StringReplace(Category1, ',', '.', true, false, true); //AddCustomFieldValueByName('IMDb Movie Awards2', Category1); fullinfo := fullinfo+Category1+#32#32; curPos := EndPos; end; fullinfo := fullinfo; //Get ~Awards URL~ endPos := Pos('class="quicklink" >Awards', HTML); if endPos > 0 then begin curPos := PrevPos('Awards', HTML); if endPos > 0 then begin curPos := PrevPos('Awards link'); end; // TmpStr := HTMLValues(HTML,'

characteristics

', '', //ItemEnd was '
' '>- ', '
',', ', endPos); // ExtraLinks[smSoundtracks] := ExtraLinks[smSoundtracks] + 'Awards'; // If ExtraLinks[smSoundtracks] <> '' then AddCustomFieldValueByName('IMDb Movie Url', 'Awards'); fullinfo := fullinfo; //~Awards~ If Pos('

Awards

', HTML) > 0 then begin //EndPos := Pos('

Awards

', HTML); curPos := PosFrom('
', HTML, EndPos); if curPos > 0 then begin curPos := curPos + Length('')-149; //)-261; //)-150; EndPos := PosFrom('

See also

', HTML, curPos)+77; //Category1 := Copy(HTML, curPos, endPos - curPos); Category1 := Trim(Copy(HTML, curPos, endPos - curPos)); //if Category1 <> '' then AddCustomFieldValueByName('IMDb Movie Awards5', Category1); end; end; //~Awards 3~ If Pos('

Awards

', HTML) > 0 then begin EndPos := Pos('

Awards

', HTML); curPos := PosFrom('

Awards

', HTML, EndPos); if curPos > 0 then begin //EndPos := curPos; Category3 := HTMLValues(HTML,'

Awards

','

See also

','

','

',#13#32#32#160#160#160#8226#32#32, endPos); if Category3 <> '' then AddCustomFieldValueByName('IMDb Movie Awards3', #160#9679#32#160+''+Category4+''+#13#32#32#160#160#160#8226#32#32+Category3); //if Category3 <> '' then AddCustomFieldValueByName('IMDb Movie Awards3', #160#9679#32#160+Category4+#13#32#32#160#160#160#8226#32#32+Category3); end; end; //~Awards 1~ If Pos('

Awards

', HTML) > 0 then begin //EndPos := Pos('

Awards

', HTML); curPos := PosFrom('', HTML, EndPos); if curPos > 0 then begin curPos := curPos + Length('')-149; //)-261; //)-150; EndPos := PosFrom('

See also

', HTML, curPos)+77; //Category1 := Copy(HTML, curPos, endPos - curPos); Category1 := Trim(Copy(HTML, curPos, endPos - curPos)); if Category1 <> '' then AddCustomFieldValueByName('IMDb Movie Awards5', Category1); end; end; //~Awards 4~ If Pos('

Awards

', HTML) > 0 then begin EndPos := Pos('

Awards

', HTML); Category5 := HTMLValues(HTML,'

Awards

', '

See also

', '','
', endPos); Category5 := RemoveTagsEx(Category5); Category5 := RemoveTagsEx2(Category5); Category5 := RemoveTagsEx3(Category5); Category5 := RemoveTagsEx4(Category5); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, ' ', '', true, false, true); Category5 := StringReplace(Category5, ' ', '', true, false, true); Category5 := StringReplace(Category5, '
Tied with
', ''+#13#32#32#32#32#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, '
', ''+#13#32#32#32#32#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, ')
', ')'+#13#32#32#32#32#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, '
For "', #13#32#32#32#32#32#32#32#32#32#32#32#32+'For "', true, false, true); Category5 := StringReplace(Category5, 'Rip-Off
Rip-Off of', 'Rip-Off'+#13#32#32#32#32#32#32#32#32#32#32#32#32#32#32+'Rip-Off of', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', #13#32#32#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, ') For ', ')'+#13#32#32#32#32#32#32#32#32#32#32#32#32+' For ', true, false, true); Category5 := StringReplace(Category5, ')', ')', true, false, true); Category5 := StringReplace(Category5, ') ', '".', true, false, true); Category5 := StringReplace(Category5, ').
', ').', true, false, true); Category5 := StringReplace(Category5, '".
', '".', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, ' ', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '3> ', '', true, false, true); if Category5 <> '' then AddCustomFieldValueByName('IMDb Movie Awards4', Category5); end; //end; //~Awards 2~ HTML:=HTMLToText(HTML); //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 ecific person who won the award // for people records the variable should contain the title of a movie for which the person won the awarderson 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) Recipient (award_description and name) curPos:=Pos('

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

',HTML,curPos); //Strings end which opens the block content data. WEB_SPECIFICns the block content data. WEB_SPECIFIC curPos:=curPos+Length(''); //Strings end which opens the block content data. WEB_SPECIFICns the block content data. WEB_SPECIFIC //Event Level curPos:=PosFrom('
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, '', #13#32#32#32#9679#32, true, false, true); Category5 := StringReplace(Category5, ' ', #13#32#32#32#32#32#32#32#8226#32, true, false, true); Category5 := StringReplace(Category5, '
For ', #13#32#32#32#32#32#32#32#32#32#32#32#32+'For ', true, false, true); Category5 := StringReplace(Category5, '
', #13#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, '
', '
', true, false, true); Category5 := StringReplace(Category5, '
', '', true, false, true); Category5 := StringReplace(Category5, ' For ', ''+#13#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, ') ', ')'+#13#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, '
', #13#32#32#32#32#32#32#32#32#32#32, true, false, true); Category5 := StringReplace(Category5, ' ', ' ', true, false, true); Category5 := StringReplace(Category5, ' For', ''+#13#32#32#32#32#32#32#32#32#32#32#32#32' For', true, false, true); Category5 := StringReplace(Category5, '
' is very inconsistent. WEB_SPECIFICoses the Event close but not the name. Search directly '

' 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) s) curPos:=PrevPos('

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

',HTML,curPos)+Length(''); //Strings which opens/closes the data. WEB_SPECIFICcloses 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/closes the data. WEB_SPECIFIC EventBlock:=Copy(HTML,curPos,endPos-curPos); //LogMessage(' Parse results ('+IntToStr(curPos)+','+IntToStr(endPos)+') complex EventBlock:'+EventBlock+'||');+EventBlock+'||'); //Award Level curPos1:=Pos('',EventBlock,curPos1)+Length(''); //Strings which opens/closes the data. WEB_SPECIFIC/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+'||');t:'+ItemList+'||'); ExplodeString(ItemList,ItemArray,';'); AwardWon:= False; //Normaly in 'Nominee' case. WEB_SPECIFICe' 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_SPECIFICpens/closes the data. WEB_SPECIFIC ItemList:=Copy(AwardBlock,curPos2,endPos2-curPos2); //LogMessage(' Parse results ('+IntToStr(curPos2)+','+IntToStr(curPos2)+') complex ItemList:'+ItemList+'||');List:'+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 Notesand 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_SPECIFICtrings which opens/closes the data. WEB_SPECIFIC curPos3:=PosFrom('name',ItemList,2); //Strings which opens/closes the data. WEB_SPECIFICtrings which opens/closes the data. WEB_SPECIFIC If (endPosAux',#13,false,curPos4); //Strings which opens/closes the data. WEB_SPECIFICtrings 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)+'||');ategory+'|'+''+'|'+EventYear+'|'); //+BoolToStr(AwardWon)+'||'); End; While curPos3>0 Do Begin AwardRecipient:=TextBetWeen(ItemList,'>','<',false,curPos3); //Strings which opens/closes the data. WEB_SPECIFIC //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)+'||'); ategory+'|'+AwardRecipient+'|'+EventYear+'|'); //+BoolToStr(AwardWon)+'||'); endPosAux:=PosFrom('note',ItemList,curPos3); //Strings which opens/closes the data. WEB_SPECIFIC //Strings which opens/closes the data. WEB_SPECIFIC curPos3:=PosFrom('name',ItemList,curPos3); //Strings which opens/closes the data. WEB_SPECIFIC //Strings which opens/closes the data. WEB_SPECIFIC If curPos3>endPosAux Then curPos3:=0 //Avoid Names in notes. WEB_SPECIFIC End; curPos2:=PosFrom('
0 Do Begin //Get AwardWon and AwardName endPos1:=PosFrom('',AwardBlock); //String which opens the AwardCategory and AwardRecipient list data. WEB_SPECIFICns 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_SPECIFICopens the AwardCategory and AwardRecipient list data. WEB_SPECIFIC End; curPos1:=PosFrom('' is very inconsistent. WEB_SPECIFICetectecs the Event. Search directly '

' is very inconsistent. WEB_SPECIFIC index:=index+1; End; //End; end; procedure ParseSearchResults(HTML : String); var curPos, endPos : Integer; Title, URL, Preview : String; begin curPos := Pos('', HTML); if curPos < 1 then Exit; LogMessage('Parsing search results...'); curPos := PosFrom(' 0 do begin endPos := PosFrom('?ref_=fn_tt_tt_', HTML, curPos); URL := Trim(Copy(HTML, curPos+9, endPos - curPos-9)); URL := BASE_URL + URL; curPos := PosFrom('>', HTML, curPos)+1; endPos := PosFrom('', HTML, curPos); Title := RemoveTags(Trim(Copy(HTML, curPos, endPos - curPos)), false); // Title := StringReplace(Title, ' - ', #13, true, false, true); Title := StringReplace(Title, ' - ', '
', true, false, true); curPos := PosFrom(' '' then begin Result := I; Break; end; end; function ParsePage(HTML : String; URL : AnsiString) : Cardinal; begin HTML := HTMLToText(HTML); HTML := StringReplace (HTML, 'http://imdb.com', 'http://www.imdb.com', True, True, False); if Pos('Find - IMDb', HTML) > 0 then begin ParseSearchResults(HTML); Result := prList; Exit; end else if (Mode = 0) AND (Pos('IMDb - ', HTML) > 0) then begin ParseMovie(URL, HTML) end else if (Mode = 0) AND (Pos(' - IMDb', HTML) > 0) then begin ParseMovie(URL, HTML) end else if Pos('IMDb - ', HTML) > 0 then ParseMovie(URL, HTML) else if Pos(' - IMDb', HTML) > 0 then ParseMovie(URL, HTML); Mode := NextMode(Mode); if Mode <> smFinished then Result := prDownload else Result := prFinished; end; begin Mode := smSearch; for ELI := Low(ExtraLinks) to High(ExtraLinks) do ExtraLinks[ELI] := ''; end.