+++
title = 'Nitter in 2024'
date = 2024-09-05T10:34:46+03:00
draft = false
+++
Earlier this year, [Nitter has ceased development](https://github.com/zedeus/nitter/issues/1155#issuecomment-1913361757), due to the removal of guest accounts, but, you can still self host an alternative Twitter frontend, and we'll do it with something some love and some hate, Docker!

We will be using [Privacydevel's Nitter fork](https://github.com/PrivacyDevel/nitter) for this.

### Prerequisites:
* A Linux server with Docker and Docker-compose installed
* A few twitter accounts
* A machine with a residential IP (for logging into your twitter alts, nothing else. You can use a smartphone for this)

### Step 1. Getting accounts
For this you will need a residential IP, as the login script won't work otherwise.  You can simply run it on your computer or on your phone using something like Termux. 

After you get a bunch of alts, it is time to get their oauth tokens.
```bash
curl https://raw.githubusercontent.com/PrivacyDevel/nitter/master/twitter_oauth.sh -o twitter_oauth.sh
vim twitter_oauth.sh
```
**twitter_oauth.sh**
```sh
...
5 | username="yourUsernameHere"
6 | password="yourPasswordHere"
...
```
```sh
bash twitter_oauth.sh
```
You'll end up with something similar in your terminal:
```json
{"oauth_token":"SECRET", "oauth_token_secret":"SECRET"}
```
Save it for later.

### Setting up Nitter
```bash
# Clone the instance. We will be using /srv/nitter
$ git clone https://github.com/PrivacyDevel/nitter.git /srv/nitter
# Now we have to edit the guest_accounts.json file
$ vim guest_accounts.json
```
**guest_accounts.json**
```json
[{"oauth_token":"SECRET", "oauth_token_secret":"SECRET"}]
```
```bash
# We'll also have to edit the docker-compose.yml file to pass the guest_accounts.json to the container.
$ vim docker-compose.yml
```
```yaml
version: "3"

services:

  nitter:
    image: ghcr.io/privacydevel/nitter:master
    container_name: nitter
    ports:
      - "8080:8080" # Replace with "8080:8080" if you don't use a reverse proxy. 
    volumes:
      - ./nitter.conf:/src/nitter.conf:Z,ro
      - ./guest_accounts.json:/src/guest_accounts.json:Z,ro
    depends_on:
      - nitter-redis
    restart: unless-stopped
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:8080/Jack/status/20 ||                                                                                                  exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    user: "998:998"
    read_only: true
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL

  nitter-redis:
    image: redis:6-alpine
    container_name: nitter-redis
    command: redis-server --save 60 1 --loglevel warning
    volumes:
      - nitter-redis:/data
    restart: unless-stopped
    healthcheck:
      test: redis-cli ping
      interval: 30s
      timeout: 5s
      retries: 2
    user: "999:1000"
    read_only: true
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL

volumes:
  nitter-redis:

```
```bash
$ vim nitter.conf # Now you can edit the nitter.conf file. I won't be going into it as it is fairly straightforward.
$ docker-compose up -d
```

And voila! Now if you go to your server's IP on port 8080, you will be greeted by Nitter. Isn't that awesome?

Thanks to [Phin](https://filehaus.su) for helping me set it up.