Created
January 8, 2014 17:21
-
-
Save moshekaplan/8320605 to your computer and use it in GitHub Desktop.
Check if an IMGUR ID is 'nsfw'
This file contains hidden or 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 pyimgur | |
| CLIENT_ID = "" | |
| im = pyimgur.Imgur(CLIENT_ID) | |
| blacklist = ['nsfw'] | |
| def is_fishy_imgur(id): | |
| # Takes an Imgur ID and returns True if it is fishy | |
| image = im.get_image(id) | |
| image_data = [] | |
| if image.title: | |
| image_data += [image.title] | |
| if image.description: | |
| image_data += [image.description] | |
| if image.section: | |
| image_data += [image.section] | |
| for entry in blacklist: | |
| for data in image_data: | |
| if entry in data: | |
| return True | |
| return False | |
| print is_fishy_imgur('6PX8AQN') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment