updated intro with description of the newegg 4090 example
This commit is contained in:
parent
e13a8c873d
commit
45f964d6ca
1 changed files with 49 additions and 2 deletions
49
README.md
49
README.md
|
@ -5,10 +5,57 @@ A change detection server that can notify through various services written in Go
|
||||||
|
|
||||||
# Intro
|
# Intro
|
||||||
|
|
||||||
GoWatch works through filters, a filter performs certain operations on the input it recieves.
|
GoWatch works through filters, a filter performs operations on the input it recieves.
|
||||||
Here is an example of a 'Watch' that calculates the lowest and average price of 4090s on NewEgg and notifies the user if the lowest price changed:
|
Here is an example of a 'Watch' that calculates the lowest and average price of 4090s on NewEgg and notifies the user if the lowest price changed:
|
||||||

|

|
||||||
|
|
||||||
|
Note that everything, including scheduling/storing/notifying, is a `filter`.
|
||||||
|
|
||||||
|
`Schedule` is a [cron](#cron) filter with a '@every 15m' value, so this will run every 15 minutes.
|
||||||
|
|
||||||
|
`NewEgg Fetch` is a [Get URL](#get-url) filter with a 'https://www.newegg.com/p/pl?N=100007709&d=4090&isdeptsrh=1&PageSize=96' value, it's output will be the HTTP response.
|
||||||
|
|
||||||
|
`Select Price` is a [CSS](#css) filter with the value '.item-container .item-action strong[class!="item-buying-choices-price"]' value, it's output will be the html elements containing the prices.
|
||||||
|
An alternative filter type could've been the [XPath](#xpath) filter.
|
||||||
|
|
||||||
|
`Sanitize` is a [Replace](#replace) filter, using a regular expression ('[^0-9]') it removes anything that's not a number.
|
||||||
|
|
||||||
|
`Avg` is an [Average](#average) filter, it calculates the average value of its inputs.
|
||||||
|
|
||||||
|
`Min` is a [Minimum](#minimum) filter, it calculates the minimum value of its inputs.
|
||||||
|
|
||||||
|
`Store Avg` and `Store Min` are [Store](#store) filters, they store its input values in the database.
|
||||||
|
|
||||||
|
`Diff` is a [Different Then Last](#different-then-last) filter, only passing on the inputs that are different then the last value stored in the database.
|
||||||
|
|
||||||
|
`Notify` is a [Notify](#notify) filter, if there are any inputs to this filter, it will execute a template and send the result to a user defined 'notifier' (Telegram/Discord/Matrix/etc).
|
||||||
|
|
||||||
|
# Filters
|
||||||
|
|
||||||
|
## Cron
|
||||||
|
|
||||||
|
## Get URL
|
||||||
|
|
||||||
|
## CSS
|
||||||
|
|
||||||
|
## XPath
|
||||||
|
|
||||||
|
## Replace
|
||||||
|
|
||||||
|
## Store
|
||||||
|
|
||||||
|
## Notify
|
||||||
|
|
||||||
|
## Math
|
||||||
|
|
||||||
|
### Average
|
||||||
|
|
||||||
|
### Minimum
|
||||||
|
|
||||||
|
## Condition
|
||||||
|
|
||||||
|
### Different Then Last
|
||||||
|
|
||||||
## type script compilation
|
## type script compilation
|
||||||
|
|
||||||
`tsc static/*.ts --lib es2020,dom --watch --downlevelIteration`
|
`tsc static/*.ts --lib es2020,dom --watch --downlevelIteration`
|
||||||
|
|
Loading…
Add table
Reference in a new issue