subroutine=checkfiles_v1
Description: Gets status details about a list of given files. (files parameter limited to 3000 bytes. filenames parameter limited to 30000 bytes.)
Parameters: files=comma separated list of file ids
filenames=comma separated list of the respective filename. Example: files=50444381,50444382 filenames=test1.rar,test2.rar
incmd5=if set to 1, field 7 is the hex-md5 of the file. This will double your points! If not given, all md5 values will be 0
Reply fields: 1:File ID
2:Filename
3:Size (in bytes. If size is 0, this file does not exist.)
4:Server ID
5:Status integer, which can have the following numeric values:
0=File not found
1=File OK (Anonymous downloading)
3=Server down
4=File marked as illegal
5=Anonymous file locked, because it has more than 10 downloads already
50+n=File OK (TrafficShare direct download type "n" without any logging.)
100+n=File OK (TrafficShare direct download type "n" with logging. Read our privacy policy to see what is logged.)
6:Short host (Use the short host to get the best download mirror: http://rs$serverid$shorthost.rapidshare.com/files/$fileid/$filename)
7:md5 (See parameter incmd5 in parameter description above.)
Reply format: integer,string,integer,integer,integer,string,string
http://rapidshare.com/files/411931722/qbqbspbdiujnfgpsboojijmbujpogou.rar
http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files=411931722&filenames=qbqbspbdiujnfgpsboojijmbujpogou.rar
{*******************************************************}
{ }
{ Netload.in Delphi API }
{ Version 1.0.0.0 }
{ Copyright (c) 2010 Sebastian Klatte }
{ }
{*******************************************************}
unit uNetloadIn;
interface
uses
SysUtils, Classes, Math, HTTPApp, IdHTTP,
RegExpr,
uPlugInFileHosterClass,
uPathUtils;
type
TNetloadIn = class(TFileHosterPlugIn)
public
function GetName: WideString; override; safecall;
function CheckSize(AFiles: WideString): Extended; override;
end;
implementation
{ TNetloadIn }
function TNetloadIn.GetName: WideString;
begin
Result := 'Netload.in';
end;
function TNetloadIn.CheckSize(AFiles: WideString): Extended;
function GetDownloadlinkID(ALink: string): string;
begin
with TRegExpr.Create do
try
InputString := ALink;
Expression := '\/datei([a-zA-Z0-9]+)';
if Exec(InputString) then
Result := Match[1];
finally
Free;
end;
if (Result = '') then
with TRegExpr.Create do
try
InputString := ALink;
Expression := 'file_id=([a-zA-Z0-9]+)';
if Exec(InputString) then
Result := Match[1];
finally
Free;
end;
if (Result = '') then
with TRegExpr.Create do
try
InputString := ALink;
Expression := 'netload\.in\/([a-zA-Z0-9]+)\/';
if Exec(InputString) then
Result := Match[1];
finally
Free;
end;
end;
function GetSizeinBytes(ALinkResult: string): Integer;
begin
with TRegExpr.Create do
try
InputString := ALinkResult;
Expression := '(.*?);(.*?);(\d+);(.*?);([0-9a-fA-F]+)';
if Exec(InputString) then
Result := StrToIntDef(Match[3], 0);
finally
Free;
end;
end;
var
I: Integer;
s: string;
_params, _postreply: TStringStream;
_size: Int64;
begin
_size := 0;
with TIdHTTP.Create(nil) do
try
with TStringList.Create do
try
Text := AFiles;
_params := TStringStream.Create('');
_postreply := TStringStream.Create('');
try
_params.WriteString('auth=BVm96BWDSoB4WkfbEhn42HgnjIe1ilMt&bz=1&md5=1&file_id=');
s := '';
for I := 0 to Count - 1 do
begin
if (I > 0) then
_params.WriteString(';');
_params.WriteString(GetDownloadlinkID(Strings[I]));
if (I > 0) and (I mod 100 = 0) or (I = Count - 1) then
begin
Request.ContentType := 'application/x-www-form-urlencoded';
Post('http://api.netload.in/info.php', _params, _postreply);
s := s + _postreply.DataString;
_params.Clear;
_params.WriteString('auth=BVm96BWDSoB4WkfbEhn42HgnjIe1ilMt&bz=1&md5=1&file_id=');
_postreply.Clear;
end;
end;
finally
_postreply.Free;
_params.Free;
end;
// c8Dig5OG2L;Board Detector.rar;469412;online;9f6787473902087256d5d25006104e8c
Text := s;
for I := 0 to Count - 1 do
_size := _size + GetSizeinBytes(Strings[I]);
Result := RoundTo((_size / 1048576), -2);
finally
Free;
end;
finally
Free;
end;
end;
end.
{*******************************************************}
{ }
{ Megaupload.com Delphi API }
{ Version 1.0.0.0 }
{ Copyright (c) 2010 Sebastian Klatte }
{ }
{*******************************************************}
unit uMegauploadCom;
interface
uses
Windows, SysUtils, Classes, Math, HTTPApp, IdHTTP,
RegExpr,
uPlugInFileHosterClass,
uPathUtils;
type
TMegauploadCom = class(TFileHosterPlugIn)
public
function GetName: WideString; override; safecall;
function CheckSize(AFiles: WideString): Extended; override;
end;
implementation
{ TMegauploadCom }
function TMegauploadCom.GetName: WideString;
begin
result := 'Megaupload.com';
end;
function TMegauploadCom.CheckSize(AFiles: WideString): Extended;
function GetDownloadlinkID(ALink: string): string;
begin
with TRegExpr.Create do
try
InputString := ALink;
Expression := 'd=([a-zA-Z0-9]+)';
if Exec(InputString) then
result := Match[1];
finally
Free;
end;
end;
function GetSizeinMegaBytes(ALinkResult: string): Extended;
begin
result := 0;
with TRegExpr.Create do
try
InputString := ALinkResult;
Expression := 's=(\d+)&';
if Exec(InputString) then
begin
repeat
result := result + (StrToIntDef(Match[1], 0) / 1048576);
until not ExecNext;
end;
finally
Free;
end;
end;
var
I: Integer;
_params, _postreply: TStringStream;
begin
with TIdHTTP.Create(nil) do
try
with TStringList.Create do
try
Text := AFiles;
_params := TStringStream.Create('');
_postreply := TStringStream.Create('');
try
for I := 0 to Count - 1 do
_params.WriteString('id' + IntToStr(I) + '=' + GetDownloadlinkID(Strings[I]) + '&');
Request.ContentType := 'application/x-www-form-urlencoded';
Post('http://megaupload.com/mgr_linkcheck.php', _params, _postreply);
Text := _postreply.DataString;
finally
_postreply.Free;
_params.Free;
end;
result := RoundTo(GetSizeinMegaBytes(Text), -2);
finally
Free;
end;
finally
Free;
end;
end;
end.
{*******************************************************}
{ }
{ Uploaded.to Delphi API }
{ Version 1.0.0.0 }
{ Copyright (c) 2010 Sebastian Klatte }
{ }
{*******************************************************}
unit uUploadedTo;
interface
uses
SysUtils, Classes, Math, HTTPApp, IdHTTP,
RegExpr,
uPlugInFileHosterClass,
uPathUtils;
type
TUploadedTo = class(TFileHosterPlugIn)
public
function GetName: WideString; override; safecall;
function CheckSize(AFiles: WideString): Extended; override;
end;
implementation
{ TRapidshareCom }
function TUploadedTo.GetName: WideString;
begin
Result := 'Uploaded.to';
end;
function TUploadedTo.CheckSize(AFiles: WideString): Extended;
function IncludeTrailingSlash(const S: string): string;
function IsPathDelimiter(const S: string; index: Integer): Boolean;
begin
Result := (index > 0) and (index <= Length(S)) and (S[index] = '/') and (ByteType(S, index) = mbSingleByte);
end;
begin
Result := S;
if not IsPathDelimiter(Result, Length(Result)) then
Result := Result + '/';
end;
function GetDownloadlinkID(ALink: string): string;
begin
ALink := StringReplace(ALink, 'ul.to/', 'uploaded.to/file/', [rfReplaceAll, rfIgnoreCase]);
ALink := StringReplace(ALink, '/?id=', '/file/', [rfReplaceAll, rfIgnoreCase]);
ALink := StringReplace(ALink, '?id=', 'file/', [rfReplaceAll, rfIgnoreCase]);
with TRegExpr.Create do
try
InputString := IncludeTrailingSlash(ALink);
Expression := 'uploaded.to/file/(.*?)/';
if Exec(InputString) then
Result := Match[1];
finally
Free;
end;
end;
var
I: Integer;
_postreply: TStringList;
_size: Int64;
begin
_size := 0;
with TIdHTTP.Create(nil) do
try
with TStringList.Create do
try
Text := AFiles;
for I := 0 to Count - 1 do
begin
_postreply := TStringList.Create;
try
_postreply.Text := Get('http://uploaded.to/api/file?id=' + GetDownloadlinkID(Strings[I]));
if _postreply.Count > 0 then
_size := _size + StrToIntDef(_postreply.Strings[1], 0);
finally
_postreply.Free;
end;
(*
Board Detector.rar
469412
2e91fe5831a1002b4b1cf6aabf54f8227bd9479c
*)
if (Count > 10) and (I > 0) then
begin
Sleep(2000);
if (I mod 10 = 0) then
Sleep(3000);
end;
end;
Result := RoundTo((_size / 1048576), -2);
finally
Free;
end;
finally
Free;
end;
end;
end.
@Mr Happy, my current script is adding a few thousand files per day, I think rapidshare API would limit me very quickly.
Looks like I will have to custom match with regex for each site!