UploadScript für Rapid&Co coden

Dieses Thema im Forum "Linux & BSD" wurde erstellt von Beginner35, 18. März 2006 .

Schlagworte:
  1. 18. März 2006
    Ich würd gern n Uploadscript für Rapidshare, Datenklo usw coden. Ich weiß das ich die Datei im post modus an das uploadscript bei Rapi z.B. http://ul15.rapidshare.de/cgi-bin/upload.cgi?rsuploadid=149675695036859092 senden muss. Ich hab mir dafür mal curl angeschaut. Jetzt die Frage wie bekomm ich die uploadid, wie kann ich danach den Download- und Löschlink auslesen. Und ist das ganze überhaupt so ohne weiteres möglich?

    Beginner35

    // so hab jetzt n bisl rumprobiert und mit dem Befehl
    Code:
    curl -F "upload=@Bitratenrechner.exe" http://www.datenklo.net/upload.php >test.htm
    Bekomm ich folgende Ausgabe: Frubar Paste
    Jetzt bräucht ich nur noch n Programm das mir daraus durch angabe von name=textfeld den Downloadlink ausspuckt und durch angabe von name=textfeld4 den Löschlink.
     
  2. 18. März 2006
    man muss och eigentlich nur an die upload.cgi die daten senden oder? und das mit dem löschlink usw könnt man ja machen dass sich einfach der brwoser öffnet oder?
     
  3. 18. März 2006
    nomalerweiße schon allerdings brauch ich bei Rapid ne uploadid, bei Datenklo aber nicht denk ich. Das uploadscript gibt doch dann irgendwie die Adresse von der seite mit den Downloadlinks, weiß jemand wie ich an die Adresse komm? Wenn ich die Adresse hab wärs ja auch kein Problem mehr dieDownloadlinks rauszulesen.
     
  4. 18. März 2006
    Sonen Prog gibt es doch bereits, oder nicht?
    Also ich hab sowas
    Ist allerdings für Windows, aber ich denke das es das auch für Linux gibt, ansonsten kann man ja einfach Windows emulieren.
    Google einfach mal danach!
    mfg
     
  5. 18. März 2006
    Für Windows gibts sowas sicher.
    Aber ich will nicht irgendwas emulieren. Sondern Script dem ich Dateien übergeben kann die es dann hochläd. Sowas könnte ich dann auch ins Aktionsmenü vom Konqueror einbinden
     
  6. 20. März 2006
    guck ma bei datenklo da gibs son upload tool da is auch rapid mit drin und da wird nich die hp sondern die dl links so angezeigt und man kanns mitm script nochj welche dazu machn

    kannse dir ja ma angucken

    klick mich bitte nich so hart
     
  7. 20. März 2006
    Ich weiß ja nicht, aber vllt kannste damit was anfangen:

    Code:
    
    using System;
    using System.Windows.Forms;
    using System.Web;
    using System.Net;
    using System.IO;
    using System.Text;
    
    namespace LiveUploadInterface
    {
     
     public class Rapidshare : ILiveUpload
     {
    
     #region Variables and Properties
    
     private ProgressBar progress;
     private Label statuslabel;
    
     /// <summary>
     /// Progess bar
     /// </summary>
     public ProgressBar Progress
     {
     get
     {
     return progress;
     }
     set
     {
     progress = value;
     }
     }
     
     /// <summary>
     /// Status label
     /// </summary>
     public Label Statuslabel
     {
     get
     {
     return statuslabel;
     }
     set
     {
     statuslabel = value;
     }
     }
    
     #endregion
     
     /// <summary>
     /// Instanciates a new Rapidshare object
     /// </summary>
     public Rapidshare()
     {
     
     }
    
     /// <summary>
     /// Defines Upload procedure
     /// </summary>
     /// <returns>Upload result</returns>
     public string Upload(string filename)
     {
     System.Net.ServicePointManager.Expect100Continue = false;
     string url = GetUploadUrl();
    
     string boundary = "---------------------------23281168279961";
     this.statuslabel.Text = "Create Request...";
     FileInfo info = new FileInfo(filename);
    
     HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
     req.ContentType = "multipart/form-data; boundary=" + boundary;
    
     string header = GetHeader(info.Name);
     long length = info.Length;
    
     byte[] PostHeaderBytes = Encoding.ASCII.GetBytes(header);
     byte[] PostTrailingBoundaryBytes = Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
     byte[] PostTrailingBoundaryBytes2 = Encoding.ASCII.GetBytes("\r\n--" + boundary + "--" + "\r\n");
     
     req.Method = "POST";
     req.AllowWriteStreamBuffering = true;
     req.KeepAlive = false;
     req.Referer = "http://www.rapidshare.de/";
     req.Accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
     //req.ContentLength = header.Length + length + boundary.Length + "--".Length + "\r\n\r\n".Length + 2;
     req.ContentLength = PostHeaderBytes.Length + info.Length + PostTrailingBoundaryBytes2.Length;
     
     using(Stream reqstream = req.GetRequestStream())
     {
     this.statuslabel.Text = "Uploading...";
     this.statuslabel.Update();
     this.statuslabel.Refresh();
     reqstream.Write(PostHeaderBytes,0,PostHeaderBytes.Length);
     
     using (FileStream fs2 = info.OpenRead())
     {
     string fname = (info.Name.Length > 20) ? info.Name.Substring(0,20) + "..." : info.Name;
     this.progress.Step = 4096;
     byte[] bufferbytes = new byte[4096];
     int bytesread;
     while(fs2.Position < fs2.Length)
     {
     if(fs2.Position % 4096 > 0)
     {
     bytesread = fs2.Read(bufferbytes,0,Convert.ToInt32(fs2.Position % 4096));
     reqstream.Write(bufferbytes,0,bytesread);
     break;
     }
     else
     {
     bytesread = fs2.Read(bufferbytes,0,bufferbytes.Length);
     reqstream.Write(bufferbytes,0,bytesread);
     }
     this.progress.PerformStep();
     this.statuslabel.Text = "Uploading " + fname + ": " + Convert.ToString((fs2.Position / 1024)) + " KB" +
     " / " + Convert.ToString((info.Length / 1024)) + " KB";
    
     }
     
     reqstream.Write(PostTrailingBoundaryBytes2,0,PostTrailingBoundaryBytes2.Length);
     reqstream.Flush();
     }
     }
    
     
     string result = GetResponse(req);
    
     this.statuslabel.Text = "";
     this.statuslabel.Update();
     this.statuslabel.Refresh();
     return result;
     }
    
     private string GetUploadUrl()
     {
     WebClient wc = new WebClient();
     string resp = Encoding.UTF8.GetString(wc.DownloadData(@"http://www.rapidshare.de"));
    
     int dlindex = resp.IndexOf("action");
     int findex = resp.IndexOf("\"",dlindex,resp.Length - dlindex);
     int lindex = resp.IndexOf("\"",findex+1,resp.Length - findex - 2);
     return resp.Substring(findex + 1,lindex - findex -1);;
    
     }
    
     private string GetHeader(string filename)
     {
     string boundary = "---------------------------23281168279961";
     StringBuilder sbuilder = new StringBuilder();
     sbuilder.Append("--");
     sbuilder.Append(boundary);
     sbuilder.Append("\r\n");
     sbuilder.Append("Content-Disposition: form-data; name=\"filecontent\"; filename=\""+filename+"\"");
     sbuilder.Append("\r\n");
     sbuilder.Append("Content-Type: application/octet-stream");
     sbuilder.Append("\r\n");
     sbuilder.Append("\r\n");
    
     return sbuilder.ToString();
     }
    
    
     private string GetResponse(HttpWebRequest req)
     {
     HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
     string response = "";
     this.statuslabel.Text = "Waiting for Response...";
     this.statuslabel.Update();
     this.statuslabel.Refresh();
    
     using (Stream respstream = resp.GetResponseStream())
     {
     using(StreamReader reader = new StreamReader(respstream))
     {
     response = reader.ReadToEnd();
     }
     }
     resp.Close();
     return ParseResponse(response);
     }
    
     private string ParseResponse(string s)
     {
     string ret = "";
     
     if(s.IndexOf("Download-Link") > -1)
     {
     int dlindex = s.IndexOf("Download-Link");
     int findex = s.IndexOf("\"",dlindex,s.Length - dlindex);
     int lindex = s.IndexOf("\"",findex+1,s.Length - findex - 2);
     string dllink = s.Substring(findex + 1,lindex - findex -1);
     ret = "Download-Link: " + dllink;
     }
     else
     {
     ret = "Error";
     }
    
     if(s.IndexOf("Delete-Link") > -1)
     {
     int delindex = s.IndexOf("Delete-Link");
     int delfindex = s.IndexOf("\"",delindex,s.Length - delindex);
     int dellindex = s.IndexOf("\"",delfindex+1,s.Length - delfindex - 2);
     string dellink = s.Substring(delfindex + 1,dellindex - delfindex -1);
     ret += "\r\n" + "Delete-Link: " + dellink;
     }
    
     return ret;
     }
     }
    }
    
    
    
     
  8. 21. März 2006
    Hat zwar damit nicht wirklich was zu tun, aber deine 10er bekommst weil dir ja n bisl mühe gegeben hast.

    @z4ratustra: Was ist das für ein Script, Bash ist es auf jedenfall nicht.

    Ich hab das jetzt größtenteils gelöst fürs datenklo funktioniert es schon, wenns fertig ist werd ichs natürlich posten.
     
  9. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.