Crawl-delay between page loads.
What Apostate changes
Each site gets its own user data directory, where Chromium keeps cookies and storage. The first launch on a directory stores a seed in itsapostate/identity file, and every later launch presents the same machine with the same cookies. The site sees the same Windows desktop on each run, with its consent choice and region settings kept. Seeds and identity covers the identity file.
Set up
apostate fonts install windows is for Linux and macOS hosts (Fonts). The folder holds two files:
monitor.pyreads the pages, stores each value inprices.dband prints the changes. It keeps one user data directory per site inprofiles/.demo_shop.pyis a local shop on127.0.0.1:8765whose prices change from one run to the next.monitor.pyuses it when you pass no pages.
The script
watch_site() launches a browser on one site’s user data directory, reads the site’s robots.txt, and loads each page with a delay in between:
urllib.robotparser:
Run it
/cart and sets Crawl-delay: 2, so the pages load 2 to 3 seconds apart.
Every value is a row in the observations table of prices.db:
Watch your own pages
Pass each page with the CSS selector of the value to read. Repeat--watch for more pages:
Points for this job
- One user data directory per site. A site’s cookies, such as a consent choice or a selected region and currency, stay in its directory from run to run. Copy the
profiles/directory to back it up. The copy presents the same machine. - Seeds. The identity file holds each directory’s seed. To choose the seed yourself, write it to
profiles/<host>/apostate/identitybefore the first launch. Seeds and identity covers the file. - Pacing.
--delaysets the seconds between page loads on one site, 30 by default, plus up to half as much again at random. A largerCrawl-delayin robots.txt wins. The script reads sites one after another, one page at a time. - Region. Prices often depend on the visitor’s country.
--localeand--timezonefix the locale and timezone. WithAPOSTATE_PROXYset, every page loads through that proxy. Use an exit in the same region on every run, and pass that region’s locale and timezone, because the script turns off the GeoIP lookup. Proxies covers proxy URLs. - Values. The script stores the element’s text as it is. A selector that matches nothing within 10 seconds stores
(not found), so a page whose markup changed shows up as a change. Parse numbers yourself if you need them. - Headless. Reading pages needs no window. The default headless launch presents the persona’s screen.