(* SCRIPT INFO: Following until 'SCRIPT BEGINS HERE...' is documentation. Please see 'USER OPTIONS' in the body of the script. --------------------------------------------- SCRIPT: Imdb Movie(episodelist) Script AUTHOR: Ivek23 VERSION: 0.1.1.5 DATE: 17/02/2016 --------------------------------------------- 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; smEp1 = 6; smEp2 = 7; smEp3 = 8; smEp4 = 9; smEp5 = 10; smEp6 = 11; smEp7 = 12; smEp8 = 13; smEp9 = 14; smEp10 = 15; smEp11 = 16; smEp12 = 17; smEp13 = 18; smEp14 = 19; smEp15 = 20; smEp16 = 21; smEp17 = 22; smEp18 = 23; smEp19 = 24; smEp20 = 25; smEp21 = 26; smEp22 = 27; smEp23 = 28; smEp24 = 29; smEp25 = 30; smEp26 = 31; smEp27 = 32; smEp28 = 33; smEp29 = 34; smEp30 = 35; smEp = 36; smPoster = 37; smFinished = 38; //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.1.1.2'; SCRIPT_NAME = 'Imdb Movie Script(episodelist)'; SCRIPT_DESC = '[EN] Get Movie Information from Imdb.com(episodelist)'; 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 //Global variables var ELI : Integer; 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; procedure ParseMovie(MovieURL : String; HTML : String); var curPos, EndPos, debug_pos1 : Integer; Title, OrigTitle, Description, URL, Year, Season, Episode, TmpStr, TmpStr1 : String; begin MovieURL := StringReplace(MovieURL, 'episodes', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=-1', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=0', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=1', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=2', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=3', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=4', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=5', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=6', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=7', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=8', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=9', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=10', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=11', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=12', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=13', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=14', '', true, false, true); MovieURL := StringReplace(MovieURL, '?season=15', '', true, false, true); MovieURL := StringReplace(MovieURL, '/0', '/', true, false, true); MovieURL := StringReplace(MovieURL, '/1', '/', true, false, true); MovieURL := StringReplace(MovieURL, '/2', '/', true, false, true); MovieURL := StringReplace(MovieURL, '/3', '/', true, false, true); MovieURL := StringReplace(MovieURL, '/4', '/', true, false, true); MovieURL := StringReplace(MovieURL, '/5', '/', true, false, true); AddFieldValueXML('url', MovieURL); //GetFieldValueXML('url'); //~Episode Guide~ If Pos('
Episode Guide
', HTML) > 0 then begin curPos := Pos('
Episode Guide
', HTML); EndPos := curPos; TmpStr := HTMLValues(HTML, '
Episode Guide
', '', '', '', ' ', EndPos); //AddCustomFieldValueByName('Seasons-Episodes', TmpStr); curPos := EndPos; end; //~Episodes~ If Pos('

Episodes

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

Episodes

', HTML); EndPos := curPos; TmpStr1 := HTMLValues(HTML, '

Seasons

', '
', '', ' ', EndPos); TmpStr1 := StringReplace(TmpStr1, '="', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '1

', false, curPos); Season := Season +'1'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 1', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '2

', false, curPos); Season := Season +'2'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 2', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '3

', false, curPos); Season := Season +'3'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 3', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '4

', false, curPos); Season := Season +'4'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 4', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '5

', false, curPos); Season := Season +'5'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 5', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '6

', false, curPos); Season := Season +'6'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 6', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '7

', false, curPos); Season := Season +'7'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 7', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '8

', false, curPos); Season := Season +'8'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 8', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '9

', false, curPos); Season := Season +'9'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 9', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '10

', false, curPos); Season := Season +'10'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 10 ', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '11

', false, curPos); Season := Season +'11'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 11 ', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '12

', false, curPos); Season := Season +'12'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 12 ', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '13

', false, curPos); Season := Season +'13'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 13 ', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '14

', false, curPos); Season := Season +'14'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 14', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '15

', false, curPos); Season := Season +'15'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 15', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '16

', false, curPos); Season := Season +'16'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 16', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '17

', false, curPos); Season := Season +'17'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 17', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '18

', false, curPos); Season := Season +'18'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 18', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '19

', false, curPos); Season := Season +'19'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 19', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '20

', false, curPos); Season := Season +'20'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 20', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '21

', false, curPos); Season := Season +'21'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 21', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '22

', false, curPos); Season := Season +'22'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 22', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '23

', false, curPos); Season := Season +'23'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 23', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '24

', false, curPos); Season := Season +'24'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 24', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

', '25

', false, curPos); Season := Season +'25'; Episode := TextBetween(HTML, ', Ep', ' 0) AND (curPos < PosFrom(' Season 25', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '
', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, Episode); Episode := TextBetween(HTML, ', Ep', ' 0 then begin curPos := PrevPos('Episode List', HTML) > 0 then begin curPos := Pos('

Episode List

', HTML); EndPos := curPos; Season := TextBetween(HTML, '

Unknown', '

', false, curPos); Season := Season +' 0'; //Episode := TextBetween(HTML, '
', '
', false, curPos); curPos := PosFrom('
0) AND (curPos < PosFrom(' Unknown Season', HTML, endPos)) do begin endPos := PosFrom('?ref_=ttep_ep', HTML, curPos); URL := 'http://www.imdb.com/title/'+TextBetween(HTML, '', '', false, curPos); //AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode); AddEpisode(Title, Title, '', URL, '', Season, ''); //Episode := TextBetween(HTML, '
', '
', false, curPos); curPos := PosFrom('', 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); 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 (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) 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.