npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ytdlp.js

v2.0.1

Published

yt-dlp on Node.js

Downloads

13

Readme

ytdlp.js

yt-dlp on Node.js

導入

npm install ytdlp.js
const ytdlp = require('ytdlp.js')

メソッド

1.情報の取得

ytdlp.info('https://youtu.be/5XcRbKUKSdY')

第一引数にURLを与えます

連想配列が返ってって来ます。 動画のタイトル,ID,説明 等

例外が発生した場合はエラーが返ってきます

2.ダウンロード

ytdlp.dl('https://youtu.be/5XcRbKUKSdY',{
    core: 3,
    output: 'video',
    audio: true,
    format: 'mp3',
})

第一引数にURLを、第二引数にオプションを与えます

core : fragmentの同時ダウンロード数。デフォルトは "1"

output : 出力するファイル名。デフォルトは "%(id)s.%(ext)s"

audio : 音声として出力するか。デフォルトは "false"

format : 出力拡張子。デフォルトは動画の場合 "mp4"、音声の場合 "mp3"

outputに動画idやタイトル、拡張子を入れることが出来ます。

詳しくは公式ドキュメントの OUTPUT TEMPLATE をご覧ください。

正常に終了した場合はtrue、 例外が発生した場合はエラーが返ってきます

3.Update

ytdlp.update()

ytdlp本体のアップデートを行うことが出来ます。

このパッケージ内でアップデートによって使えなくなった関数やオプション等ありましたら連絡ください。

正常に終了した場合はtrue、 例外が発生した場合はエラーが返ってきます

v1.1.0

対応プラットフォームをLinuxに加え、Windows/Macを追加しました。

v1.2.0

updateの追加

v1.2.1

updateの返り値に関する問題の修正

v1.2.2

実行ファイルのアップデート https://github.com/yt-dlp/yt-dlp/releases/tag/2023.02.17

v1.2.3

v1.2.2の Permission denied の修正

v2.0.0

返り値の変更

エラーを吐かずに、返り値に 終了ステータス/エラー文 等を含む形式に

// ytdlp.info('https://...')
{
    status: true,
    return: {
        title: '動画タイトル',
        id: '動画ID',
        ...
    }
}
{
    status: false,
    detail: '[youtube] XXXXXX: Video unavailable',
}

正常である場合に status: true ,そうでない場合に status: false が返ってくる

正常ではない場合のエラーの詳細は detail に含まれ

今までの通常の返り値はreturn内に含む

v2.0.1

v2.0.0返り値変更時にできた問題の修正