-
Notifications
You must be signed in to change notification settings - Fork 0
/
collect_pasta.py
36 lines (27 loc) · 966 Bytes
/
collect_pasta.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import praw
import json
# Loads Settings
with open("reddit_details.json", 'r') as i:
settings = json.loads(i.read())
# Creates Reddit object to read submissions
reddit = praw.Reddit(client_id=settings['client_id'],
client_secret=settings['client_secret'],
user_agent=settings['user_agent'],
username=settings['username'],
password=settings['password'])
sorting_type = "top"
pastas = reddit.subreddit("copypasta").top(limit=10000)
pastas_new = reddit.subreddit("copypasta").new(limit=10000)
pastas_hot = reddit.subreddit("copypasta").hot(limit=10000)
text = ""
for pasta in pastas:
if pasta.is_self:
text += pasta.selftext
for pasta in pastas_new:
if pasta.is_self:
text += pasta.selftext
for pasta in pastas_hot:
if pasta.is_self:
text += pasta.selftext
with open("data.txt", 'w+', encoding='utf-8') as output:
output.write(text)