AllMovie.com_new script
v 0.1.2.0.
Have been made some changes in search results, namely, that it is now to find a movie title, which is not listed on the first page of search results, but on the other sides.
Changes in the AllMovie.com_new script:
//Script data
SCRIPT_VERSION = '0.1.2.0';
SCRIPT_NAME = 'AllMovie.com_new';
SCRIPT_DESC = '[EN] Get Movie Information from AllMovie.com_new page';
SCRIPT_LANG = $09; //English
SCRIPT_TYPE = stMovies;
BASE_URL = 'http://www.allmovie.com';
RATING_NAME = 'AllMovie';
// SEARCH_STR = 'http://www.allmovie.com/search/movies/%s';
CODE_PAGE = 65001; //Use 0 for Autodetect
//User Options
GET_ACTORS = True; //Set to False to ensure ~ctActors~ not added even if 'Overwrite fields' setting allows
GET_DURATION = True; //Set to False to ensure ~mfDuration~ not set even if 'Overwrite fields' setting allows
//Note the program will overwrite this with the actual media duration in any case
GET_POSTER = True; //Set to False if posters not wanted (or to handle bad image URL causing HTTP 404 error)
GET_RATING = True; //Set to False to ensure ~mfRating~ not set even if 'Overwrite setting' fields setting allows
GET_THEMES = True; //Set to False to ensure ~mfCategory~ not added even if 'Overwrite fields' setting allows
//Global variables
var
ELI, I : Integer;
MovieName, PageSite : String;
Mode : Byte;
ExtraLinks : array [smCast..smPoster] of String;
TabMovieName, TabNumber, TabPageSite, TabPage : TwideArray;
//function GetDownloadURL : AnsiString;
//begin
// if (Mode = smSearch) then
// Result := SEARCH_STR
// else
// Result := ExtraLinks[Mode];
//end;
function GetDownloadURL : AnsiString;
Var
URLSearch,URLSearch1,URLSearch2: String;
begin
//Get Name of movie to search :
MovieName := GetFieldValue(2);
Explodestring(MovieName,TabMovieName,#32);
MovieName := #43;
For I:=low(TabMovieName) to High(TabMovieName) do
Begin
MovieName := MovieName + TabMovieName[I] + #43;
end;
URLSearch1 := 'http://www.allmovie.com/search/movies/'+MovieName+'/all/10';
LogMessage('URL page recherche : '+ URLSearch1);
URLSearch := 'http://www.allmovie.com/search/movies/'+MovieName;
LogMessage('URL page recherche : '+ URLSearch);
if (Mode = smSearch) then
Result := URLSearch1
else
Result := ExtraLinks[Mode];
if (Mode = smSearch) then
Result := URLSearch
else
Result := ExtraLinks[Mode];
end;
procedure ParseSearchResults(HTML : String);
var
curPos, endPos : Integer;
Title, Year, URL, director : String;
begin
//List of other site number where search page :
TabNumber := ['10', '20', '30', '40', '50', '60', '70', '80', '90', '100'];
//List of other page site number where search page :
TabPage := ['2', '3', '4', '5', '6', '7', '8', '9', '10','11'];
curPos := Pos('<div id="search-results" class="all">', HTML);
// curPos := Pos('div class="results-section movies">', HTML);
if curPos < 1 then
Exit;
LogMessage('Parsing search results...');
curPos := PosFrom('<a href="http://www.allmovie.com/movie/', HTML, curPos);
while curPos > 0 do begin
endPos := PosFrom('" class="tool-tip" data-objectid="', HTML, curPos);
URL := Copy(HTML, curPos + 9, endPos - curPos - 9);
curPos := PosFrom('">', HTML, curPos)+2;
endPos := PosFrom('</a>', HTML, curPos);
Title := Copy(HTML, curPos, endPos - curPos);
curPos := PosFrom('</a>', HTML, curPos)+24;
endPos := PosFrom('</dt>', HTML, curPos);
Year := RemoveTags(Trim(Copy(HTML, curPos, endPos - curPos)), false);
curPos := PosFrom('">', HTML, curPos)+2;
endPos := PosFrom('</a></dd>', HTML, curPos);
director := RemoveTags(Trim(Copy(HTML, curPos, endPos - curPos)), false);
AddSearchResult(Title+' '+Year, '', '', URL, '');
curPos := PosFrom('<a href="http://www.allmovie.com/movie/', HTML, curPos);
end;
//Get Name of movie to search :
MovieName := GetFieldValue(2);
Explodestring(MovieName,TabMovieName,#32);
MovieName := '';
For I:=low(TabMovieName) to High(TabMovieName) do
Begin
MovieName := MovieName + #43 + TabMovieName[I];
end;
//Add Links to Page with other sites in TabNumber:
For I := Low(TabNumber) to High(TabNumber) do
Begin
URL := 'http://www.allmovie.com/search/movies/'+MovieName+'/all/' + TabNumber[I];
//AddSearchResult('Search in '+MovieName+' on AllMovie.com ',TabNumber[I],'',URL,'');
end;
Begin
URL := 'http://www.allmovie.com/search/movies/'+MovieName+'/all/';
AddSearchResult('Search in '+MovieName+' on AllMovie.com ','Page 1','',URL,'');
end;
//List of other page site number where search page :
// PageSite := GetFieldValue(0);
// Explodestring(PageSite,TabPageSite,#32);
// PageSite := '';
For I := Low(TabPage) to High(TabPage) do
Begin
//PageSite := PageSite+TabPage[I];
URL := 'http://www.allmovie.com/search/movies/'+MovieName+'/all/' + TabNumber[I];
AddSearchResult('Search in '+MovieName+' on AllMovie.com ','Page '+TabPage[I],'',URL,'');
//AddSearchResult('Search in '+MovieName+' on AllMovie.com '+TabPage[I],TabNumber[I],'',URL,'');
//AddSearchResult('Search in '+MovieName+' on AllMovie.com ',TabPage[I],'',URL,'');
end;
// Begin
// URL := 'http://www.allmovie.com/search/movies/'+MovieName+'/all/';
// AddSearchResult('Search in '+MovieName+' on AllMovie.com ','1','',URL,'');
// end;
end;
Notice:
The new version of the script is added to the Download page.