Walmart script in production! And more notes.

This commit is contained in:
Norm Rasmussen
2023-02-01 18:11:39 -05:00
parent 55eb10b0f5
commit 3fd15aee52
102 changed files with 2729 additions and 63 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -0,0 +1,83 @@
from PIL import Image
import glob
import os
from datetime import date
def find_pictures():
files = []
currentdir = "/Users/normrasmussen/Documents/Northpass/Scripts/Walmart_Screenshots/"
listfiles = glob.glob(currentdir + "*.png")
for file in listfiles:
files.append(os.path.basename(file))
# Now file will only show the file name, not the entire path
split_resources(files)
def split_resources(files):
print(files)
try:
resource_title = files[0]
resource_title = resource_title[:-6]
files.sort()
new_list = []
for file in files:
if resource_title in file:
new_list.append(file)
for item in new_list:
files.remove(item)
split_resources(files)
print(new_list)
process_pictures(new_list, resource_title)
except IndexError as e:
pass
finally:
pass
def process_pictures(new_list, resource_title):
today = date.today()
today = today.strftime("%m.%d.%Y")
image_list = []
print(new_list)
print(resource_title)
resource = Image.open(new_list[0])
resource = resource.convert("RGB")
for picture in new_list[1:]:
image = Image.open(picture)
converted = image.convert("RGB")
image_list.append(converted)
# image_list.append(image)
resource.save(
rf"/Users/normrasmussen/Documents/Northpass/Scripts/Walmart_Screenshots/PDFs/{resource_title}_{today}.pdf",
save_all=True,
append_images=image_list,
)
def notusable():
image1 = Image.open(
r"/Users/normrasmussen/Documents/Northpass/Scripts/Walmart_Screenshots/Branch Wallet FAQs_1.png"
)
image2 = Image.open(
r"/Users/normrasmussen/Documents/Northpass/Scripts/Walmart_Screenshots/Branch Wallet FAQs_2.png"
)
image3 = Image.open(
r"/Users/normrasmussen/Documents/Northpass/Scripts/Walmart_Screenshots/Branch Wallet FAQs_3.png"
)
im1 = image1.convert("RGB")
im2 = image2.convert("RGB")
im3 = image3.convert("RGB")
imagelist = [im1, im2, im3]
im1.save(
r"/Users/normrasmussen/Documents/Northpass/Scripts/Walmart_Screenshots/mergedImages.pdf",
save_all=True,
append_images=imagelist,
)
if __name__ == "__main__":
find_pictures()

View File

@ -1,37 +1,67 @@
const puppeteer = require('puppeteer');
const path = require('path')
// const urls = [...]
/*for (let i=0; i<urls.length; i++){
/*
for (let i=0; i<urls.length; i++){
const url = urls[i];
await page.goto('${url}');
await page.waitForNavigation({ waitUntil: 'networkkidle2' });
}*/
}
const url = [
"https://walmart.northpass.com/app/courses/90bbdf4d-c674-403c-93d1-1c2e43364e0e", // Tax Filling FAQs
"https://walmart.northpass.com/app/courses/6b74d176-6027-40f5-af0c-fdee6d4f53bf", // Tips for Claiming your Branch Wallet
"https://walmart.northpass.com/app/courses/5624342f-9927-4704-bc6b-5c84068c0564", // Branch Wallet FAQs
"https://walmart.northpass.com/app/courses/65a83b52-08e9-48ac-b953-59dfa22f7358", // Pointers on Viewing your Earnings
"https://walmart.northpass.com/app/courses/0cd301a1-d98e-4837-ae9a-6fbd6a152aa3", // Curious how trip earnings works?
"https://walmart.northpass.com/app/courses/71a2064f-600d-415b-9b93-0a695793a09b", // Having Issues Confirming your arrival?
"https://walmart.northpass.com/app/courses/f9fea960-9fb3-4d05-858a-ea9a5657e20a", // Not Receiving App Notifications?
"https://walmart.northpass.com/app/courses/dce79912-ffe2-4648-a258-d725dbea6dc4", // Pointers on vehicle details
"https://walmart.northpass.com/app/courses/59a21c93-36ed-4e25-a723-6c8b3e6a80f0", // Pointers on Creating Your Account
"https://walmart.northpass.com/app/courses/17224d43-5acc-4dfb-805b-53f85cafb633", // Pointers on Downloading the App
"https://walmart.northpass.com/app/courses/bb1449eb-9b8d-48b2-9e05-1261171bd0e7", // Reviewing your trips
"https://walmart.northpass.com/app/courses/b30329fa-825f-4447-85f2-6caeea998ec6", // Pointers on Sharing Your Location
"https://walmart.northpass.com/app/courses/6c94e20c-aff7-465a-baaf-c32804fa7c9c", // Turning off Spark Now
"https://walmart.northpass.com/app/courses/2e616785-7ec7-40f0-a6a7-069f3c8c4c02", // Updating Spark Driver App
"https://walmart.northpass.com/app/courses/f3be53c0-cd21-4a2d-97f0-8b84ba030f4a", // Questions about Earnings
"https://walmart.northpass.com/app/courses/e889b1de-6305-424c-b0cd-47e36e798fa3", // Damaged Order or Item
"https://walmart.northpass.com/app/courses/8e20a3e6-37ef-4538-9047-4bcce5666d59", // Error messages & Alerts
]
*/
const apiKey = "6hUfJdAartHTHhHc0WIRZYPWe"
const url = process.argv[2];
if (!url) {
throw "Please provide a URL as the first argument";
}
const uid = "/\?uid\=7b84eae4-fb34-4689-9f33-24071c3e5a41";
const activity = new Array();
const activityLinks = new Array();
var num = 0
var num = 1
/*
function loopUrls() {
for (item of url){
console.log(item)
courseOverview()
}
}*/
async function courseOverview() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
const course = url+uid;
await page.setViewport({ width:390, height:844 })
await page.goto(url);
await page.goto(course);
await page.title();
const [getXpath] = await page.$x('//*[@id="course-desktop"]/div/div[3]/div[2]/div[2]/div[2]/ol/li/div');
const [getXpath] = await page.$x('/html/body/div[2]/div/div');
// 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});
await page.screenshot({path: `${resource}_1.png`, fullPage:true, headless:false});
const hrefs = await page.$$eval('a', as => as.map(a => a.href));
var links = Object.entries(hrefs);
@ -44,9 +74,8 @@ async function courseOverview() {
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)
// console.log(newlink)
screenshots(newlink, resource, num);
}
await browser.close();