Skip to content

Eltik/M3U8-Proxy

Repository files navigation

M3U8-Proxy

Proxies m3u8 files through pure JavaScript.

About

Some m3u8 files require special headers as well as CORS. This project achieves both by integrating Rob Wu's CORS proxy and adding a route to proxy m3u8 files.

Installation

  1. Clone the repository.
git clone https://github.com/Eltik/M3U8-Proxy.git
  1. Run npm i.
  2. Run npm run build.
  3. Run npm start.

You can configure how the proxy works via a .env file; it's relatively self-explanatory.

# This file is a template for .env file
# Copy this file to .env and change the values

# Web server configuration
HOST="localhost"
PORT="3030"

# Public URL to proxy ts files from
PUBLIC_URL="https://m3u8.eltik.net"

Usage

To proxy m3u8 files, use the /m3u8-proxy route. All you have to do is input the URL and headers. For example:

http://localhost:3030/m3u8-proxy?url=https%3A%2F%2Fojkx.vizcloud.co%2Fsimple%2FEqPFJvsQWADtjDlGha7rC8UurFwHuLiwTk17rqk%2BwYMnU94US2El_Po4w12gXe6GptOSQtc%2Fbr%2Flist.m3u8%23.mp4&headers=%7B%22referer%22%3A%22https%3A%2F%2F9anime.pl%22%7D

The URL in this case is https://ojkx.vizcloud.co/simple/EqPFJvsQWADtjDlGha7rC8UurFwHuLiwTk17rqk+wYMnU94US2El_Po4w12gXe6GptOSQtc/br/list.m3u8#.mp4 and the headers are {"Referer": "https://9anime.pl"}. This will then send a request to the m3u8 using the headers, modify the content to use the ts proxy, then proxy each ts file using a CORS proxy. If you need help, please join my Discord.

Credit

Inspired by this repository. I received some help from chaycee as well. This project also uses code from this CORS proxy.