RS remote uploader
Page 1 of 1
RS remote uploader
I have coded this remote uploader in Java. Before using this method, I used the method with the shortening URL services, but I am now using a different approach, which only requires link manipulation, but it is all built in. Compile this source with the Java compiler and it should work.
Changelog:
v 0.1.4 - Added Renaming
v 0.1.3 - Added uploading to Collector's account
v 0.1.2 - Changed to a different way of producing links - no URL shortening service
v 0.1.1 - Now deletes all the links in the upload queue, before uploading new links.
v 0.1.0 - First release
What's to come:
So here is the actual source code:
DirectUploader.java
Changelog:
v 0.1.4 - Added Renaming
v 0.1.3 - Added uploading to Collector's account
v 0.1.2 - Changed to a different way of producing links - no URL shortening service
v 0.1.1 - Now deletes all the links in the upload queue, before uploading new links.
v 0.1.0 - First release
What's to come:
- GUI when the main things are done
So here is the actual source code:
DirectUploader.java
- Code:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.DataOutputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.Writer;
import java.net.*;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
public class DirectUploader {
String pUsername=""; //Username of the premium account
String pPassword=""; //Password of the premium account
String uUsername=""; //Username of the uploading account
String uPassword=""; //Password of the uploading account
String allLinks="";
public DirectUploader() {
File file = new File("rapidLinks.txt");
file.delete();
getAccounts();
deleteRemote();
makeLinks();
upload("rapidLinks.txt");
}
public String getAccounts(){
try{
FileInputStream fstream = new FileInputStream("accounts.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
pUsername = br.readLine();
pPassword = br.readLine();
uUsername = br.readLine();
uPassword = br.readLine();
in.close();
}
catch(Exception e){}
return "";
}
public String upload(String filePath){
String allLinks="";
try{
FileInputStream fstream = new FileInputStream(filePath);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
allLinks = allLinks+"\n"+strLine;
}
System.out.println(allLinks);
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?login="+uUsername+"&password="+uPassword);
//GetMethod method2 =new GetMethod("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?urls="+allLinks+"&remotegets=1");
PostMethod post = new PostMethod("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?remotegets=Remote-Uploads");
NameValuePair[] data = {
new NameValuePair("urls", allLinks),
new NameValuePair("remotegets", "1"),
};
post.setRequestBody(data);
client.executeMethod(method);
client.executeMethod(post);
method.releaseConnection();
post.releaseConnection();
}
catch(Exception err){}
File file = new File(filePath);
file.delete();
JOptionPane.showMessageDialog(null, "Files Uploading");
return "";
}
public String deleteRemote(){
try{
URL rapidshare = new URL("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?login="+uUsername+"&password="+uPassword+"&remotegets=1");
BufferedReader in2 = new BufferedReader(new InputStreamReader(rapidshare.openStream()));
String inputLine="";
String fileID="";
while ((inputLine = in2.readLine()) != null){
Pattern pattern = Pattern.compile("javascript:loeschfragen\\(\'(.*)\', \'5\'\\);\">", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(inputLine);
while (matcher.find()){
fileID = matcher.group(1);
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?login="+uUsername+"&password="+uPassword+"&remotegets=1&killjobs=1&killjob-"+fileID+"=1");
client.executeMethod(method);
System.out.println("File deleted");
method.releaseConnection();
System.out.println(fileID);
Thread.sleep(1000);
}
}
}
catch(Exception e){}
return "";
}
public String makeLinks() {
try{
FileInputStream fstream = new FileInputStream("links.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
String newLink="";
String server="";
String fileNumber="";
String fileName="";
Pattern pattern = Pattern.compile("http://rapidshare.com/files/(.*?)/(.*)", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(strLine);
while (matcher.find()){
fileNumber = matcher.group(1);
fileName = matcher.group(2);
}
URL rapidshare = new URL("http://rapidshare.com/cgi-bin/checkfiles.cgi?urls="+strLine);
BufferedReader in2 = new BufferedReader(new InputStreamReader(rapidshare.openStream()));
String inputLine;
while ((inputLine = in2.readLine()) != null){
Pattern pattern2 = Pattern.compile("<table width=\"100%\"><tr valign=top><td>File is on server number: (.*?):", Pattern.CASE_INSENSITIVE);
Matcher matcher2 = pattern2.matcher(inputLine);
while (matcher2.find()) {
server = "rs"+matcher2.group(1);
}
}
//in2.close();
System.out.println("Server:"+server+" File number:"+fileNumber+" File name:"+fileName);
newLink = "http://"+pUsername+":"+pPassword+"@"+server+"l33/files/"+fileNumber+"/dl/"+fileName;
System.out.println(newLink);
if(!newLink.equals("")){
File file = new File("rapidLinks.txt");
Writer output = null;
output = new BufferedWriter(new FileWriter(file, true));
output.write(newLink+"\n");
output.close();
}
}
in.close();
}
catch(Exception e){}
return "";
}
public static void main(String[] args) {
DirectUploader d = new DirectUploader();
}
}
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum