Added WildHealth scripts, need to fix Walmart Screenshots script. G2 templates.

This commit is contained in:
Norm Rasmussen
2023-06-12 17:05:57 -04:00
parent fb9bd2d954
commit 9e8d128fa5
80 changed files with 332 additions and 99 deletions

View File

@ -33,14 +33,14 @@ const getAllGroups = async (num) => {
groupIds.push(res.data.data[i].id)
}
}
//await getAllGroups(page);
// await getAllGroups(page);
} else {
// for (let i = 0; i < res.data.data.length; i++) {
// if (res.data.data[i].attributes.status == "live") {
// console.log(res.data.data[i].attributes.name)
// groupIds.push(res.data.data[i].id)
// }
// }
for (let i = 0; i < res.data.data.length; i++) {
if (res.data.data[i].attributes.status == "live") {
console.log(res.data.data[i].attributes.name)
groupIds.push(res.data.data[i].id)
}
}
}
})
.catch(err => {
@ -59,7 +59,7 @@ function loopIds(i) {
}
async function courseOverview(id, i, num) {
console.log("Course Overview Function")
// console.log("Course Overview Function")
const activity = new Array();
const url = "https://walmart.northpass.com/app/courses/";
const browser = await puppeteer.launch();
@ -71,6 +71,7 @@ async function courseOverview(id, i, num) {
await browser.close();
} else {
await page.setViewport({ width:390, height:844 })
// await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3419.0 Safari/537.36');
await page.goto(course, {
waitUntil: 'load',
timeout: 0 });
@ -80,32 +81,35 @@ async function courseOverview(id, i, num) {
const resourcetitle = await page.evaluate(name => name.innerText, getXpath);
console.log(resourcetitle)
const resource = resourcetitle.trim();
console.log(resource);
// console.log(resource);
await page.screenshot({path: `${resource}_1.png`, fullPage:true, headless:false});
await page.screenshot({path: `${resource}_1.png`, fullPage:true, headless:"new"});
const hrefs = await page.$$eval('a', as => as.map(a => a.href));
var links = Object.entries(hrefs);
links.forEach(([key, value]) => {
var link = value;
if (link.includes("activities") && (link.includes(id))) {
console.log("Activities Link")
console.log(link);
activity.push(link);
}
});
setTimeout(() => {
}, 5000);
}, 10000);
uniqueLinks = [...new Set(activity)];
for (const link of uniqueLinks) {
num = num+1
const newlink = link+uid;
console.log("New Link: " + newlink)
await page.setViewport({ width: 390, height: 844 })
await page.goto(newlink, {
waitUntil: 'load',
timeout: 0 });
await page.screenshot({path: `${resource}_${num}.png`, fullPage: true, headless: false});
//screenshots(newlink, resource, num, i);
await page.screenshot({path: `${resource}_${num}.png`, fullPage: true, headless:"new"});
screenshots(newlink, resource, num, i);
}
await browser.close();
i++;