@shiminiku/yt-o
v2.1.0-pre.13
Published
[![Test](https://github.com/shiminiku/yt-o/actions/workflows/test.yml/badge.svg)](https://github.com/shiminiku/yt-o/actions/workflows/test.yml) [![npm version](https://badge.fury.io/js/@shiminiku%2Fyt-o.svg)](https://badge.fury.io/js/@shiminiku%2Fyt-o)
Downloads
151
Readme
yt-o
yt download lib & cli
Install
Install from npm...
npm install @shiminiku/yt-o
Use it!
import { getPlayerResponse, getStreamURL } from "@shiminiku/yt-o"
const { playerResponse, basejsURL } = await getPlayerResponse("dQw4w9WgXcQ")
if (playerResponse) {
const url = await getStreamURL(playerResponse.streamingData.adaptiveFormats[0], basejsURL)
console.log("URL:", url)
}
Run in CLI
# once
npm build
npm start <videoId> [v(ideo)|a(udio)|b(oth)|o(ut)|mimetype]
Interactive mode (default)
pnpm start dQw4w9WgXcQ
Highest bitrate "video" only
pnpm start dQw4w9WgXcQ video
pnpm start dQw4w9WgXcQ v
Highest bitrate "audio" only
pnpm start dQw4w9WgXcQ audio
pnpm start dQw4w9WgXcQ a
Video and audio in one
pnpm start dQw4w9WgXcQ both
pnpm start dQw4w9WgXcQ b
Specify mimeype (partial match, using mimeType.includes()
)
pnpm start dQw4w9WgXcQ mimetype audio/mp4
special thanks
other features
save playerResponse
to "./out.json"
pnpm start dQw4w9WgXcQ out