Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.
/ crabber Public archive

A Twitter clone written in Python + Flask with extended features and a focus on inclusivity.

License

Notifications You must be signed in to change notification settings

crabber-net/crabber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crabber A Twitter clone for crabby people.


Screenshots

Dark Mode

screenshot of crabber.net dark mode

Light Mode

screenshot of crabber.net light mode

Advantages

Beyond the novelty of "twitter but crab" as Crabber user @tuna so eloquently put it, there are a number of advantages Crabber has over Twitter. Here are a few:

  • Completely open-source and a light codebase. If you have problems you can fix those problems yourself and even host your own instance of the site.
  • The ability to edit posts for up to five minutes after they are posted.
  • A full, open REST API with an officially maintained Python client. There are no paywalls or massive hoops to jump through in order to use this unlike Twitter's API.
  • Much greater privacy and absolutely no tracking.
  • No sponsored posts or other advertisements (or anything else relating to finance).
  • Proper rules and moderation preventing misinformation and hate speech. (Admittedly, this is simply impossible for Twitter due to its astounding scale. They still lack this nonetheless.)
  • Better user page and bio customization.

Installation

  1. Clone the repo
git clone https://github.com/crabber-net/crabber.git
cd crabber
  1. Install dependencies (requires Poetry)
poetry install
poetry shell
  1. (Optional) Download the GeoLite2 City database from [MaxMind] (https://dev.maxmind.com/geoip/geolite2-free-geolocation-data?lang=en) saved as GeoLite2-City.mmdb in the project root to enable location bans.
  2. (Optional) Add configuration variables to your environment with a .env file or through other means.
  3. Set up the database
python scripts/initialize_database.py
  1. (Optional) If you want OpenGraph cards you need to set up a cron job that runs fetch_cards.py periodically.
crontab -e

This will open your crontab file in $EDITOR. If you're not sure how crontabs work, add this line:

* * * * * cd CRABBERDIRECTORY && poetry run python fetch_cards.py

This will run fetch_cards.py in your Crabber virtual environment once every minute. To run every five minutes change the first asterisk to 0/5. Learn about crontabs if you wish to make further adjustments.

Captcha

Crabber has the option of using an invisible captcha on the signup page to help prevent bots and spam, to enable this, set the HCAPTCHA_ENABLED to True in config.py, and set the HCAPTCHA_SITE_KEY and HCAPTCHA_SECRET_KEY environment variables to your site and secret key respectfully.

Running

Simply run crabber.py in your configured environment and open localhost in your browser, you can specify a port for the development server to run on by setting the PORT environment variable, it defaults to port 80 if not set.

PORT=1024 python crabber.py

This gets you a development server but should not be used in production. Install a "real" server like Apache2, Nginx, etc.

API

REST

Crabber has a REST API mounted at /api/v1 using the crabber_api.py blueprint. Documentation is available here.

If you are interested in contributing to the documentation please create an issue to let us know, any help is appreciated!

Python

A Python library has been written to simplify interaction with the site's API and make developing bots and other applications more fun.

You can find that library here on PyPi and its repo here.

pip install python-crabber
import crabber
api = craber.API(YOUR_API_KEY,
                 YOUR_ACCESS_TOKEN)

jake = crabber.get_crab_by_username('jake')
jake.follow()
molt = jake.get_molts()[0]
molt.like()
molt.reply('Wow, you\'re so cool!')