Here's the Yahoo-Movies picture/plot grabber, easily modified if you want it to do more:
Code: Select all
// GETINFO SCRIPTING
// Yahoo Movies (Quick Picture Grab) - NoFiX
program YahooPictureGrab;
const
YMGrabPlot = FALSE;
var
MovieName: string;
procedure AnalyzePage(Address: string);
var
debugPage: TStringList;
strPage, MovieAddr, MovieTitle, MoviePlot, MovieID: string;
BeginPos, EndPos: Integer;
begin
// debugPage:= TStringList.Create;
// debugPage.Text := GetPage(Address);
// debugPage.SaveToFile('C:\Yahoo1.txt');
strPage:= GetPage(Address);
BeginPos:= Pos('Titles Found</b>', strPage);
Delete(strPage, 1, BeginPos);
if(BeginPos > 0) then
begin
PickTreeClear;
PickTreeAdd('Results for ' + MovieName + ':', '');
BeginPos:= Pos('<a HRef="', strPage);
while BeginPos > 0 do
begin
// Movie Address
EndPos:= Pos('">', Copy(strPage, BeginPos, Length(strPage) - BeginPos)) + BeginPos - 1;
MovieAddr:= Copy(strPage, BeginPos + 9, EndPos - BeginPos - 9);
// Movie Title
BeginPos:= EndPos + 2;
EndPos:= Pos('</a>', strPage);
MovieTitle:= Copy(strPage, BeginPos, EndPos - BeginPos);
// Add to listbox
PickTreeAdd(MovieTitle, MovieAddr);
// Restart the process
Delete(strPage, 1, EndPos);
BeginPos:= Pos('<a HRef="', strPage);
end;
if(PickTreeExec(Address)) then
begin
strPage:= GetPage(Address);
BeginPos:= Pos('<img src="http://shopping.yahoo.com/video/images/', strPage);
if(BeginPos > 0) then
begin
EndPos:= Pos('"', Copy(strPage, BeginPos + 10, Length(strPage) - BeginPos)) + BeginPos;
Address:= Copy(strPage, BeginPos + 10, EndPos - BeginPos - 1);
GetPicture(Address, FALSE);
end
else
ShowMessage('No cover-art was found for :' + MovieName);
// Check if we need plot
if(GetField(fieldDescription) = '') or (YMGrabPlot = TRUE) then
begin
BeginPos:= Pos('<font face=arial size=-1><b>' + #13, strPage) + 35;
Delete(strPage, 1, BeginPos);
EndPos:= Pos('<p>', strPage);
MoviePlot:= Copy(strPage, 1, EndPos - 3);
HTMLDecode(MoviePlot);
SetField(fieldDescription, MoviePlot);
end;
end;
end;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
begin
AnalyzePage('http://search.movies.yahoo.com/search/movies/title?p=%5B' + UrlEncode(MovieName) + '%5D+type%3Afeature&intl=us&search=title&s=wt,-$s');
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
Code: Select all
// GETINFO SCRIPTING
// CDUniverse (Quick Picture Grab) - NoFiX
program CUPictureGrab;
var
MovieName: string;
procedure AnalyzePage(Address: string);
var
strPage, MovieAddr, MovieTitle, MovieDate, MovieID: string;
BeginPos, EndPos: Integer;
begin
strPage := GetPage(Address);
BeginPos := Pos('<b>Click price', strPage);
if(BeginPos > -1)then
begin
PickTreeClear;
PickTreeAdd('Search Results for: ' + MovieName, '');
Delete(strPage, 1, BeginPos);
BeginPos := Pos('<a href="/productinfo.asp?', strPage);
EndPos := 1;
while ((BeginPos > 0) and (EndPos > 0)) do
begin
Delete(strPage, 1, BeginPos + 29);
EndPos := Pos('cart=', strPage) - 1;
MovieId := Copy(strPage, 1, EndPos - 1);
MovieAddr := 'http://www.cduniverse.com/productinfo.asp?pid=' + MovieId + '&cart=0&style=movie';
BeginPos := Pos('<b>', strPage) + 3;
EndPos := Pos('</b>', strPage);
MovieTitle := Copy(strPage, BeginPos, EndPos - BeginPos);
PickTreeAdd(MovieTitle, MovieAddr);
BeginPos := Pos('<a href="/productinfo.asp?', strPage);
if(Pos('</table>', strPage) < BeginPos) then
BeginPos := -1;
end;
if(PickTreeExec(Address)) then
begin
strPage := GetPage(Address);
if(Pos('default_coverart.gif', strPage) < 0) then
begin
BeginPos := Pos('<img src="http://cover', strPage) + 9;
Delete(strPage, 1, BeginPos);
EndPos := Pos('" border=', strPage) - 1;
//ShowMessage(Copy(strPage, 1, EndPos));
Address := Copy(strPage, 1, EndPos);
GetPicture(Address, false);
end
else
ShowMessage('Sorry, no cover-art was found for ' + MovieName);
end;
end;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
begin
AnalyzePage('http://www.cduniverse.com/sresult.asp?cart=123456789&style=movie&HT_Search_Info=' + UrlEncode(MovieName));
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.