Created
June 2, 2020 08:49
-
-
Save shohei/c91553906592fd63e4f0e91b1376f1c3 to your computer and use it in GitHub Desktop.
Slack download
This file contains 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 json | |
import os | |
import random | |
with open('data.txt') as json_file: | |
data = json.load(json_file) | |
for p in data: | |
if "files" in p: | |
q = p['files'][0] | |
if "mimetype" in q: | |
mimetype = q["mimetype"] | |
if "image" in mimetype: | |
name = str(random.getrandbits(32))+"_"+q["name"] | |
url = q["url_private_download"] | |
cmd = "wget -O "+"'"+name+"'"+ " "+url | |
print(cmd) | |
os.system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment