Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import os
- import urllib
- from praw.models import Submission
- from StringIO import StringIO
- from PIL import Image
- Ifolder = open('C:\Users\mickey b\Pyfiles\RedditImage', 'w')
- _image_formats = ['.bmp','.gif','.jpg','.jpeg','.png']
- r = praw.Reddit(client_id = 'VNdvfXhYeJE3EA',
- client_secret = 'd4rIE0sk2I9wo-NKRxarVkFMCKg' ,
- username='Touch_This_Guy',
- password='Saxophone89',
- user_agent='prawtutorial')
- saved = r.user.me().saved(limit=None)
- count = 0
- for item in saved:
- for xx in _image_formats:
- new_list = [xx]
- if isinstance(item, Submission):
- if item.url.endswith(tuple(_image_formats)):
- jj = Image.open(StringIO(urllib.urlopen(item.url).read()))
- jj.save('C:\Users\Mickey B\pyfiles\Redditimages\\'+str(count)+ ' '+ str(item) + xx)
- count += 1
Add Comment
Please, Sign In to add comment