Giter Club home page Giter Club logo

explainxkcdbot's Introduction

explainxkcdbot

A Reddit bot that posts explanation of the xkcd links posted in the comments. The explanation is extracted from the explain xkcd wiki (http://explainxkcd.com)

Requirements

  1. Python 3
  2. pip for Python 3 (recommended)
  3. PRAW
    • Install using pip3 by running pip3 install praw or sudo -H pip3 install praw if it requires escalated privileges.
  4. Python Requests
    • Install using pip3 by running pip3 install requests or sudo -H pip3 install requests if it requires escalated privileges.
  5. Beautiful Soup 4
    • Install using pip3 by running pip3 install beautifulsoup4 or sudo -H pip3 install beautifulsoup4 if it requires escalated privileges.

Obtaining Reddit API access credentials

  1. Create a Reddit account, and while logged in, navigate to preferences > apps
  2. Click on the are you a developer? create an app... button
  3. Fill in the details-
    • name: Name of your bot/script
    • Select the option 'script'
    • decription: Put in a description of your bot/script
    • redirect uri: http://localhost:8080
  4. Click create app
  5. You will be given a client_id and a client_secret. Keep them confidential.

How to run it

  1. Clone or download (and extract) this repository and navigate to it's directory
  2. Create a file named praw.ini with it's contents as:
    [explainbot]
    username: reddit username
    password: reddit password
    client_id: client_id that you got
    client_secret: client_secret that you got
    
  3. Create a blank text file named commented.txt inside the project directory
  4. In explainxkcdbot.py, replace the value of path with the location of your commented.txt.
  5. At a minimum, three files, namely explainxkcdbot.py, praw.ini and commented.txt are required for the bot to run.
  6. Type python3 explainxkcdbot.py in the Terminal to run the bot.
  7. If the Reddit API returns an error due to too many requests, adjust val in the instances of time.sleep(val) in explainxkcdbot.py

explainxkcdbot's People

Contributors

aydwi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.