Add files I forgot in the last commit

This commit is contained in:
Roland Rytz 2017-04-04 20:12:45 +02:00
parent 0b010f6409
commit 9fccb56cef
2 changed files with 28 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
credentials
praw
temp.js

24
redditcrawl.py Executable file
View File

@ -0,0 +1,24 @@
#6y7LtOjoNEfe72g62kZfwtFHMWkQ8XsZvcQ8xZDe
import praw
outfile = open('temp.js', 'w')
credentials = open('credentials', 'r')
client_id = credentials.readline().strip(' \t\n\r')
client_secret = credentials.readline().strip(' \t\n\r')
startId = 438
reddit = praw.Reddit(client_id=client_id, client_secret=client_secret, user_agent='atlas_bot')
for submission in reddit.subreddit('placeAtlas').new(limit=1000):
if(submission.link_flair_text == "New Entry"):
text = submission.selftext
text = text.replace("\"id\": 0", "\"id\": "+str(startId))
startId = startId + 1
outfile.write(text+",")
print("written "+submission.title)
else:
print("skipped "+submission.title)