konstin / github-wikidata-bot

Updates Wikidata entries using metadata from github
https://www.wikidata.org/wiki/User:Github-wiki-bot
Other
39 stars 8 forks source link

Spam filter crashes the bot #139

Open konstin opened 3 years ago

konstin commented 3 years ago

I've been getting this error from the cron job for a couple of days:

Traceback (most recent call last):
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/page/_decorators.py", line 29, in handle
    func(self, *args, **kwargs)
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/page/__init__.py", line 3717, in addClaim
    self.repo.addClaim(self, claim, bot=bot, **kwargs)
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/site/_decorators.py", line 92, in callee
    return fn(self, *args, **kwargs)
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/site/_datasite.py", line 369, in addClaim
    data = req.submit()
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/data/api.py", line 1922, in submit
    raise APIError(**result['error'])
pywikibot.data.api.APIError: failed-save: The save has failed.
[messages: [{'name': 'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has failed.'}}, {'name': 'spam-blacklisted-link', 'parameters': [{'list': ['anti-captcha.com'], 'type': 'text'}], 'html': {'*': 'The text you wanted to publish was blocked by the spam filter.\nThis is probably caused by a link to a forbidden external site.\nThe following text is what triggered our spam filter: anti-captcha.com'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./main.py", line 844, in <module>
    main()
  File "./main.py", line 838, in main
    raise e
  File "./main.py", line 835, in main
    update_wikidata(properties, edit_group_hash)
  File "./main.py", line 655, in update_wikidata
    set_website(item, project, url_normalized, edit_group_hash)
  File "./main.py", line 609, in set_website
    claim, created = get_or_create_claim(
  File "./main.py", line 174, in get_or_create_claim
    item.addClaim(claim, summary=get_summary(edit_group_hash))
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/page/_decorators.py", line 50, in wrapper
    handle(func, self, *args, **kwargs)
  File "/home/utasart/github-wikidata-bot/.venv/lib/python3.8/site-packages/pywikibot/page/_decorators.py", line 42, in handle
    raise pywikibot.OtherPageSaveError(self, err)
pywikibot.exceptions.OtherPageSaveError: Edit to page [[Q107387130]] failed:
failed-save: The save has failed.
[messages: [{'name': 'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has failed.'}}, {'name': 'spam-blacklisted-link', 'parameters': [{'list': ['anti-captcha.com'], 'type': 'text'}], 'html': {'*': 'The text you wanted to publish was blocked by the spam filter.\nThis is probably caused by a link to a forbidden external site.\nThe following text is what triggered our spam filter: anti-captcha.com'}}];
 help: See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
Uzume commented 2 years ago

These issues are also logged:

And in this case caused by:

I agree with GZWDer that try and catch should be used to contain these exceptions.