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.81k stars 352 forks source link

TypeError: string indices must be integers #736

Closed yuis-ice closed 1 year ago

yuis-ice commented 1 year ago

The following gives me a result successfully:

// urls.yaml

kind: url
name: rakuten
url: https://www.rakuten-card.co.jp/campaign/add-card/
filter: "section[id='rule_detail']"
$ urlwatch --test-filter 29
<section id="rule_detail">
                    <div class="apply-lp-condition apply-lp-bg--gray apply-lp-py--lg">
                        <div class="mb-5">
// ..

When I add html2text in the chain, it starts to give me an error:

// urls.yaml

kind: url
name: rakuten
url: https://www.rakuten-card.co.jp/campaign/add-card/
filter: 
  - css: "section[id='rule_detail']"
  - html2text
$ urlwatch --test-filter 29
Traceback (most recent call last):
  File "/home/yuis/.local/bin/urlwatch", line 111, in <module>
    urlwatch_command.run()
  File "/home/yuis/.local/lib/python3.6/site-packages/urlwatch/command.py", line 293, in run
    self.handle_actions()
  File "/home/yuis/.local/lib/python3.6/site-packages/urlwatch/command.py", line 179, in handle_actions
    sys.exit(self.test_filter())
  File "/home/yuis/.local/lib/python3.6/site-packages/urlwatch/command.py", line 133, in test_filter
    raise job_state.exception
  File "/home/yuis/.local/lib/python3.6/site-packages/urlwatch/handler.py", line 90, in process
    filter_kind, subfilter = key, item[key]
TypeError: string indices must be integers
thp commented 1 year ago

Which version of urlwatch are you using?

See this: https://urlwatch.readthedocs.io/en/latest/deprecated.html#string-based-filter-definitions-since-2-19

yuis-ice commented 1 year ago

I was on the version urlwatch 2.17. I upgraded to the latest urlwatch 2.25 the html2text problem has gone. Thanks for your help.