fork download
  1. #!/usr/bin/python
  2. # A Dropbox Proxy that enables files to be downloaded despite proxies.
  3. # It works by requesting a file, via text file in your Dropbox. Your home computer downloads it and puts it in your Dropbox.
  4. # You can then download it via dropbox.com, assuming it's not blocked.
  5. # Screw the Firewalls!!!
  6.  
  7. def download(url, localFileName = None):
  8. localName = url2name(url)
  9. req = urllib2.Request(url)
  10. r = urllib2.urlopen(req)
  11. if r.info().has_key('Content-Disposition'):
  12. # If the response has Content-Disposition, we take file name from it
  13. localName = r.info()['Content-Disposition'].split('filename=')[1]
  14. if localName[0] == '"' or localName[0] == "'":
  15. localName = localName[1:-1]
  16. elif r.url != url:
  17. # if we were redirected, the real file name we take from the final URL
  18. localName = url2name(r.url)
  19. if localFileName:
  20. # we can force to save the file as specified name
  21. localName = localFileName
  22. f = open(localName, 'wb')
  23. f.write(r.read())
  24. f.close()
  25.  
  26.  
  27. dropbox = 'http://d...content-available-to-author-only...x.com/u/3884086'
  28. user = '3884086'
  29. file = '30.Rock.S06E05.Today.You.Are.a.Man.avi'
  30.  
  31. # file
  32. download(dropbox + '/' + user + '/' + file)
Runtime error #stdin #stdout 0.03s 6352KB
stdin
1
2
10
42
11
stdout
Standard output is empty