Giter VIP home page Giter VIP logo

blackbart's Introduction

Black Bart

PROBLEM

I don't like trawling through email lists that I'm not taking part in, but I like reading what smart people have to say about technical things.

Solution

This project mirrors mailing lists on subreddits, to make it easier to browse and read messages. You can see it in action with the bitcoin-development mailing list on r/bitcoin_devlist.

To achieve the goal, I've created a Django app with the following components:

  1. A miner that consumes the mailing list from within a Django management shell command and saves the data to Django models.
  2. Another Django management command that posts top-level messages to the subreddit as submissions.
  3. One last Django management command that posts comments to their relevant submissions on the subreddit.

TODO:

  1. Move Reddit authentication to OAuth: https://www.reddit.com/comments/2ujhkr/

Quick Start

  1. Install virtualenvwrapper
  2. mkvirtualenv blackbart
  3. Clone the blackbart directory w/ something like git clone https://github.com/kvnn/blackbart.git
  4. Go into the blackbart directory in your terminal
  5. pip install -r requirements.txt
  6. Set up a database and include the connection info in .env
  7. python manage.py makemigrations
  8. python manage.py migrate
  9. Create your subreddit, and include the credential info in .env
  10. python manage.py mine
  11. python manage.py submissions_to_reddit
  12. python manage.py comments_to_reddit

Architecture

.env file

This is mandatory, as some Django and Reddit (praw) settings are expected to be stored here. See .env_sample for a starting point. Note that DJANGO_SETTINGS_MODULE should be changed if you want to put in a production, or whatever, settings file.

export DJANGO_SETTINGS_MODULE="blackbart.settings.dev"
export BASE_API_URL="http://127.0.0.1:8001"
export REDDIT_BITCOIN_DEV_SUBREDDIT="bitcoin_devlist"
export REDDIT_BITCOIN_DEV_UA='bitcoin-dev blackbart by /u/kvnn'
export REDDIT_BITCOIN_DEV_USERNAME="bitcoin-devlist-bot"
export REDDIT_BITCOIN_DEV_PW="my_stupid_password"
export DB_ENGINE="django.db.backends.postgresql_psycopg2"
export DB_NAME="postgres_db_name"
export DB_HOST="127.0.0.1"
export DB_PORT="5432"
export DB_USERNAME="postgres_username"
export DB_PASSWORD="postgres_password"

App name

If you fork this and change the name, do a global search & replace for "blackbart". There are some config files with the app name, like manage.py and settings/init.py.

API

I've included an api and some endpoints for convenience after running the miner. After running the miner, I like to visit /api/v1.0/messages/top-level/new/ to see new top-level messages and /api/v1.0/messages/new/ to see all new messages. I then visit them again after running the reddit-submission-submitter and the reddit-comment-submitter.

Miner

The miner app uses the mine Django management command to scrape the mailing list specified in .env. The scraping is done by a Scrapy spider in spiders.py, which sends data to pipelines.py for saving.

Distributor

The distributor uses the submissions_to_reddit & comments_to_reddit Django management commands to post submissions and comments to the subreddit specified in .env, respectively.

blackbart's People

Contributors

kvnn avatar

Watchers

 avatar  avatar  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.