Shitter – Nitter 的一个分支
Shitter – A Nitter Fork

原始链接: https://codeberg.org/shitter/shitter

Nitter 是一个免费、开源、注重隐私的 Twitter 替代前端,通过后端代理所有请求,避免 JavaScript 和广告,同时防止 IP 和指纹追踪。受 Invidious 启发,它使用 Twitter 的非官方 API,支持 RSS、主题和移动端,并且比 Twitter 更轻量、更快。贡献以补丁文件而非拉取请求的形式接受。它可以通过 Docker(使用单独的 Redis/Valkey 实例和 nitter.conf)部署,或使用 Nim、libpcre、libsass 和 Redis/Valkey 从源码构建。支持 Systemd 和反向代理设置,日志可通过 journalctl 或 Docker 获取。有一个 Matrix 频道可用于社区讨论。

Shitter,一个 Nitter 分支,被发布在 Hacker News 上,并附有可用实例的链接。评论讨论 X/Twitter 命名笑话、基于 Nitter 构建的逆时序科技时间线工具,以及 Nitter 实例虽然可从开源代码轻松自托管,但仍需 Twitter 认证,使得许多单个实例不切实际。其他人建议使用像 xxcancel.com 这样的多路复用器/负载均衡器来汇聚实例。有些人指出下架针对域名,而非代码。最后一个帖子讨论项目名称是否不专业。
相关文章

原文

shitter logo

A free and open source alternative Twitter front-end focused on privacy and performance.
Inspired by the Invidious project.

  • No JavaScript or ads
  • All requests go through the backend, client never talks to Twitter
  • Prevents Twitter from tracking your IP or JavaScript fingerprint
  • Uses Twitter's unofficial API (no developer account required)
  • Lightweight (thanks to @nim_lang, 60KB vs 784KB from twitter.com)
  • RSS feeds
  • Themes
  • Mobile support (responsive design)

Resources

The wiki contains:

Contributing

This repository does not accept Pull Requests, but contributions are welcome in the form of Patch files, which can be submitted on an issue and are much more convenient to merge and work with.

Why?

It's impossible to use Twitter without JavaScript enabled, and as of 2024 you need to sign up. For privacy-minded folks, preventing JavaScript analytics and IP-based tracking is important, but apart from using a VPN and uBlock/uMatrix, it's impossible. Despite being behind a VPN and using heavy-duty adblockers, you can get accurately tracked with your browser's fingerprint, no JavaScript required. This all became particularly important after Twitter removed the ability for users to control whether their data gets sent to advertisers.

Using an instance of Nitter (hosted on a VPS for example), you can browse Twitter without JavaScript while retaining your privacy. In addition to respecting your privacy, Nitter is on average around 15 times lighter than Twitter, and in most cases serves pages faster (eg. timelines load 2-4x faster).

Screenshot

nitter screenshot - Framasoft

Install

Docker

Page for the Docker image: https://hub.docker.com/r/mv12star/shitter

NOTE: The published image is multi-arch — mv12star/shitter:latest runs natively on amd64/armv7/arm64.

To run Nitter with Docker, you'll need to install and run Redis separately before you can run the container. See below for how to also run Redis using Docker.

First create your config file. The Docker commands mount it into the container, so it has to exist on the host beforehand. If you've cloned the repo:

cp nitter.example.conf nitter.conf

If you're using the prebuilt image without a local clone, download nitter.example.conf and save it as nitter.conf instead.

To build and run Nitter in Docker:

docker build -t nitter:latest .
docker run -v $(pwd)/nitter.conf:/src/nitter.conf -d --network host nitter:latest

A prebuilt Docker image is provided as well:

docker run -v $(pwd)/nitter.conf:/src/nitter.conf -d --network host mv12star/shitter:latest

Using docker-compose to run both Nitter and Redis as different containers: Change redisHost from localhost to nitter-redis in nitter.conf, then run:

docker-compose up -d

Note the Docker commands mount nitter.conf (and sessions.jsonl for docker-compose) from the directory you run them in. If a mounted file doesn't exist, Docker silently creates a directory in its place and the container fails with not a directory: Are you trying to mount a directory onto a file. Remove that directory and create the file as shown above.

systemd

To run Nitter via systemd you can use this service file:

[Unit]
Description=Nitter (An alternative Twitter front-end)
After=syslog.target
After=network.target

[Service]
Type=simple

# set user and group
User=nitter
Group=nitter

# configure location
WorkingDirectory=/home/nitter/nitter
ExecStart=/home/nitter/nitter/nitter

Restart=always
RestartSec=15

[Install]
WantedBy=multi-user.target

Then enable and run the service: systemctl enable --now nitter.service

Logging

Nitter currently prints some errors to stdout, and there is no real logging implemented. If you're running Nitter with systemd, you can check stdout like this: journalctl -u nitter.service (add --follow to see just the last 15 lines). If you're running the Docker image, you can do this: docker logs --follow *nitter container id*

Build from source

Dependencies

  • libpcre
  • libsass
  • redis/valkey

To compile Nitter you need a Nim installation, see nim-lang.org for details. It is possible to install it system-wide or in the user directory you create below.

To compile the scss files, you need to install libsass. On Ubuntu and Debian, you can use libsass-dev.

Redis is required for caching and in the future for account info. As of 2024 Redis is no longer open source, so using the fork Valkey is recommended. It should be available on most distros as redis or redis-server (Ubuntu/Debian), or valkey/valkey-server. Running it with the default config is fine, Nitter's default config is set to use the default port and localhost.

Here's how to create a nitter user, clone the repo, and build the project along with the scss and md files.

# useradd -m nitter
# su nitter
$ git clone https://codeberg.org/shitter/shitter
$ cd nitter
$ nimble -l build -d:danger --mm:refc
$ nimble -l scss
$ nimble -l md
$ cp nitter.example.conf nitter.conf

Set your hostname, port, HMAC key, https (must be correct for cookies), and Redis info in nitter.conf. To run Redis, either run redis-server --daemonize yes, or systemctl enable --now redis (or redis-server depending on the distro). Run Nitter by executing ./nitter or using the systemd service below. You should run Nitter behind a reverse proxy such as Nginx or Apache for security and performance reasons.

Matrix channel

Feel free to join our Matrix channel.

联系我们 contact @ memedata.com