Download works properly but Google removes it the moment i select "Show in Finder" -
Safe Browsing set to "No protection (not recommended)"
My goal is to create a simple script that will download and timestamp webarchives that I can run daily with cron or iCal
Ran script seems to work well, downloads web page as archive but Chrome somehow deleted the download
Any help appreciated
#!/bin/bash
# Set the URL of the website to open in Chrome
URL="https://thescottsdaleherald.com/"
# Set the directory to save the web archive file to
SAVE_DIR="$HOME/Desktop/"
# Get the current date in the format "day-month-year"
DATE=$(date +'%H-%d-%m-%Y')
# Open the website in Chrome
open -a "Google Chrome" "$URL"
# Wait for Chrome to load the website
sleep 5
# Get the title of the page
PAGE_TITLE=$(osascript -e 'tell application "Google Chrome" to return title of active tab of window 1')
# Replace any commas in the page title with hyphens
PAGE_TITLE=${PAGE_TITLE//,/}
# Save the web archive file with the format "pagetitle,day,month,year.webarchive"
FILE_NAME="$PAGE_TITLE,$DATE.mht"
FULL_PATH="$SAVE_DIR/$FILE_NAME"
osascript -e 'tell application "Google Chrome" to save active tab of window 1 in file "'"$FULL_PATH"'" '