A little Ruby script that searches the FinShop webshop for a given keyword and prints a message to stdout
or sends a push notification to your phone (via Prowl) if new products are found. The script is smart enough to remember the products it notfied you for so you'll only see new products once.
Make sure you have a somewhat recent version of Ruby installed (was tested in 2.3.5
but should run with slightly older versions as well). Download or clone this repository and run the script.
Search for all products with keyword
and print the results to stdout
:
$ ruby finshop.rb keyword
Search for all products with keyword
and send a push notification via Prowl:
$ PROWL_KEY=abc123 ruby finshop.rb keyword
The database will be stored in the same directory in a file named keyword.yml
. It will create a database file per search keyword so you can watch different product searches as well.
I run this in a weekly crontab watching out for toys my kids might be interested in.
As a small exercise to see what's possible using only Ruby's Standard Lirbrary, without using any gems. Seems it's not that hard to create a fully funcational little application thingy without any dependencies. I discovered the YAML::Store library, which can easily be used to persist simple data structures, but was dissapointed by the lack of HTML parser in the Standard Library. You'll find REXML but HTML is not (always) XML so I had to revert to string matching.