thp / urlwatch

Watch (parts of) webpages and get notified when something changes via e-mail, on your phone or via other means. Highly configurable.
https://thp.io/2008/urlwatch/
Other
2.82k stars 352 forks source link

inaccurate jq documentation #642

Closed fishstik closed 2 years ago

fishstik commented 3 years ago

The jq section in the filters documentation gives an example usage of the jq filter:

url: https://example.net/jobs.json
filter:
   - jq:
      query: '.[].title'

However when I try this, I get the following error:

Traceback (most recent call last):
  File "/home/pi/dev/urlwatch/urlwatch/lib/urlwatch/handler.py", line 120, in process
    data = FilterBase.process(filter_kind, subfilter, self, data)
  File "/home/pi/dev/urlwatch/urlwatch/lib/urlwatch/filters.py", line 187, in process
    return filtercls(state.job, state).filter(data, subfilter)
  File "/home/pi/dev/urlwatch/urlwatch/lib/urlwatch/filters.py", line 902, in filter
    raise ValueError('{} filter needs a query'.format(self.__kind__))
ValueError: jq filter needs a query

It works with the following filter notation:

url: https://example.net/jobs.json
filter:
   - jq: '.[].title'
thp commented 2 years ago

Hm, weird -- the following works for me:

url: https://api.github.com/repos/voxpupuli/puppet-rundeck/tags
filter:
 - jq:
    query: '.[0].name'

Which version of urlwatch are you using?

fishstik commented 2 years ago

I'm now unable to reproduce this. Not sure what caused the error initially.