node ytsr
v3.8.4
ไม่รองรับ repo นี้อีกต่อไป โปรดพิจารณาใช้ API อย่างเป็นทางการแทน
แพ็คเกจ js ธรรมดาเท่านั้นที่ใช้ค้นหา Youtube สำหรับวิดีโอ เพลย์ลิสต์ และอื่นๆ อีกมากมาย ไม่จำเป็นต้องเข้าสู่ระบบหรือ Google-API-Key
คุณสามารถติดต่อเราเพื่อรับการสนับสนุนบนเซิร์ฟเวอร์แชทของเรา
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>>
ดำเนินการต่อคำขอก่อนหน้าโดยดึงหน้าอื่น
คำขอก่อนหน้านี้จะต้องดำเนินการโดยใช้การจำกัด 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
เอ็มไอที