Git Product home page Git Product logo

randomery's Introduction

Randomery โš…

Random links from the web

Requirements

pip install virtualenv
virtualenv venv
source venv/bin/activate # . venv/bin/activate
pip install -r requirements.txt
  • Download unwanted urls list (used to filter links)
wget http://sbc.io/hosts/alternates/fakenews-gambling-porn/hosts > unwanted_urls

Configure the server

Put the configuration into config.json file with the following format

{
  "PORT": 4000,
  "APP_SECRET_KEY": "abcd1234",
  "WEBSITE_TITLE": "MyWebsite",
  "MONGO_URI": "mongodb://localhost:27017",
  "feeder": {
    "PHANTOM_JS_DRIVER_ARGS": ["--web-security=no", "--ssl-protocol=any", "--ignore-ssl-errors=yes"],
    "PAGE_LOAD_TIMEOUT": 120,
    "DEFAULT_USERNAME": "randomery",
    "MOBILE_USER_AGENT": "Mozilla/5.0 (Linux; Android 7.1.2; Nexus 5X Build/N2G48C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36",
    "DESKTOP_USER_AGENT": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
  }
}

Run dev

mkdir -pv mongodb/data # create data folder
mongod --dbpath mongodb/data # start the db
python server.py # start the server

Run prod

Run locally

mkdir -pv mongodb/data # create data folder
mongod --dbpath mongodb/data # start the db
uwsgi -H venv --ini uwsgi.ini # start the server

Run on a server

mkdir -pv /mongodb/data # create data folder
pip install supervisor
# TODO

Feed the database with RSS

Put some rss links into rss_sources.json file with the following format

{
  "sources": [
    "https://example.com/rsslink",
    "https://example2.com/othersslink"
  ]
}

Run the feeder

python -c "from lib.feeder import insert_all_links;insert_all_links()"

Workers

Process links added by users (:warning: infinite loop)

python -c "from lib.worker import job_loop;job_loop()"

Linter

Spot some issues, bad typos or bad indentation

pip install pylint # install
pylint lib server.py # run

PhantomJS drivers issues

Some of them can still run even after stopping the application, just kill them

kill -9 $(ps aux | grep phantomjs | awk '{print $2}')

randomery's People

Contributors

franblas avatar

Stargazers

 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.