command-line rapidshare upload
If you want to upload something to rapidshare.com, quickly, and you only have command-line access, what do you do? This script was promising, but failed on line 30 because a regular expression didn’t match on something that turned out to be an empty (NoneType) object.
I replaced this code:
def upload(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("rapidshare.com", 80))
sock.send('GET /cgi-bin/rsapi.cgi?sub=nextuploadserver_v1 HTTP/1.0\r\n\r\n')
uploadserver = re.search('\r\n\r\n(\d+)', sock.recv(1000000000))
uploadserver = uploadserver.group().lstrip()
sock.close()
with this:
def upload(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("rapidshare.com", 80))
uls = sock.send('GET /cgi-bin/rsapi.cgi?sub=nextuploadserver_v1 HTTP/1.0\r\n\r\n')
uploadserver = str(uls)
sock.close()
and it worked. Update: Get it here.
July 6, 2010 at 7:43 pm
Can’t be bothered to help debug it, but it broke:
July 7, 2010 at 9:21 am
would seem to be an issue with the receive buffer? sock.recv(100000000) creates a buffer of that length; rapidshare has made some changes recently, so perhaps the new version returns too much stuff to fit in the buffer. Dunno what the other guy was doing using explicit memory allocation in python.
July 31, 2010 at 12:33 pm
how i got it working:
replace
result = sock.recv(100000000)
with
result = sock.recv(10000)
greetz
August 7, 2010 at 10:36 am
yes, that’s what I did – I have no idea why the OP did it that way