Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import discord
- import urllib
- reddit = praw.Reddit(client_id = 'id',
- client_secret = 'secret',
- username = 'user',
- password = 'pw',
- user_agent = 'agent')
- client = discord.Client()
- subred = reddit.subreddit('cutetraps').top(limit=10000)
- i = 0
- for submission in subred:
- if not (submission.over_18 or len(submission.url) > 40):
- pic = submission.url
- print(submission.url)
- if pic.endswith('.jpg'):
- resource = urllib.request.urlopen(pic)
- output = open("pic{}.jpg".format(i), "wb+")
- output.write(resource.read())
- output.close()
- i += 1
- if pic.endswith('.png'):
- resource = urllib.request.urlopen(pic)
- output = open("pic{}.png".format(i), "wb+")
- output.write(resource.read())
- output.close()
- i += 1
- else:
- print('nope')
- client.run('token')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement