imgur URLs

108 views
Skip to first unread message

Yves Dorfsman

unread,
Nov 9, 2014, 6:13:24 PM11/9/14
to im...@googlegroups.com
When finding imgur URLs in the wild, before I can use the API to retrieve metadata, I need to figure out if the links is for an image, an album or a gallery. Can I rely on the URL for this? Are URLs always following these patterns:

imgur.com/{id}             (image)
imgur.com/a/{id}          (album)
imgur.com/gallery/{id}  (gallery)


Would it make sense to add an API call to return the type based on an id?

Thanks.

@jasdev

unread,
Nov 10, 2014, 2:46:42 PM11/10/14
to im...@googlegroups.com
Yep! That URL schema is correct!

It is actually difficult to make an endpoint to return the type based on id. This is because the set of possible IDs (refer to them as hashes internally) is split across two different tables (e.g. it is possible to have an album and image with the same hash).

Hope this clears up things, let me know if you have any additional questions!

Best,

Jasdev

Yves Dorfsman

unread,
Nov 10, 2014, 9:54:56 PM11/10/14
to im...@googlegroups.com
Thanks.

Yves Dorfsman

unread,
Nov 13, 2014, 2:33:53 AM11/13/14
to im...@googlegroups.com
One more question. Is the fragment only valid in the case of a link to a picture inside an album:

imgur.com/a/{album_id}/#{image_id}

Or can a fragment be used with a gallery or an image as well?

@jasdev

unread,
Nov 13, 2014, 2:12:47 PM11/13/14
to im...@googlegroups.com
Only valid when encountering a link to a picture inside an album!

Yves Dorfsman

unread,
Nov 14, 2014, 5:31:56 AM11/14/14
to im...@googlegroups.com
Thanks @jasdev.

Recapitulating, for reference:

imgur.com/{image_id}                       (image inside html)
imgur.com/{image_id}.extension        (direct link to image)
imgur.com/a/{album_id}                    (album)
imgur.com/a/{album_id}#{image_id}   (single image from an album)
imgur.com/gallery/{image_id}            (gallery)

Any way to add something like this to the API doc?

RepostStatistics

unread,
Feb 4, 2015, 5:45:22 PM2/4/15
to im...@googlegroups.com
I know it is an old post, but just for future readers:
imgur.com/{image_id}.extension works but is a redirect to
i.imgur.com/{image_id}.extension

Yves Dorfsman

unread,
Feb 4, 2015, 8:56:49 PM2/4/15
to im...@googlegroups.com
You should create a Pull Request to add it to https://github.com/Imgur/imgurpython/blob/master/README.md
Reply all
Reply to author
Forward
0 new messages