node ytsr
v3.8.4
このリポジトリはサポートされなくなりました。代わりに公式 API の使用を検討してください。
Youtube のビデオ、プレイリストなどを検索するためのシンプルな JS のみのパッケージ。ログインや Google API キーは必要ありません。
サポートについては、チャット サーバーからお問い合わせください。
const ytsr = require ( 'ytsr' ) ;
const searchResults = await ytsr ( 'github' ) ;
指定された文字列を検索します
searchString
options
US
- リクエストのローカライズを可能にしますen
- リクエストのローカライズを可能にしますPromiseを返す
応答例
指定された文字列またはリンクに対して使用可能なフィルターを取得します
const ytsr = require ( 'ytsr' ) ;
const filters1 = await ytsr . getFilters ( 'github' ) ;
const filter1 = filters1 . get ( 'Type' ) . get ( 'Video' ) ;
const filters2 = await ytsr . getFilters ( filter1 . url ) ;
const filter2 = filters2 . get ( 'Features' ) . get ( 'Live' ) ;
const options = {
pages : 2 ,
}
const searchResults = await ytsr ( filter2 . url , options ) ;
searchString
options
US
- リクエストのローカライズを可能にしますen
- リクエストのローカライズを可能にしますMap<String, Map<String, Filter>>
となる Promise を返します。さらに別のページをプルして前のリクエストを継続します。
以前のリクエストはpages
制限を使用して実行する必要がありました。
const ytsr = require ( 'ytsr' ) ;
const firstResultBatch = await ytsr ( 'github' , { pages : 1 } ) ;
const secondResultBatch = ytsr . continueReq ( firstResultBatch . continuation ) ;
const thirdResultBatch = ytsr . continueReq ( secondResultBatch . continuation ) ;
// You can now use the .items property of all result batches e.g.:
console . log ( firstResultBatch . items ) ;
console . log ( secondResultBatch . items ) ;
console . log ( thirdResultBatch . items ) ;
{ continuation, items }
に解決される Promise を返します npm install --save ytsr
マサチューセッツ工科大学