youtube-po-token-generator/lib/workflow.js
2024-08-06 10:03:42 +08:00

14 lines
351 B
JavaScript

const { download } = require('./utils')
const { url } = require('./consts')
const fetchVisitorData = async () => {
const data = await download(url)
const matched = data.match(/"visitorData":"([^"]+)/)
if (matched) {
return matched[1]
} else {
throw new Error(`Failed to find visitorData`)
}
}
module.exports = { fetchVisitorData }