Last active
September 10, 2015 18:01
-
-
Save howyi/389086b330d184caa7e3 to your computer and use it in GitHub Desktop.
Image
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
# 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