node ytsr
v3.8.4
이 저장소는 더 이상 지원되지 않습니다. 대신 공식 API를 사용해 보세요.
YouTube에서 동영상, 재생 목록 등을 검색할 수 있는 간단한 js 전용 패키지입니다. 로그인이나 Google API 키가 필요하지 않습니다.
채팅 서버에서 지원을 받으려면 당사에 문의하세요.
const ytsr = require ( 'ytsr' ) ;
const searchResults = await ytsr ( 'github' ) ;
주어진 문자열을 검색합니다.
searchString
options
US
- 요청 현지화 허용en
- 요청 현지화 허용약속을 반환합니다
예시 응답
주어진 문자열이나 링크에 대해 사용 가능한 필터를 가져옵니다.
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
MIT