problems with charakters
problems with charakters
I just tried to write my first script and after hours I'm really close to get it. It's Just for importing covers and I need to get an URL like "...&search=...", but all I get from AMC is "...search=...".
Is there a posibility that I get a & in my URL??
Is there a posibility that I get a & in my URL??
Nope, no chance. another proposal?
Or maybe one one you could write a script for getting the posters from that page?
http://www.allposters.com/
Or maybe one one you could write a script for getting the posters from that page?
http://www.allposters.com/
No, "\" has no special meaning in Pascal (unlike in some other languages).
If you do a ShowMessage it will display the letter following the "&" in underline. It is a Windows feature, like in the menus, you set &File as caption and it will display it as File, alt Alt+F will allow to access to it.
But event if it does not display right, it is right in the Pascal variable and it is right when sent to the server. So the problem should be somewhere else.
If you do a ShowMessage it will display the letter following the "&" in underline. It is a Windows feature, like in the menus, you set &File as caption and it will display it as File, alt Alt+F will allow to access to it.
But event if it does not display right, it is right in the Pascal variable and it is right when sent to the server. So the problem should be somewhere else.
The URL seems to be:
http://www.allposters.com/GetThumb.asp? ... movietitle
You will need to disable javascript in your browser to avoid the frame when going to direct URL, but for the script it should not be a problem...
http://www.allposters.com/GetThumb.asp? ... movietitle
You will need to disable javascript in your browser to avoid the frame when going to direct URL, but for the script it should not be a problem...
The URL is:
http://www.allposters.com/gallery.asp?c=c&search= + MovieAddress
which you get from that page you pointed to. It is a numeric code.but disabling Javascript doesnt seem to work...Maybe you could try it, when you have some time?
http://www.allposters.com/gallery.asp?c=c&search= + MovieAddress
which you get from that page you pointed to. It is a numeric code.but disabling Javascript doesnt seem to work...Maybe you could try it, when you have some time?
Maybe you could take a look at my script and tell me whats wrong...:
procedure AddMoviesTitles();
var
Line, value: string;
Page: TStringList;
LineNr: Integer ;
MovieTitle, MovieAddress: string;
StartPos, beginpos, endpos, endp: Integer;
MovieURL: String;
begin
MovieName := GetField(fieldOriginalTitle);
Page := Tstringlist.create;
Page.Text := GetPage('http://www.allposters.com/GetThumb.asp?txtSearch=' + UrlEncode(MovieName));
//showMessage(Page.Text);
LineNr:= FindLine('<title>AllPosters.com Thumbnails', Page, LineNr);
// if LineNr = 0 then
//begin
LineNr := 0;
LineNr := FindLine('<a href="GetThumb.asp?c=c&search=', Page, LineNr);
Line := Page.GetString(LineNr);
//showMessage(Line);
StartPos := pos('<a href="GetThumb.', Line)+9;
endp := pos('search=', Line)+12 ;
if StartPos > 0 then
begin
Startpos := Startpos ;
MovieAddress := copy(Line, StartPos, endp - startpos );
//showMessage(MovieAddress)
//StartPos := pos('">', Line) + 2;
//MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
// HTMLDecode(Movietitle);
//if Length(Result) <= 0 then
MovieURL :=MovieAddress;
showMessage(MovieURL);
begin
// Picture
Page.Text := GetPage(MovieURL) ;
ShowMessage(Page.Text);
// end else
LineNr := 0 ;
LineNr := FindLine('<img src="http://imagecache2.allposters.com/images/', 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);
ShowMessage(Line);
BeginPos := pos('<img src="http://imagecache2.allposters.com/images/', Line) + 9;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
showMessage(Value);
// GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end;
end ;
end;
end;
procedure AddMoviesTitles();
var
Line, value: string;
Page: TStringList;
LineNr: Integer ;
MovieTitle, MovieAddress: string;
StartPos, beginpos, endpos, endp: Integer;
MovieURL: String;
begin
MovieName := GetField(fieldOriginalTitle);
Page := Tstringlist.create;
Page.Text := GetPage('http://www.allposters.com/GetThumb.asp?txtSearch=' + UrlEncode(MovieName));
//showMessage(Page.Text);
LineNr:= FindLine('<title>AllPosters.com Thumbnails', Page, LineNr);
// if LineNr = 0 then
//begin
LineNr := 0;
LineNr := FindLine('<a href="GetThumb.asp?c=c&search=', Page, LineNr);
Line := Page.GetString(LineNr);
//showMessage(Line);
StartPos := pos('<a href="GetThumb.', Line)+9;
endp := pos('search=', Line)+12 ;
if StartPos > 0 then
begin
Startpos := Startpos ;
MovieAddress := copy(Line, StartPos, endp - startpos );
//showMessage(MovieAddress)
//StartPos := pos('">', Line) + 2;
//MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
// HTMLDecode(Movietitle);
//if Length(Result) <= 0 then
MovieURL :=MovieAddress;
showMessage(MovieURL);
begin
// Picture
Page.Text := GetPage(MovieURL) ;
ShowMessage(Page.Text);
// end else
LineNr := 0 ;
LineNr := FindLine('<img src="http://imagecache2.allposters.com/images/', 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);
ShowMessage(Line);
BeginPos := pos('<img src="http://imagecache2.allposters.com/images/', Line) + 9;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
showMessage(Value);
// GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end;
end ;
end;
end;
Yes, it's the procedure of getting the poster. As you see, I have some ShowMessages in it and one shows the actual URL, which is besides the '&' correct, but the one which shows the page.text always shows the text of the Main Page. When I enter the URL manually in the Browser, It works...
Here's the complete Code:
As you see, I only took the Imdb(batch) Code and tried to change it. I said already that It was my first time programming...
Here's the complete Code:
Code: Select all
program batch;
const
// Set the following constants to True to import field, or False to skip field
ImportURL = false;
ImportOriginalTitle = false;
ImportTranslatedTitle = false;
LeaveOriginalTitle = True; // True will get Translated Title, yet Original Title field will remain same
ImportYear = false;
ImportRating = false;
ImportPicture = True;
ImportLargePicture = true; // If set to False small pic will be imported
ImportDirector = false;
ImportActors = false;
ImportCountry = false;
ImportCategory = false;
ImportDescription = false;
UseLongestDescription = False; // If set to False shortest description available will be imported
ImportComments = false;
ImportLength = True;
ImportLanguage = false;
var
MovieName: string;
function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
i: Integer;
begin
result := -1;
if StartAt < 0 then
StartAt := 0;
for i := StartAt to List.Count-1 do
if Pos(Pattern, List.GetString(i)) <> 0 then
begin
result := i;
Break;
end;
end;
procedure AddMoviesTitles();
var
Line, value: string;
Page: TStringList;
LineNr: Integer ;
MovieTitle, MovieAddress: string;
StartPos, beginpos, endpos, endp: Integer;
MovieURL: String;
begin
MovieName := GetField(fieldOriginalTitle);
Page := Tstringlist.create;
Page.Text := GetPage('http://www.allposters.com/GetThumb.asp?txtSearch=' + UrlEncode(MovieName));
//showMessage(Page.Text);
LineNr:= FindLine('<title>AllPosters.com Thumbnails', Page, LineNr);
// if LineNr = 0 then
//begin
LineNr := 0;
LineNr := FindLine('<a href="GetThumb.asp?c=c&search=', Page, LineNr);
Line := Page.GetString(LineNr);
//showMessage(Line);
StartPos := pos('<a href="GetThumb.', Line)+9;
endp := pos('search=', Line)+12 ;
if StartPos > 0 then
begin
Startpos := Startpos ;
MovieAddress := copy(Line, StartPos, endp - startpos );
//showMessage(MovieAddress)
//StartPos := pos('">', Line) + 2;
//MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
// HTMLDecode(Movietitle);
//if Length(Result) <= 0 then
MovieURL :=MovieAddress;
showMessage(MovieURL);
begin
// Picture
Page.Text := GetPage(MovieURL) ;
ShowMessage(Page.Text);
// end else
LineNr := 0 ;
LineNr := FindLine('<img src="http://imagecache2.allposters.com/images/', 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);
ShowMessage(Line);
BeginPos := pos('<img src="http://imagecache2.allposters.com/images/', Line) + 9;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
showMessage(Value);
// GetPicture(Value, False); // False = do not store picture externally ; store it in the catalog file
end;
end ;
end;
end;
begin
if CheckVersion(3,4,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if MovieName = '' then
MovieName := Input('IMDb Import', 'Enter the title of the movie:', MovieName);
if MovieName <> '' then
begin
// AnalyzePage('http://us.imdb.com/Tsearch?title='+UrlEncode(MovieName)+'&restrict=Movies+only');
AddMoviesTitles();
//ShowMessage('http://www.allposters.com/GetThumb.asp?txtSearch='+UrlEncode(MovieName));
end;
end else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
-
- Posts: 10
- Joined: 2002-12-20 22:47:05
[quote="Anonymous"]
Here I get an Adress like:
http://www.allposters.com/gallery.asp?c=c[u]s[/u]earch=13280
instead of
http://www.allposters.com/gallery.asp?c=c&search=13280
But as you said, that doesn't matter
But here I get the code of the mainpage. I tried entering the URL in the Browser and it worked, but as soon as one character is missing or false I land on the Mainpage, so I thought it has to be somewhere in the part shown above...
The next part does actually funtion as it should.
I really hope, somone can help, or tell me, where to get a script, which imports pictures of that quality...
Code: Select all
LineNr := FindLine('<a href="GetThumb.asp?c=c&search=', Page, LineNr);
Line := Page.GetString(LineNr);
//showMessage(Line);
StartPos := pos('<a href="GetThumb.', Line)+9;
endp := pos('search=', Line)+12 ;
if StartPos > 0 then
begin
Startpos := Startpos ;
MovieAddress := copy(Line, StartPos, endp - startpos );
//showMessage(MovieAddress)
//StartPos := pos('">', Line) + 2;
//MovieTitle := copy(Line, StartPos, pos('</A>', Line) - StartPos);
// HTMLDecode(Movietitle);
//if Length(Result) <= 0 then
MovieURL :='www.allposters.com/gallery.asp?c=c&search=' +movieAddress;
showMessage(MovieURL);
http://www.allposters.com/gallery.asp?c=c[u]s[/u]earch=13280
instead of
http://www.allposters.com/gallery.asp?c=c&search=13280
But as you said, that doesn't matter
Code: Select all
begin
// Picture
Page.Text := GetPage(MovieURL) ;
ShowMessage(Page.Text);
The next part does actually funtion as it should.
Code: Select all
// end else
LineNr := 0 ;
LineNr := FindLine('<img src="http://imagecache2.allposters.com/images/', 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);
ShowMessage(Line);
BeginPos := pos('<img src="http://imagecache2.allposters.com/images/', Line) + 9;
Delete(Line, 1, BeginPos);
EndPos := pos('"', Line);
Value := copy(Line, 1, EndPos - 1);
showMessage(Value);
Last edited by luckybigpack on 2002-12-21 11:33:50, edited 1 time in total.
Why do not you use http://www.allposters.com/GetThumb.asp?txtSearch= + Movietitle as URL ?
The Gallery.asp page seems to be only the frameset, so it does not containt anything useful...
E.g. for the link you gave the "real" page is http://www.allposters.com/getposter.asp ... &fid=13280
The Gallery.asp page seems to be only the frameset, so it does not containt anything useful...
E.g. for the link you gave the "real" page is http://www.allposters.com/getposter.asp ... &fid=13280
-
- Posts: 10
- Joined: 2002-12-20 22:47:05
Yes, I know that this is the real URL, but I don't know how to get that number after apnum...I also tried that link:
http://www.allposters.com/GetThumb.asp?txtSearch= + Movietitle
but on that site I didn't get a link for the Poster. There is just a link to another site which contains the Poster...
http://www.allposters.com/GetThumb.asp?txtSearch= + Movietitle
but on that site I didn't get a link for the Poster. There is just a link to another site which contains the Poster...
When I get http://www.allposters.com/GetThumb.asp?txtSearch=matrix it gives me several links :
http://www.allposters.com/GetPoster.asp ... update=get
http://www.allposters.com/GetPoster.asp ... update=get
http://www.allposters.com/GetPoster.asp ... update=get
etc...
So the link to GetPoster and its parameters (Apnum) are found in GetThumb
http://www.allposters.com/GetPoster.asp ... update=get
http://www.allposters.com/GetPoster.asp ... update=get
http://www.allposters.com/GetPoster.asp ... update=get
etc...
So the link to GetPoster and its parameters (Apnum) are found in GetThumb
-
- Posts: 10
- Joined: 2002-12-20 22:47:05
-
- Posts: 10
- Joined: 2002-12-20 22:47:05