0

What I am trying to do, is to download the latest uploaded picture with Python.

I know how to download a certain image by using the following code:

import urllib

def download_an_image(image_url):

    filename = 'glitch.jpg'
    urllib.urlretrieve(image_url, filename)

    return filename

But how do I tell Python to download the latest image from a given Tumblr account?

Lucas W
  • 43
  • 6
  • The code you posted is pretty generic download code (missing indentation btw.) and it's not Tumbler-related as such. You need to work with the Tumbler API or scrape it somehow. – jDo Mar 29 '16 at 12:07
  • The question is probably a little unclear, without knowing the context. My idea is to have a program that downloads an image, does some glitching with it, uploads it to my tumblr, then downloads it again and so on. I already have the glitching part and I know how to upload it again with the use of the Tumblr API. I just do not know how to tell it to download the latest picture. – Lucas W Mar 29 '16 at 16:17
  • You can use the tumblr API method described here to get the latest posts of a certain type: https://www.tumblr.com/docs/en/api/v2#posts, but you'll have to create an API key first. – Daniel Diekmeier Mar 29 '16 at 16:18

0 Answers0