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
麻省理工學院