Skip to content

Mintone-creators/yt-cipher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic service to eval yt player scripts for nsig stuff.

Getting Started

The easiest way to use this right now is with docker

git clone https://github.com/kikkia/yt-cipher.git

cd yt-cipher

docker-compose build
docker-compose up

Authentication

You'll need to set the API_TOKEN environment variable in your docker-compose.yml file.

Requests without a valid Authorization: <your_token> header will be rejected.

Config

Environment Variables:

  • MAX_THREADS - max # of workers that can handle requests. Default is 1 per thread on the machine or 1 if it can't determine that for some reason.
  • API_TOKEN - The required token to authenticate requests
  • PORT - Port to run the api on, default: 8001
  • HOST - Sets the hostname for the deno server, default: 0.0.0.0

IPv6 Support

To run the server with IPv6, you need to configure the HOST environment variable.

  • Set HOST to [::] to bind to all available IPv6 and IPv4 addresses on most modern operating systems.

When accessing the service over IPv6, make sure to use the correct address format. For example, to access the service running on localhost, you would use http://[::1]:8001/.

API Specification

POST /decrypt_signature

Request Body:

{
  "encrypted_signature": "...",
  "n_param": "...",
  "player_url": "...",
  "video_id": "VIDEO_ID"
}
  • encrypted_signature (string): The encrypted signature from the video stream.
  • n_param (string): The n parameter value.
  • player_url (string): The URL to the JavaScript player file that contains the decryption logic.
  • video_id (string): The ID of the video.

Successful Response:

{
  "decrypted_signature": "...",
  "decrypted_n_sig": "..."
}

Example curl request:

curl -X POST http://localhost:8001/decrypt_signature \
-H "Content-Type: application/json" \
-H "Authorization: your_secret_token" \
-d '{
  "encrypted_signature": "...",
  "n_param": "...",
  "player_url": "https://...",
  "video_id": "..."
}'

POST /get_sts

Extracts the signature timestamp (sts) from a player script.

Request Body:

{
  "player_url": "...",
  "video_id": "..."
}
  • player_url (string): The URL to the JavaScript player file.
  • video_id (string): The ID of the video.

Successful Response:

{
  "sts": "some_timestamp"
}

Example curl request:

curl -X POST http://localhost:8001/get_sts \
-H "Content-Type: application/json" \
-H "Authorization: your_secret_token" \
-d '{
  "player_url": "https://...",
  "video_id": "test"
}'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.3%
  • JavaScript 4.6%
  • Python 1.5%
  • Dockerfile 0.6%