-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (29 loc) · 953 Bytes
/
main.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#I_AM_THE_REAL_KEVIN
#conversationbot
import praw
from Markov import Markov
import time
import pickle
from cStringIO import StringIO
username = "I_AM_THE_REAL_KEVIN"
password = "conversationbot"
kevin = praw.Reddit(user_agent="Hi, my name is Kevin")
kevin.login(username, password, disable_warning=True)
def main():
submissions = kevin.get_subreddit("AskReddit").get_hot(limit=1000)
commentList = list()
grababunchofcomments(submissions)
# markov = Markov(4)
# for submission in submissions:
# for comment in submission.comments:
# if type(comment) is praw.objects.Comment:
# markov.trainingComment(comment.body)
# for i in range(10):
# print "%d: %s" % (i,markov.generateComment())
def grababunchofcomments(submissions):
output = open('data.pkl', 'wb')
for submission in submissions:
for comment in submission.comments:
if type(comment) is praw.objects.Comment:
pickle.dump(comment, output)
main()