【Youtubeの広告を破壊する編】512mbのVPSの限界に挑戦し、広告を破壊する。その4

当ブログはアフィリエイト広告を利用し商品を紹介しています。

これまでPiholeを用いて広告を破壊する方法を紹介した。
しかしながら、Youtubeの広告はPiholeではどうにもできない。
自分で広告の出ないフロントエンドを作ってしまおうという思想から生まれたのがInvidiousである。
いくつかのInvidiousインスタンスが稼働しているが常に不安定であり、自分用に立ててしまった方が安心感がある。

GitHub - iv-org/documentation: The official Invidious documentation

The official Invidious documentation. Contribute to iv-org/documentation development by creating an account on GitHub.

Invidiousでは広告の削除し、他の機能もおおよそYoutubeに準拠したものが取り揃えられている。これを512MB1コアのVPSに入れていこうと思う。

インストール

環境
Conoha VPS(512MB1コアVPS)
Debian12.0 docker、pwgen導入済み

pwgenはDebianであればaptで入れられる

sudo apt install pwgen
git clone https://github.com/iv-org/invidious.git
cd invidious

InvidiousのGithubからコードを持ってくる。
Invidiousにはバグがあるらしく、いくつかのファイルをマウントする必要があるようだ。

nano docker-compose.yml

とし

version: "3"
services:

  invidious:
    image: quay.io/invidious/invidious:latest
    # image: quay.io/invidious/invidious:latest-arm64 # ARM64/AArch64 devices
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:3000"
    environment:
      # Please read the following file for a comprehensive list of all available
      # configuration options and their associated syntax:
      # https://github.com/iv-org/invidious/blob/master/config/config.example.yml
      INVIDIOUS_CONFIG: |
        db:
          dbname: invidious
          user: kemal
          password: kemal
          host: invidious-db
          port: 5432
        check_tables: true
        # external_port:
        # domain:
        # https_only: false
        # statistics_enabled: false
        hmac_key: "CHANGE_ME!!"
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    logging:
      options:
        max-size: "1G"
        max-file: "4"
    depends_on:
      - invidious-db

  invidious-db:
    image: docker.io/library/postgres:14
    restart: unless-stopped
    volumes:
      - postgresdata:/var/lib/postgresql/data
      - ./config/sql:/config/sql
      - ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh
    environment:
      POSTGRES_DB: invidious
      POSTGRES_USER: kemal
      POSTGRES_PASSWORD: kemal
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]

volumes:
  postgresdata:

以上のように書き換える。この時hmac_keyのCHANGE ME!!を

pwgen 20 1

で出力された文字列に置き換える。

お好みでPortを書き換えたのち

docker compose up -d

として起動させる。

http://(tailscaleで振られた100.~のプライベートIP):3000
とするとInvidiousが起動する。使い方等々はYoutubeと大きく違いはない。

すぐに使える高速レンタルサーバー【ConoHa VPS】【ConoHa for Windows Server】のお申込み

現在筆者はiOSを使用している

iOSの場合invidiousをSafariで開き

とすることで

アプリのようなUIに変更することができる。

おわりに

これでおおよそすべての広告を破壊できたと思う。

←前

研究室の一角 - にほんブログ村

Licensed under CC BY-NC-SA 4.0
最終更新 Aug 23, 2023 05:51 UTC
comments powered by Disqus
Hugo で構築されています。
テーマ StackJimmy によって設計されています。