Fixed walmart screenshot script. Added some notes. Created recast's script.

This commit is contained in:
Norm Rasmussen
2023-04-04 16:55:32 -04:00
parent 9ef9e63297
commit ecdf46fd33
10 changed files with 158 additions and 30 deletions

View File

@ -3,7 +3,10 @@ const axios = require('axios')
const path = require('path')
const apiKey = "6hUfJdAartHTHhHc0WIRZYPWe"
const uid = "/\?uid\=7b84eae4-fb34-4689-9f33-24071c3e5a41";
// Spark Production ^
// const apiKey = "p5fidpuedHaOlPnd8EcpxzQMG"
// Luminate Production ^
const uid = "/\?uid\=7beg87y4-fh24-4929-3rt5-24kdn87s5241";
const groupIds = []
const getAllGroups = async (num) => {
@ -14,7 +17,7 @@ const getAllGroups = async (num) => {
await axios({
method: 'get',
url: `https://api2.northpass.com/v2/courses?page=${page}&limit=100`,
url: 'https://api2.northpass.com/v2/courses?page=${page}&limit=200',
headers: {
'accept': '*/*',
'x-api-key': apiKey,
@ -26,16 +29,18 @@ const getAllGroups = async (num) => {
page++;
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)
}
}
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") {
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 => {
@ -47,12 +52,14 @@ const getAllGroups = async (num) => {
}
function loopIds(i) {
console.log("Loop Ids Function")
var num = 1
id = groupIds[i]
courseOverview(id, i, num)
}
async function courseOverview(id, i, num) {
console.log("Course Overview Function")
const activity = new Array();
const url = "https://walmart.northpass.com/app/courses/";
const browser = await puppeteer.launch();
@ -71,6 +78,7 @@ async function courseOverview(id, i, num) {
await page.title();
const [getXpath] = await page.$x('/html/body/div[1]/div');
const resourcetitle = await page.evaluate(name => name.innerText, getXpath);
console.log(resourcetitle)
const resource = resourcetitle.trim();
console.log(resource);