Update imdb url

If you need help on how to use the program
Post Reply
PropheX
Posts: 10
Joined: 2004-08-16 12:22:43

Update imdb url

Post by PropheX »

hi
i tried to search around to find the answer but i couldnt find one
anyways, i was wondering if there was an easy way to update my imdb urls?
right now i have a few different types of imdb urls
http://imdb.com/Title?0000000/
http://imdb.com/title/tt000000/
http://us.imdb.com/Title?0000000/
is there a simple way to make them all into one format?
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

It should be easy to do using scripting.
PropheX
Posts: 10
Joined: 2004-08-16 12:22:43

Post by PropheX »

im not sure how
is there an older post you can point me to that will show me?
or do i have to use the imdb script to reget the urls?
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

example if you want to replace the 1st and 3rd URL style by the 2nd one :

Code: Select all

program imdbURL;
var
  s: string;
begin
  s := GetField(fieldURL);
  s := StringReplace('http://imdb.com/Title?', 'http://imdb.com/title/tt');
  s := StringReplace('http://us.imdb.com/Title?', 'http://imdb.com/title/tt');
  SetField(fieldURL, s);
end.
PropheX
Posts: 10
Joined: 2004-08-16 12:22:43

Post by PropheX »

i just tried it but i keep getting an error
"Script error : IMDBURL at position 145 (comma expected)"
sorry, i have no idea what that means and i dont have any programing experience
i tried to add a comma but it didnt help any^^;
it only changed the error messege for every comma i added, 146, 147, etc etc
also, from what i can tell, after (successfully) running this script, i'd end up with 2 different types of urls, right?
http://imdb.com/title/tt000000
and
http://imdb.com/title/tt0000000
one with 6 and one with 7
is there a way to change the 6# url to a 7# url?
if its possible, i want them all to look like
http://imdb.com/title/tt0000000
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I forgot something, yes

Code: Select all

program imdbURL;
var
  s: string;
begin
  s := GetField(fieldURL);
  s := StringReplace(s, 'http://imdb.com/Title?0', 'http://imdb.com/title/tt');
  s := StringReplace(s, 'http://us.imdb.com/Title?0', 'http://imdb.com/title/tt');
  SetField(fieldURL, s);
end.
I added a "0" in the "Title?" part so it will be replaced too, to remove a zero
How many number should be used in the "tt" URL ?
PropheX
Posts: 10
Joined: 2004-08-16 12:22:43

Post by PropheX »

woah, its working pretty good so far
almost have the urls exactly how i want them^^
i want 7 numbers after the tt just like the imdb homepage
also, one more thing
some of my urls end with a / and some don't
is there some way to delete those as well? besides manually^^;
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Code: Select all

program imdbURL;
var
  s: string;
begin
  s := GetField(fieldURL);
  if StrGet(s, Length(s)) = '/' then
    Delete(s, Length(s), 1);
  if Length(s) = Length('http://imdb.com/title/tt000000') then
    Insert('0', s, 25);
  SetField(fieldURL, s);
end.
Guest

Post by Guest »

im getting another error
"Script error : IMDBURL at position 98 (out of range)"
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Probably because it found a movie that had no URL...

Code: Select all

program imdbURL;
var
  s: string;
begin
  s := GetField(fieldURL);
  if s <> '' then
  begin
    if StrGet(s, Length(s)) = '/' then
      Delete(s, Length(s), 1);
    if Length(s) = Length('http://imdb.com/title/tt000000') then
      Insert('0', s, 25);
    SetField(fieldURL, s);
  end;
end.
PropheX
Posts: 10
Joined: 2004-08-16 12:22:43

Post by PropheX »

ahh, okay
i have to use both scripts^^
got it to work and all my urls are just perfect now
thanks a lot^^
Bad Joker
Posts: 81
Joined: 2002-06-10 12:46:38
Location: Hamburg, Germany
Contact:

Post by Bad Joker »

thanks also from me, works really fine :)
Post Reply