new script for beyazperde.com? (Turkish Movie database)

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
muzur

new script for beyazperde.com? (Turkish Movie database)

Post by muzur »

Can someone try to write a script for this site. I couldn't handle it. URL is as follows:
http://www.beyazperde.com/hizliarama.asp?keyword=

Thanks a lot.

Muzur
tiufang

here the one i use

Post by tiufang »

a quick and dirty solution by modifying the imdb script, but it works:
-------

Code: Select all

// GETINFO SCRIPTING
// Imports Turkish Titles from beyazperde.com

(***************************************************
 *  Movie importation script for:                  *
 *      IMDB (US), http://us.imdb.com              *
 *                                                 *
 *  (c) 2002 Antoine Potten    antoine@buypin.com  *
 *  Improvements made by Danny Falkov              *
 *  Improvements made by Kai Blankenhorn           *
 *                                                 *
 *  For use with Ant Movie Catalog 3.4.0           *
 *  www.ant.be.tf/moviecatalog ··· www.buypin.com  *
 *                                                 *
 *  The source code of the script can be used in   *
 *  another program only if full credits to        *
 *  script author and a link to Ant Movie Catalog  *
 *  website are given in the About box or in       *
 *  the documentation of the program               *
 ***************************************************)

program TurkishTitle;
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 AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  if pos('<title>beyazperde.com - H?zl? Arama', Page.Text) = 0 then
  begin
    SetField(fieldURL, Address);
    AnalyzeMoviePage(Page)
  end else
  begin
    PickTreeClear;
    LineNr := 0;
    LineNr := FindLine('<td class="metin3">Filmler</td>', Page, LineNr);
    if LineNr > -1 then
    begin
      PickTreeAdd('Filmler', '');
      AddMoviesTitles(Page, LineNr);
    end;
    if PickTreeExec(Address) then
      AnalyzePage(Address);
  end;
  Page.Free;
end;

procedure AnalyzeMoviePage(Page: TStringList);
var
  Line, Value, Value2, FullValue: string;
  LineNr: Integer;
  BeginPos, EndPos: Integer;
begin

  // Original Title & Year
  LineNr := FindLine('<title>beyazperde.com - ', Page, 0);
  Line := Page.GetString(LineNr);
  if LineNr > -1 then
  begin
    BeginPos := pos('<title>beyazperde.com - ', Line);
    if BeginPos > 0 then
      BeginPos := BeginPos + 24;
    EndPos := pos(' / ', Line);
    if EndPos = 0 then
      EndPos := Length(Line);
    Value := copy(Line, BeginPos, EndPos - BeginPos);
    HTMLDecode(Value);
    SetField(fieldTranslatedTitle, Value);
  end;
  SetField(fieldOriginalTitle, '');
  SetField(fieldUrl, '');
  
  DisplayResults;
end;

procedure AddMoviesTitles(Page: TStringList; var LineNr: Integer);
var
  Line: string;
  MovieTitle, MovieAddress: string;
  StartPos: Integer;
  TempPos: Integer;
begin
  repeat
    LineNr := LineNr + 1;
    Line := Page.GetString(LineNr);
    TempPos := pos('<img src="', Line);

    if TempPos < 1 then
    begin
      StartPos := pos('<a href="', Line);
      if StartPos > 0 then
      begin
        Startpos := Startpos + 9;
        MovieAddress := copy(Line, StartPos, pos('" class=metin2>', Line) - StartPos);
        StartPos := pos('<b>', Line) + 3;
        MovieTitle := copy(Line, StartPos, pos('</b>', Line) - StartPos);
        LineNr := LineNr + 1;
        Line := Page.GetString(LineNr);
        StartPos := pos('/ ', Line) + 2;
        MovieTitle := MovieTitle + ' - ' + copy(Line, StartPos, pos ('<br>', Line) - StartPos);
        HTMLDecode(Movietitle);
        PickTreeAdd(MovieTitle, 'http://www.beyazperde.com/' + MovieAddress);
      end;
    end;
  until pos('filmden', Line) > 0;
end;

begin
  if CheckVersion(3,4,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
//    if MovieName = '' then
//      MovieName := GetField(fieldTranslatedTitle);
    if Input('Turkish Title', 'Enter the original title of the movie:', MovieName) then
    begin
      AnalyzePage('http://www.beyazperde.com/hizliarama.asp?keyword='+UrlEncode(MovieName));
    end;
  end else
    ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
-----------
tiufang

Post by tiufang »

by the way...

it only imports the translated title, as i use the other information from imdb.

i'm working for a full information import from beyazperde.com.

i'll post it here if i get any results with it.
antp
Site Admin
Posts: 9637
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I edited your message to add [code] and [/code] tags around the script, it is better like that ;)
When you create or modify a script you can add your name (and remove mine if it is a script that you fully created) in the comments at the top of the file.
muzur

Post by muzur »

@tiufang
Thanks for your work. I will try ASAP. I think besides translated title description (plot) will be enough for now.
Thanks again for your effort.
muzur

Post by muzur »

Well. Copied and pasted the script to a new file named beyazperde.ifs. Tried to run the script. At the end what I got was as follows:

In the "Get Information from script" window Translated Title is checked and at the value field it reads "Hızlı Arama</title".

Any clues?

Regards[/img]
Guest

Post by Guest »

hmm...

i think there was a problem with the page. when some of the tags are not closed properly, you may encounter such problems. I come across these kind of problems in the description part of the movies the most, especially when <a> tag is not closed properly: </a (note the missing >)

I see <title> tag is improperly closed in what you get: </title

perhaps there was a temporary problem, and the page may not be completely downloaded.

does the problem still continue? (try searching for different movies..)

since the scripts depend on strict page structure, when the site changes the structure, scripts should also be changed. perhaps sites should provide some movie db files whose structures won't change? :)

anyway, let me check it again...
muzur

Post by muzur »

well.. checked with five different movie names getting same error result.
Guest

Post by Guest »

ok... it may possibly be due to the turkish characters, the full script is about to finish, i tried to avoid using turkish characters in the full script,
so you can try it, tell me which parts don't work for you...
tiufang
Posts: 5
Joined: 2003-01-14 09:21:06

Post by tiufang »

Hi,

you may take a look at for the full script at:

http://ada.cc.metu.edu.tr/amc/Beyaz%20Perde.ifs

this should be working now. it works for me, at least.

by the way, ant, it's created by modifying your imdb script (since i had no idea how to write a script for amc :) ), so i think your name should be left there...

:)

amc, good program, keep up the good work! :)
tiufang
Posts: 5
Joined: 2003-01-14 09:21:06

Post by tiufang »

antp
Site Admin
Posts: 9637
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Nice, I'll include that with the program (maybe only the "full with pic" version)
muzur

Post by muzur »

Well.. Great job.. Working very well.. All the three scripts.. Thanks a lot :)
Post Reply