0.1.1 • Published 9 months ago

blockcheck v0.1.1

Weekly downloads
-
License
LGPL-3.0
Repository
github
Last release
9 months ago

blockcheck

tiny module to check youtube video availability

import blockcheck, { getRegions } from 'blockcheck'

// `blockcheck` returns where the video is available
await blockcheck('wH0mWVJWyr4') // ~> []
                                // meaning: "blocked worldwide"

await blockcheck('yGqSlOPhNzg') // ~> ["VN"]
                                // meaning: only available in Vietnam

await blockcheck('l4e_Nba6Bpw') // ~> ['AE', 'AR', 'AT', ..., 'ZA', 'ZW']
                                // meaning: not blocked anywhere (read: available worldwide)


// doing the opposite: getting blocked regions is not
// supported by the `blockcheck` function, but you can do this:
const regions = await getRegions()
const result = new Set(await blockcheck('wH0mWVJWyr4'))
regions.filter(r => !result.has(r)) // ~> ['AE', 'AR', 'AT', ..., 'ZA', 'ZW']
                                         // meaning: blocked worldwide

// checking whether the video is available worldwide
await blockcheck('l4e_Nba6Bpw').length === await getRegions().length // ~> true
0.1.1

9 months ago

0.1.0

9 months ago

0.0.1

9 months ago