Skip to content

Instantly share code, notes, and snippets.

@lucindo
Created July 31, 2010 00:53
Show Gist options
  • Save lucindo/501564 to your computer and use it in GitHub Desktop.
Save lucindo/501564 to your computer and use it in GitHub Desktop.
import urllib, sys
from BeautifulSoup import BeautifulSoup
if __name__ == '__main__':
if len(sys.argv) != 2:
print "usage: %s <amazon s3 url>" % sys.argv[0]
sys.exit(1)
base_url = sys.argv[1]
xml = urllib.urlopen(base_url).read()
soup = BeautifulSoup(xml)
for content in soup.findAll("contents"):
if content.key.string.find("$folder$") == -1:
file_url = base_url + "/" + content.key.string
print "downloading: %s" % file_url
urllib.urlretrieve(file_url, content.key.string.replace("/", "_"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment