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

@ -6,9 +6,15 @@
{% else %}
<div class="np-learning-paths-resources-container">
<div class="np-zero-state-text">
Stay tuned for Learning Paths!
Certifications coming Wednesday, June 14th!
</div>
<img class="np-zero-state-learning-paths" alt="{% t .empty %}" />
</div>
{% endif %}
</div>
<style>
.np-learning-paths-resources-container {
border: none;
}
</style>

View File

@ -0,0 +1,36 @@
{% include "header" %}
<main class="np-main np-learning-paths np-subpage-container np-max-width">
<div class="np-homepage-hero">
<img class="np-homepage-hero-image"
src="{{ homepage.artwork_url }}"
alt="{{ homepage.headline }}"
/>
<div class="np-homepage-hero-content">
<div class="np-homepage-headline np-header-font-color">
G2 Certifications
</div>
<div
style="width: 550px;"
class="np-homepage-subheadline np-header-font-color">
Enroll in pre-set courses on G2 basics, marketing, and buyer intent to earn certs thatll help boost your knowledge, drive revenue, and increase ROI.
</div>
</div>
</div>
{% include "sub_navigation" %}
<div class="np-learning-paths-main">
<div class="np-resource-title">
Become #G2Certified
</div>
<div class="np-resource-subtitle">
</div>
{% include "learning_paths_index", items: learning_paths.available %}
</div>
</main>
{% include "footer" %}
<style>
.np-learning-paths {
background: white;
}
</style>

BIN
Scripts/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

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++;

View File

@ -1,84 +0,0 @@
/* This function needs to run either once a day OR after a webhook that contains the course name.
Date range: 2/1/23 - 7/31/23
Order of operations:
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
- GET Person https://api.northpass.com/v2/people/{uuid}
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
UUIDS:
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
*/
const sheet = SpreadsheetApp.getActiveSheet();
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
var assign_uid = "a4e082a2-9416-4fdf-9ef6-a817e25d26ee"
let page = 0;
function getAssignment() {
var sheet = SpreadsheetApp.getActiveSheet();
var api_url =
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
Logger.log(api_url)
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
}
const sendMsg = UrlFetchApp.fetch(api_url, settings);
var apiResponse = sendMsg.getContentText();
var parsedata = JSON.parse(apiResponse);
var data = parsedata["data"];
if (data.length != 0){
let rowArray = []
for (item of data) {
var submit_date = item["attributes"]["created_at"];
var person = item["relationships"]["person"]["data"]["id"];
var download_link = item["links"]["download"];
var person_url = 'https://api.northpass.com/v2/people/'+person;
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
};
const sendMsg = UrlFetchApp.fetch(person_url, settings);
var uuidResponse = sendMsg.getContentText();
var parsing = JSON.parse(uuidResponse);
var info = parsing["data"]
var full_name = info["attributes"]["full_name"];
var email = info["attributes"]["email"];
let rowArray = [submit_date, download_link, person, full_name, email];
addToSheet(rowArray);
};
} else {
}
page++;
getAssignment(page);
};
function addToSheet(rowArray){
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = Math.max(sheet.getLastRow(),1);
sheet.insertRowAfter(lastRow);
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
}

View File

@ -0,0 +1 @@
{"scriptId":"1lX_lzT7xRA-13vMq63ZPxBYj8fmz4UwgR403PV5juue1NW7sCi6NSWqq","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments_PSA1"}

View File

@ -0,0 +1,87 @@
/* This function needs to run either once a day OR after a webhook that contains the course name.
Date range: 2/1/23 - 7/31/23
Order of operations:
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
- GET Person https://api.northpass.com/v2/people/{uuid}
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
UUIDS:
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
*/
const sheet = SpreadsheetApp.getActiveSheet();
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
var assign_uid = "c6e05c41-082e-4027-9e2e-49d3c5a7c5a0"
let page = 1;
function getAssignment() {
var sheet = SpreadsheetApp.getActiveSheet();
for (let page = 1; page <= 50; page++) {
var api_url =
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
Logger.log(api_url)
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
}
const sendMsg = UrlFetchApp.fetch(api_url, settings);
var apiResponse = sendMsg.getContentText();
var parsedata = JSON.parse(apiResponse);
var data = parsedata["data"];
if (data.length != 0){
let rowArray = []
for (item of data) {
var submit_date = item["attributes"]["created_at"];
var person = item["relationships"]["person"]["data"]["id"];
Logger.log(person)
var download_link = item["links"]["download"];
var person_url = 'https://api.northpass.com/v2/people/'+person;
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
};
const sendMsg = UrlFetchApp.fetch(person_url, settings);
var uuidResponse = sendMsg.getContentText();
var parsing = JSON.parse(uuidResponse);
var info = parsing["data"]
var full_name = info["attributes"]["full_name"];
var email = info["attributes"]["email"];
let rowArray = [submit_date, download_link, person, full_name, email];
addToSheet(rowArray);
};
} else {
}
}
//page++;
//getAssignment(page);
};
function addToSheet(rowArray){
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = Math.max(sheet.getLastRow(),1);
sheet.insertRowAfter(lastRow);
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
}

View File

@ -0,0 +1 @@
{"scriptId":"1Z2Q8woLoLOVUUJe_HthEJ8M9a27-EpGVXGVDf4__qGTcC89q3EkDi7r1","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments_PSA2"}

View File

@ -0,0 +1,84 @@
/* This function needs to run either once a day OR after a webhook that contains the course name.
Date range: 2/1/23 - 7/31/23
Order of operations:
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
- GET Person https://api.northpass.com/v2/people/{uuid}
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
UUIDS:
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
*/
const sheet = SpreadsheetApp.getActiveSheet();
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
var assign_uid = "17c5917a-2ee6-4d9f-af89-5831282fc64b"
let page = 1;
function getAssignment() {
var sheet = SpreadsheetApp.getActiveSheet();
for (let page = 1; page <= 50; page++) {
var api_url =
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
Logger.log(api_url)
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
}
const sendMsg = UrlFetchApp.fetch(api_url, settings);
var apiResponse = sendMsg.getContentText();
var parsedata = JSON.parse(apiResponse);
var data = parsedata["data"];
if (data.length != 0){
let rowArray = []
for (item of data) {
var submit_date = item["attributes"]["created_at"];
var person = item["relationships"]["person"]["data"]["id"];
var download_link = item["links"]["download"];
var person_url = 'https://api.northpass.com/v2/people/'+person;
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
};
const sendMsg = UrlFetchApp.fetch(person_url, settings);
var uuidResponse = sendMsg.getContentText();
var parsing = JSON.parse(uuidResponse);
var info = parsing["data"]
var full_name = info["attributes"]["full_name"];
var email = info["attributes"]["email"];
let rowArray = [submit_date, download_link, person, full_name, email];
addToSheet(rowArray);
};
} else {
}
}
};
function addToSheet(rowArray){
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = Math.max(sheet.getLastRow(),1);
sheet.insertRowAfter(lastRow);
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
}

View File

@ -0,0 +1,7 @@
{
"timeZone": "America/New_York",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}

View File

@ -1 +1 @@
{"scriptId":"1W9jVjAVjIivO2sj1flvoofftiZ4v0BgAMD_RPBsSTGZBcedPN_DUEW7m","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments"}
{"scriptId":"1W9jVjAVjIivO2sj1flvoofftiZ4v0BgAMD_RPBsSTGZBcedPN_DUEW7m","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments_PSA3"}

View File

@ -0,0 +1,84 @@
/* This function needs to run either once a day OR after a webhook that contains the course name.
Date range: 2/1/23 - 7/31/23
Order of operations:
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
- GET Person https://api.northpass.com/v2/people/{uuid}
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
UUIDS:
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
*/
const sheet = SpreadsheetApp.getActiveSheet();
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
var assign_uid = "a4e082a2-9416-4fdf-9ef6-a817e25d26ee"
let page = 1;
function getAssignment() {
var sheet = SpreadsheetApp.getActiveSheet();
for (let page = 1; page <= 50; page++) {
var api_url =
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
Logger.log(api_url)
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
}
const sendMsg = UrlFetchApp.fetch(api_url, settings);
var apiResponse = sendMsg.getContentText();
var parsedata = JSON.parse(apiResponse);
var data = parsedata["data"];
if (data.length != 0){
let rowArray = []
for (item of data) {
var submit_date = item["attributes"]["created_at"];
var person = item["relationships"]["person"]["data"]["id"];
var download_link = item["links"]["download"];
var person_url = 'https://api.northpass.com/v2/people/'+person;
const settings = {
async: true,
crossDomain: true,
method: 'GET',
headers: {
accept: 'application/json',
'X-Api-Key': apiKey
}
};
const sendMsg = UrlFetchApp.fetch(person_url, settings);
var uuidResponse = sendMsg.getContentText();
var parsing = JSON.parse(uuidResponse);
var info = parsing["data"]
var full_name = info["attributes"]["full_name"];
var email = info["attributes"]["email"];
let rowArray = [submit_date, download_link, person, full_name, email];
addToSheet(rowArray);
};
} else {
}
}
};
function addToSheet(rowArray){
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = Math.max(sheet.getLastRow(),1);
sheet.insertRowAfter(lastRow);
sheet.getRange(lastRow + 1, 1).setValue(rowArray[0]);
sheet.getRange(lastRow + 1, 2).setValue(rowArray[3]);
sheet.getRange(lastRow + 1, 3).setValue(rowArray[4]);
sheet.getRange(lastRow + 1, 4).setValue(rowArray[1]);
}

View File

@ -0,0 +1,7 @@
{
"timeZone": "America/New_York",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}