forked from Eltik/M3U8-Proxy
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2fd38d5
Showing
21 changed files
with
1,023 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CORS_PROXY="https://cors.consumet.stream" | ||
WEB_SERVER_URL="http://localhost:3060" | ||
WEB_SERVER_PORT="3060" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# M3U8-Proxy | ||
Proxy m3u8 files through pure JavaScript. | ||
|
||
## Prerequisites | ||
This proxy requires a [CORS proxy](https://github.com/Rob--W/cors-anywhere). You can input it into the `.env` file or in the `API` constructor. NodeJS version 16+ is also required to run. | ||
|
||
## Installation | ||
1. Clone the repository. | ||
```bash | ||
git clone https://github.com/Eltik/M3U8-Proxy.git | ||
``` | ||
2. Run `npm i`. | ||
3. Run `npm run build`. | ||
4. Run `npm start` or `npm start:pm2` if you want to use [pm2](https://npmjs.com/package/pm2). | ||
|
||
You can configure how the proxy works via a `.env` file; it's relatively self-explanatory. | ||
``` | ||
CORS_PROXY="https://cors.consumet.stream" | ||
WEB_SERVER_URL="http://localhost:3060" | ||
WEB_SERVER_PORT="3060" | ||
``` | ||
|
||
## Credit | ||
Inspired by [this](https://github.com/chaycee/M3U8Proxy) repository. I received some help from [chaycee](https://github.com/chaycee) as well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// <reference types="node" /> | ||
import { Options, Response } from "./libraries/promise-request"; | ||
import { ReadStream, WriteStream } from "fs"; | ||
export default class API { | ||
sentRequests: SentRequest[]; | ||
private userAgent; | ||
config: { | ||
web_server: { | ||
url: string; | ||
port: number; | ||
}; | ||
}; | ||
constructor(options?: any); | ||
loadConfig(options?: any): void; | ||
fetch(url: string, options?: Options): Promise<Response>; | ||
getCachedRequest(url: string, options?: Options): Response; | ||
stream(url: string, stream: ReadableStream | WritableStream | ReadStream | WriteStream, options?: Options): Promise<unknown>; | ||
wait(time: number): Promise<unknown>; | ||
static wait(time: number): Promise<unknown>; | ||
getRandomInt(max: any): number; | ||
makeId(length: any): string; | ||
stringSearch(string: string, pattern: string): number; | ||
} | ||
interface SentRequest { | ||
url: string; | ||
sent: number; | ||
options: Options; | ||
response: Response; | ||
} | ||
export type { SentRequest }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import API from "../API"; | ||
export default class M3U8Proxy extends API { | ||
private url; | ||
private corsProxy; | ||
constructor(url: string); | ||
proxy(headers: any, reply: any): Promise<void>; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { AxiosProxyConfig } from "axios"; | ||
export default class PromiseRequest { | ||
private url; | ||
private options; | ||
private corsProxy; | ||
constructor(url: string, options: Options); | ||
request(): Promise<Response>; | ||
stream(stream: any): Promise<unknown>; | ||
} | ||
type Options = { | ||
method?: string; | ||
headers?: { | ||
[key: string]: string; | ||
}; | ||
body?: string | URLSearchParams | FormData | any; | ||
maxRedirects?: number; | ||
stream?: boolean; | ||
responseType?: string; | ||
proxy?: AxiosProxyConfig | false; | ||
httpsAgent?: any; | ||
useCloudFlare?: boolean; | ||
useCorsProxy?: boolean; | ||
}; | ||
interface Response { | ||
request: Request; | ||
status: number; | ||
statusText: string; | ||
url: string; | ||
error: string[]; | ||
headers: { | ||
[key: string]: string; | ||
} | Headers; | ||
toString: () => string; | ||
raw: () => any; | ||
text: () => string; | ||
json: () => any; | ||
} | ||
interface Request { | ||
url: string; | ||
options: Options; | ||
} | ||
export type { Options, Response, Request }; |
Oops, something went wrong.