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

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
Dmitry501
Posts: 26
Joined: 2003-08-13 02:35:10

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

Post 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?
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

It seems to works, thanks :)
kolia
Posts: 56
Joined: 2003-02-19 16:02:46

Post by kolia »

Dmitry501 have you updated the script?

it doesn't seem to work any more...
KaraGarga
Posts: 50
Joined: 2004-04-03 03:33:22
Location: Turkey
Contact:

Post 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...
Post Reply