WALMART SCREENSHOT SCRIPT DONEcd ~/Documents/Northpass! And emails from Groups for Wildhealth. Very productive day
BIN
Scripts/Walmart_Screenshots/.DS_Store
vendored
Normal file
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_1.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_2.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_3.png
Normal file
|
After Width: | Height: | Size: 163 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_4.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_5.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_6.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_7.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
Scripts/Walmart_Screenshots/Branch Wallet FAQs_8.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
64
Scripts/Walmart_Screenshots/resources.js
Normal file
@ -0,0 +1,64 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
const path = require('path')
|
||||
|
||||
// const urls = [...]
|
||||
|
||||
/*for (let i=0; i<urls.length; i++){
|
||||
const url = urls[i];
|
||||
await page.goto('${url}');
|
||||
await page.waitForNavigation({ waitUntil: 'networkkidle2' });
|
||||
}*/
|
||||
|
||||
|
||||
const url = process.argv[2];
|
||||
if (!url) {
|
||||
throw "Please provide a URL as the first argument";
|
||||
}
|
||||
|
||||
const activity = new Array();
|
||||
const activityLinks = new Array();
|
||||
var num = 0
|
||||
|
||||
async function courseOverview() {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.setViewport({ width:390, height:844 })
|
||||
await page.goto(url);
|
||||
|
||||
await page.title();
|
||||
const [getXpath] = await page.$x('//*[@id="course-desktop"]/div/div[3]/div[2]/div[2]/div[2]/ol/li/div');
|
||||
const resourcetitle = await page.evaluate(name => name.innerText, getXpath);
|
||||
const resource = resourcetitle.trim();
|
||||
console.log(resource);
|
||||
|
||||
await page.screenshot({path: `${resource}.png`, fullPage:true, headless:false});
|
||||
|
||||
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")) {
|
||||
activity.push(link);
|
||||
}
|
||||
});
|
||||
uniqueLinks = [...new Set(activity)];
|
||||
for (const link of uniqueLinks) {
|
||||
num = num+1
|
||||
let uid = "?uid\=7b84eae4-fb34-4689-9f33-24071c3e5a41"
|
||||
const newlink = link+uid;
|
||||
console.log(newlink)
|
||||
screenshots(newlink, resource, num);
|
||||
}
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
async function screenshots(newlink, resource, num) {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.setViewport({ width: 390, height: 844 })
|
||||
await page.goto(newlink);
|
||||
await page.screenshot({path: `${resource}_${num}.png`, fullPage: true, headless: false});
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
courseOverview();
|
||||