Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
R
RedditBot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matthew Ma
RedditBot
Commits
bf5caf6a
Commit
bf5caf6a
authored
Apr 02, 2018
by
Matthew Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished part 1
parent
3f3b720b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
Guide.txt
Guide.txt
+12
-0
MyBot.py
MyBot.py
+4
-2
praw.ini
praw.ini
+7
-0
No files found.
Guide.txt
0 → 100644
View file @
bf5caf6a
Guide:
http://pythonforengineers.com/build-a-reddit-bot-part-1/
To install Python 2.7:
https://www.python.org/downloads/release/python-2714/
To install pip:
https://pip.pypa.io/en/stable/installing/
-> download get-pip.py
To install praw, use the following command:
pip install praw
\ No newline at end of file
MyBot.py
View file @
bf5caf6a
#!/usr/bin/python
import
praw
import
praw
reddit
=
praw
.
Reddit
(
'bot1'
)
reddit
=
praw
.
Reddit
(
'bot1'
)
subreddit
=
reddit
.
subreddit
(
"learnpython"
)
subreddit
=
reddit
.
subreddit
(
"learnpython"
)
for
submission
in
subreddit
.
hot
(
limit
=
5
):
for
submission
in
subreddit
.
hot
(
limit
=
2
):
print
(
"Title: "
,
submission
.
title
)
print
(
"Title: "
,
submission
.
title
)
print
(
"Text: "
,
submission
.
selftext
)
print
(
"Text: "
,
submission
.
selftext
)
print
(
"Score: "
,
submission
.
score
)
print
(
"Score: "
,
submission
.
score
)
print
(
"---------------------------------
\n
"
)
print
(
"---------------------------------
\n
"
)
\ No newline at end of file
praw.ini
View file @
bf5caf6a
...
@@ -17,3 +17,10 @@ reddit_url=https://www.reddit.com
...
@@ -17,3 +17,10 @@ reddit_url=https://www.reddit.com
# The URL prefix for short URLs.
# The URL prefix for short URLs.
short_url
=
https://redd.it
short_url
=
https://redd.it
[bot1]
client_id
=
1Vx7MiwBKAvqOA
client_secret
=
TWC1yH1t_9pYivUmDUw0vitO8d4
password
=
P2.71828182i
username
=
IneffableApophasis
user_agent
=
PyEng Bot 0.1
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment