const axios = require('axios');
async function alightmotion(url) {
try {
const match = url.match(/\/u\/([^\/]+)\/p\/([^\/\?#]+)/);
if (!match) throw new Error('Invalid url.');
const { data } = await axios.post('https://us-central1-alight-creative.cloudfunctions.net/getProjectMetadata', {
data: {
uid: match[1],
pid: match[2],
platform: 'android',
appBuild: 1002592,
acctTestMode: 'normal'
}
}, {
headers: {
'content-type': 'application/json; charset=utf-8'
}
});
return data.result;
} catch (error) {
throw new Error(error.message);
}
}
alightmotion('https://alightcreative.com/am/share/u/x4tThs8XerfqEPEq1kKoprJCBdR2/p/lZY0V9q97T-e2412874534b2079').then(console.log);