const { Client } = require('@sirubot/yt-related-scraper')
Client.get('https://www.youtube.com/watch?v=AufydOsiD6M')
.then(results => {
console.log(`Scraped ${results.length} related videos`)
console.log(results)
})
.catch((e) => {
console.log('An Error appeared')
console.log(e.stack)
})
const { Client } = require('@sirubot/yt-related-scraper')
async function getRelated (url) {
try {
const results = await Client.get(url)
console.log(`Scraped ${results.length} related videos`)
console.log(results)
} catch (e) {
console.log('An Error appeared')
console.log(e.stack)
}
}
- IP Binding Support (RoutePlanner)
const { Client, RoutePlanner } = require('@sirubot/yt-related-scraper')
const routePlanner = new RoutePlanner(['Your-CIDR-Range/16'], ['exclude-ip'], 1) // ipBlocks, excludedIps, failedRetry, -1 = Default Value, 0 = Infinity
async function getRelated (url) {
try {
const results = await Client.get(url, routePlanner)
console.log(`Scraped ${results.length} related videos`)
console.log(results)
} catch (e) {
console.log('An Error appeared')
console.log(e.stack)
}
}