Page 1 of 1

New script - Import pictore from "www.sharereactor.com&

Posted: 2003-09-02 09:54:08
by Dmitry501

Code: Select all

// GETINFO SCRIPTING
// Imports large picture from sharereactor.com
// Dmitry501

program Sharereactor_com;
const
  BaseAddress = 'http://www.sharereactor.com/';
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(Page: TStringList; var LineNr: Integer);
var
  Line: string;
  MovieTitle, MovieAddress: string;
  StartPos,EndPos,AddPos: Integer;
begin
    LineNr := LineNr + 9;
    Line := Page.GetString(LineNr);
    StartPos := pos('<a', Line);
while StartPos > 0 do
  begin
    Line := Page.GetString(LineNr);
    StartPos := pos('<a', Line);
    if StartPos > 0 then
    begin
      StartPos:=StartPos+8;
      EndPos := Length(Line);
      Line:=copy(Line,StartPos,EndPos - StartPos);
      MovieAddress := copy(Line, 2, pos('">', Line) -2 );
      StartPos := pos('">', Line) + 2;
      MovieTitle := copy(Line, StartPos, pos('</a>', Line) - StartPos);
      HTMLDecode(Movietitle);
      PickTreeAdd(MovieTitle, BaseAddress + MovieAddress);
    end;
    LineNr := LineNr + 4;
  end;
end;

procedure AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr : Integer;
begin
    Page := TStringList.Create;
    Page.Text := GetPage(Address);
    PickTreeClear;
    LineNr := 0;
    LineNr := FindLine('Total Matches:', Page, LineNr);
    if LineNr > -1 then
    begin
      PickTreeAdd('Total Matches:','');
      AddMoviesTitles(Page, LineNr);
    end;
    if PickTreeExec(Address) then
     begin
       Page.Free;
       AnalyzeMoviePage(Address)
     end
end;

procedure AnalyzeMoviePage(Address: String);
var
  Page: TStringList;
  LineNr : Integer;
  Line, Value : String;
  BeginPos, EndPos : Integer;

begin
  Page := TStringList.Create;
  Page.Text := GetPage(Address);
  // Picture
  LineNr := FindLine('Click here for a large version', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    BeginPos := pos('<a href="', Line);
    EndPos := pos('" target="_blank">', Line);
    Value := copy(Line, BeginPos+9, EndPos - 9 - BeginPos);
    GetPicture(Value, False);
  end;
DisplayResults;
end;

begin
  if CheckVersion(3,4,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);
    if Input('Import picture from sharereactor.com', 'Enter the title of the movie:', MovieName) then
    begin
			AnalyzePage('http://www.sharereactor.com/search.php?search='+UrlEncode(MovieName)+'&category=0&submit=Search');
    end;
  end else
    ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
end.
Comment?

Posted: 2003-09-02 10:54:17
by antp
It seems to works, thanks :)

Posted: 2004-10-20 12:16:43
by kolia
Dmitry501 have you updated the script?

it doesn't seem to work any more...

Posted: 2004-10-22 11:09:10
by KaraGarga
Because ShareReactor was closed 3 or 4 months ago.

http://www.sharereactor.com/
ShareReactor.com is offline for the time being. ShareReactor's Owner, Christian Riesen also known as Simon Moon, is under investigation for violation of Copyright and Trademark laws in Switzerland, where he lives and ShareReactor is hosted. There is no date set when its clear if ShareReactor is illegal, or not. No charges have been made yet, this is only an investigation.

If you want to have more information, there is a page open about this (and more) that is updated frequently on http://www.respectp2p.org/

At RespectP2P there are also details in case you want to donate to the legal fund that has been created to aid Christian Riesen in this legal battle.
It's better to exclude this script from AMC script package...