node ytsr
v3.8.4
不再支持此存储库,请考虑使用官方 api。
仅简单的 js 包即可搜索 Youtube 的视频、播放列表等。不需要任何登录或 Google-API-Key。
您可以联系我们以获取聊天服务器上的支持
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>>
通过拉动另一个页面来继续先前的请求。
先前的请求必须使用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 }
npm install --save ytsr
麻省理工学院