BETA FIX - Imdb Large Pics
Posted: 2002-12-17 23:37:45
antp
the solution below has worked with all of the movies i've tried. i hope you could test it, to have it "certified"
// Picture
LineNr := FindLine('title="DVD available at Amazon.com"', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := Pos('href="', Line) + 5;
Delete(Line, 1, BeginPos);
EndPos := Pos('"', Line);
Value := Copy(Line, 1, EndPos - 1);
AmazonPage := TStringList.Create;
AmazonPage.Text := GetPage('http://us.imdb.com' + Value);
LineNr := FindLine('<title>Amazon.com: DVD Search', AmazonPage, 0);
if LineNr < 1 then
begin
LineNr := FindLine('img src="http://images.amazon.com/images/P/', AmazonPage, 0);
if LineNr > -1 then
begin
Line := AmazonPage.GetString(LineNr);
BeginPos := Pos('img src="http://images.amazon.com/images/P/', Line) + 8;
Delete(Line, 1, BeginPos);
EndPos := Pos('"', Line);
Value := Copy(Line, 1, EndPos - 1);
Value := StringReplace(Value, 'TZZZZZZZ', 'LZZZZZZZ');
GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end
end else
begin
Line := AmazonPage.GetString(LineNr);
BeginPos := Pos('<title>Amazon.com: DVD Search Results: ', Line) + 38;
Delete(Line, 1, BeginPos);
EndPos := Pos('|', Line);
Value2 := Copy(Line, 1, EndPos - 1);
Value := 'http://images.amazon.com/images/P/' + Value2 + '.01.LZZZZZZZ.jpg';
GetPicture(Value, False);
end;
AmazonPage.Free;
end else
begin
LineNr := FindLine('<img alt="cover" align="left" src="http://ia.imdb.com/media/imdb/', Page, 0);
if LineNr < 0 then
LineNr := FindLine('<img alt="cover" align="left" src="http://posters.imdb.com/', Page, 0);
if LineNr < 0 then
LineNr := FindLine('<img alt="cover" align="left" src="http://images.amazon.com/', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('src="', Line) + 4;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
Value := StringReplace(Value, 'MZZZZZZZ', 'LZZZZZZZ'); // change URL to get the Large instead of Small image
GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end;
end;
the solution below has worked with all of the movies i've tried. i hope you could test it, to have it "certified"
// Picture
LineNr := FindLine('title="DVD available at Amazon.com"', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := Pos('href="', Line) + 5;
Delete(Line, 1, BeginPos);
EndPos := Pos('"', Line);
Value := Copy(Line, 1, EndPos - 1);
AmazonPage := TStringList.Create;
AmazonPage.Text := GetPage('http://us.imdb.com' + Value);
LineNr := FindLine('<title>Amazon.com: DVD Search', AmazonPage, 0);
if LineNr < 1 then
begin
LineNr := FindLine('img src="http://images.amazon.com/images/P/', AmazonPage, 0);
if LineNr > -1 then
begin
Line := AmazonPage.GetString(LineNr);
BeginPos := Pos('img src="http://images.amazon.com/images/P/', Line) + 8;
Delete(Line, 1, BeginPos);
EndPos := Pos('"', Line);
Value := Copy(Line, 1, EndPos - 1);
Value := StringReplace(Value, 'TZZZZZZZ', 'LZZZZZZZ');
GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end
end else
begin
Line := AmazonPage.GetString(LineNr);
BeginPos := Pos('<title>Amazon.com: DVD Search Results: ', Line) + 38;
Delete(Line, 1, BeginPos);
EndPos := Pos('|', Line);
Value2 := Copy(Line, 1, EndPos - 1);
Value := 'http://images.amazon.com/images/P/' + Value2 + '.01.LZZZZZZZ.jpg';
GetPicture(Value, False);
end;
AmazonPage.Free;
end else
begin
LineNr := FindLine('<img alt="cover" align="left" src="http://ia.imdb.com/media/imdb/', Page, 0);
if LineNr < 0 then
LineNr := FindLine('<img alt="cover" align="left" src="http://posters.imdb.com/', Page, 0);
if LineNr < 0 then
LineNr := FindLine('<img alt="cover" align="left" src="http://images.amazon.com/', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('src="', Line) + 4;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
Value := StringReplace(Value, 'MZZZZZZZ', 'LZZZZZZZ'); // change URL to get the Large instead of Small image
GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end;
end;