Initial rough commit
All checks were successful
Cargo Build & Test / Rust project - latest (1.88) (push) Successful in 3m30s
Cargo Build & Test / Rust project - latest (1.85.1) (push) Successful in 4m1s
Cargo Build & Test / Rust project - latest (1.87) (push) Successful in 4m5s
Cargo Build & Test / Rust project - latest (1.86) (push) Successful in 9m41s

This commit is contained in:
2025-06-22 03:00:41 -04:00
parent 5975323678
commit b9cc62e3dd
21 changed files with 12386 additions and 0 deletions

View File

@ -0,0 +1,11 @@
[Unit]
Description=Run a single instance of a fetch
After=syslog.target network.target
[Service]
Type=exec
#Environment=XDG_DATA_HOME=/home/hak8or/code/ebay_scraper_rust/.tmp_run
ExecStart=/usr/local/bin/scraper_fetch.sh
[Install]
WantedBy=multi-user.target

31
systemd/scraper_fetch.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/env bash
URL_PER_PAGE_60="&_ipg=60"
URL_PER_PAGE_240="&_ipg=240"
URL_MIN_PRICE_USD_60="&_udlo=60.00"
URL_SEARCHTERM_NONE="&_nkw="
URL_LOCATION_NORTHAMERICA="&LH_PrefLoc=3"
URL_BASE_LISTING="https://www.ebay.com/sch/i.html?"
if [ -z "${XDG_DATA_HOME}" ]; then
echo "XDG_DATA_HOME was not set, bailing!"
exit
fi
DIR_SSDS="$XDG_DATA_HOME/ebay_scraper/raw_scraped/ssd"
mkdir -p "$DIR_SSDS"
if [ ! -s "$DIR_SSDS/url.json" ]; then
URL_CATEGORY_SSD="&_sacat=175669"
URL_SSDS="$URL_BASE_LISTING$URL_SEARCHTERM_NONE$URL_CATEGORY_SSD&_from=R40&_fsrp=1$URL_LOCATION_NORTHAMERICA&imm=1&_sop=10$URL_PER_PAGE_240"
echo "{\"url\": \"$URL_SSDS\"}" > "$DIR_SSDS/url.json"
fi
wget -o "$DIR_SSDS/$(date +%s).html" "$(jq '.url' $DIR_SSDS/url.json)"
DIR_MINIPC="$XDG_DATA_HOME/ebay_scraper/raw_scraped/minipc"
mkdir -p "$DIR_MINIPC"
if [ ! -s "$DIR_MINIPC/url.json" ]; then
URL_CATEGORY_MINIPC_ALLINONE="&_sacat=179"
URL_MINIPC="$URL_BASE_LISTING$URL_SEARCHTERM_NONE$URL_CATEGORY_MINIPC_ALLINONE&_from=R40&_fsrp=1$URL_LOCATION_NORTHAMERICA&imm=1&_sop=10$URL_PER_PAGE_240"
echo "{\"url\": \"$URL_MINIPC\"}" > "$DIR_MINIPC/url.json"
fi
wget -o "$DIR_MINIPC/$(date +%s).html" "$(jq '.url' $DIR_MINIPC/url.json)"

View File

@ -0,0 +1,10 @@
[Unit]
Description=Run a fetch of a website
[Timer]
OnBootSec=15min
OnUnitActiveSec=1h
Persistent=true
[Install]
WantedBy=timers.target