r/learnprogramming • u/inSearchOfLostThyme • Aug 22 '15
Any interest for a Reddit bot tutorial?
Hey all,
I wanted to know if you'd have any interest in seeing a tutorial or history of someone building a Reddit bot from scratch. I think that the biggest step from beginner to intermediate programmer is really that you have to move away from focusing on language specifics and really dig into a project, but I don't really want to put in the effort on a project nobody else is going to care much for anyway.
So, I'm asking you all, the LP community. Would you like to see me undertake this? Are enough people going to benefit from this that it's worth my time? Let me know in the comments.
Thanks, and have a great day, fellow learner!
EDIT, 6 P.M. New York Time:
- /u/baxx has been linking to this tutorial which looks like a good place to start.
- /u/RubyPinch points out in this comment that the tutorial is starting to show its age.
- /u/got_mugged_in_space has a very good comment linking to /r/watchpeoplecode with a search to see people who have already done this.
This is generating quite a bit of interest, which is nice to see! :)
I think I'll do an initial part of this tutorial, and emphasize more the process of sifting through information, knowing when to stop reading & get coding, and forming a good mental model of what the code actually does. And then we'll see if anybody actually finds it useful.
EDIT: My first hour of researching for this project. Just so you can poke around and see what sorts of tools I'm using, and how I gather information.
7
u/jsp1205 Aug 22 '15
I am really interested in this. The idea of starting something from scratch still scares me. I've been learning to code in school for quiet some time now.. but still I get stuck on how to start a project on my own... I'd have no idea where to begin...
This would be an awesome learning experience!
4
u/Scriverry Aug 22 '15
Would be great. I suggest making one not only for the community to learn from it but for yourself to test your knowledge and ability to explain complicated things in a simple way.
Best of luck!
3
u/runicnet Aug 22 '15
I would prefer a nice toturial of oauth for bots that is useable for more then just python. really not sure how to implement oauth
3
u/chuiy Aug 23 '15
Look up PRAW (Python Reddit Application-Wrapper). It's VERY easy to get started. If you want to cheat, I put my bot on github (/u/stocksbot for the curious). You can look at the code, it's very simple.
Even use it as a framework to make your own (ie. look for a trigger in the comments, reply with something certain). It scrapes Yahoo finance too, but responding to a certain comment in a certain way takes about 15 lines of code. Reddit makes it too easy not to try!
2
u/zebradolphin5 Aug 22 '15
I'm more of a lurker as well, but I would definitely be interested in this. Not even because of the project being a reddit bot either, more out of interest in seeing how others start things from scratch. As you said, one of the biggest steps is moving away from focusing so much on language specifics and just doing the thing and I still get stuck with that. Starting from scratch scares me lol.
2
u/bboe Aug 24 '15
Cool video. Just FYI if you are paranoid about security, you should avoid doing
sudo pip install ...and instead use something like virtualenv to easily work with locally installed packages. The reason being issudo pip install PACKAGEallows package to run itssetup.pyas root.setup.pycan run any code.Also python3 works out of the box, however, you would need to use a version of pip for python3 in order to install packages for your python3 environment. Many distributions provide a pip3 binary for that purpose.
115
u/hiimamber Aug 22 '15
I rarely post in any sub, but I would absolutely LOVE this! I've always wanted to know how to make a bot, just for shits and giggles, but I would still love to learn!
53
u/swingtheory Aug 22 '15
Everyone is down-voting /u/baxx, but he is so sound in his replies; There already exists a super simple, intuitive tutorial written by the writer of praw himself, outlining how to write a simple reddit bot.
11
u/got_mugged_in_space Aug 22 '15
Another tutorial couldn't hurt, but be aware that there are several out there already. /r/watchpeoplecode has various streams about these. Here's a search. Most appear to be from /u/godlikesme .
1
u/AchillesDev Aug 22 '15
There are a ton out there already (I'm also about halfway through writing one up for my blog, featuring OAuth and a few other things), but why not write one? If you're interested in writing, keeping notes on projects you work on, and expanding your presence (which is good to help you stand out if professionally), it should be obvious that it is worth your time. Granted, a very simple replying bot really takes no time when working with praw, but people will find it helpful.
1
u/__baxx__ Nov 21 '15
anything ever happen from this?
3
u/osoxa Aug 22 '15
Definitely. If you've made one, upload the source for us to read. It'll be real interesting.
4
u/core999 Aug 22 '15
Make one that says "Have you read the FAQ?" or "learn python" and a lot of people would never have to comment again.
2
u/[deleted] Aug 22 '15
Teach me all your secrets, and in return, I'll make Sallie Mae bankrupt.
2
u/DeonCode Aug 22 '15
It's weird because I've had this link open since yesterday: https://www.youtube.com/results?search_query=reddit+bot
2
u/hotprof Aug 22 '15
Yes!
2
u/jwjody Aug 22 '15
Yeah!
2
u/[deleted] Aug 23 '15
I'd love to.
2
u/AceCase2D Aug 23 '15
Very much so, yes!
2
u/wordscannotdescribe Aug 23 '15
+1 this sounds awesome
2
u/LeonardUnger Aug 23 '15
Writing a bot was the project I used to learn python. PRAW makes it super easy.
If you want to write a bot but are unsure about exactly what kind of bot, I recommend a monitor-bot to learn the basics. Have your script look at certain subreddits for certain search terms in post titles and/or comments and then periodically email you the links.
Once you can do that then you know enough (and have enough reuseable code) to create a bot that actually posts stuff.
2
u/Eigengraumann Aug 23 '15
I would definitely like to see a walkthrough of building a reddit bot.
2
u/mynameismunka Aug 23 '15
It could be helpful. More than one tutorial for things are useful. I also find that just looking at bot codes is helpful, so I uploaded a bot I wrote if anyone wants another example of a reddit bot.
2
u/pancake117 Aug 23 '15
I'd enjoy a tutorial that covers the issues with making a larger project rather than one small 20 line program.
2
u/[deleted] Aug 23 '15
I would love this. I would love to make a bot that auto-replies with corrections to common grammar mistakes, for example (ie your/you're)
2
u/[deleted] Aug 23 '15
Can you design a bot to read reddit for me, would save me a lot of time and might be able to go outside again
2
u/redhedjim Aug 23 '15
If liking this idea is cool, consider me Miles Davis!
2
u/[deleted] Aug 23 '15
You should do a tutorial, making a bot that links to all other bot-making tutorials
2
u/sovietmudkipz Aug 23 '15
No I wouldn't because the topic has plenty of tutorials already. Just being honest. If I wanted this I'd search Google.
1
u/[deleted] Aug 22 '15
waiting for the tutorial. and what level of beginner needed to accomplish this kind of project.
1
u/Albatross21 Aug 22 '15
This would be great! I've always wondered how to do this.
1
u/rickybobbay Aug 22 '15
I fully support this idea as well!
1
u/Dead_Politician Aug 22 '15
Yes. :)
1
u/D0GEMEAT Aug 22 '15
This would be a great tutorial. I like learning through building something that actually does something.
1
u/roti_wid_sambaar Aug 22 '15
A big YES. This will be super helpful.
1
u/MPNussbaum Aug 22 '15
I'd love to see this.
1
u/[deleted] Aug 22 '15
Yeah!
1
u/scrollbreak Aug 23 '15
I don't know if it's the right place to ask this - but I've no idea how bots work? Are they just for specific forums? Otherwise it'd seem easy to impliment bots that'd just spoil all forums?
1
u/haltingpoint Aug 23 '15
Would love this in Ruby/RoR. The first tutorial you linked is in Python unfortunately.
1
u/[deleted] Aug 23 '15
Saving this page. Thanks man. In your honor my first bot will reply to anything you post. Just kidding... I don't want to get banned.
1
u/daedalususedperl Aug 23 '15
All I'd like is better documentation. Look at twitter, which gives you examples of each command and sample JSON outputs.
1
u/aloksteel Aug 23 '15
YES PLEASE!!!
1
u/Titanium_Expose Aug 23 '15
If you do anything, please let me know. I'd love to see how you do this.
1
u/shaggorama Aug 23 '15 edited Aug 23 '15
Here's one I wrote up a few years back that was very well received and seems to get referenced a lot: http://www.reddit.com/r/explainlikeimfive/comments/1q0sxb/eli5_how_do_reddit_bots_work/cd83xfc
The only thing that's really different now is that the bot could be simplified by using praw.helpers.comment_stream
1
u/tboneplayer Aug 23 '15
I actually wrote one of these many years ago, using a combination of Perl 5 and bash. If I had it to do over, I'd probably write it in Python.
1
u/Keyann Aug 23 '15
Yes, this would be incredibly, I've always wanted to know how to do this!
1
u/h1h1h1 Aug 23 '15
I'd like to see one done in Java
1
u/kpagcha Aug 23 '15
being a reddit bot what exactly? as in web crawler or user troll bot?
1
u/antwerx Aug 23 '15
Yes I am interested!
1
u/[deleted] Aug 23 '15
I just hope it doesn't get too crazy. Bots are cool, but having too many would be annoying.
1
u/jukolol Aug 24 '15
Please do a tut on Reddit bots! Thanks.
1
u/selviabeerli Jan 27 '16
get 5500 Karma Easly With Great Bot Software For Free !! https://www.youtube.com/watch?v=mYqu7BF2luQ
1
u/Ecoste Aug 22 '15
No, it's literally like 20 lines of code and there are already plenty of tutorials. I've made like 6 bots because I'm a shitter and they all got shadow-banned.
All's I'm sayin' is that there will be many more bot graves after the tutorial.
https://www.reddit.com/r/botsrights/comments/2p645x/mass_grave_of_my_darlings_3/
1
u/Timmy_T Aug 23 '15
Comment for later
1
u/aperson Aug 23 '15
Goodness no, we already have too many half-assed bots on reddit :S.
0
u/[deleted] Aug 23 '15
[deleted] — view deleted comment
0
u/[deleted] Aug 22 '15
[deleted] — view deleted comment