Created
November 11, 2018 21:54
-
-
Save sergiolucero/0d3fd07c4591bd91f330282ea15c6ebc to your computer and use it in GitHub Desktop.
download s3 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| import os, sys | |
| s3 = boto3.resource('s3') | |
| def down(canal,token): | |
| x = os.popen(f'lss3 matinales/audio/{canal}/|find "{token}"').read() | |
| files=[f for f in x.split() if 'mp3' in f] | |
| print(files) | |
| for f in files: | |
| g=f.split('/')[-1] | |
| print(f,g) | |
| s3.Bucket('matinales').download_file(f,g) | |
| if __name__ == '__main__': | |
| canal, token = sys.argv[1:] | |
| down(canal, token) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment