Skip to content

Instantly share code, notes, and snippets.

@howyi
Last active September 10, 2015 18:01
Show Gist options
  • Save howyi/389086b330d184caa7e3 to your computer and use it in GitHub Desktop.
Save howyi/389086b330d184caa7e3 to your computer and use it in GitHub Desktop.
Image
# coding: utf-8
# Python 3.4.3
# tweepy 3.3.0
#中略
api = tweepy.API(auth_handler=auth)
s = api.get_status(607174780312158208)
try:
j = 0
for i in s.extended_entities['media']:
print(i['media_url'])
img = urllib.request.urlopen(i['media_url'])
localfile = open(str(s.id) + str(j), 'wb')
localfile.write(img.read())
img.close()
localfile.close()
j = j+1
except:
print('画像がありません')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment