Wikidata:Requests for permissions/Bot/BsivkoBot
- The following discussion is closed. Please do not modify it. Subsequent comments should be made in a new section. A summary of the conclusions reached follows.
- Not done @Bsivko: This request seems to be abandoned, please reopen it if that is not the case. Thanks. Mike Peel (talk) 21:17, 18 January 2022 (UTC)[reply]
BsivkoBot (talk • contribs • new items • new lexemes • SUL • Block log • User rights log • User rights • xtools)
Operator: Bsivko (talk • contribs • logs)
I already have BsivkoBot at ruwiki. Do I need to register another account here? Or, should I link the existed bot? (right now, User account "BsivkoBot" is not registered)
Task/s:
- Check Britannica URL (P1417) and clean up invalid claims. The reason that there are a lot of claims which linked to nowhere. For instance, Q1143358 has P1417 as
sports/shortstop
, which goes tohttps://www.britannica.com/sports/shortstop
where we have Britannica does not currently have an article on this topic.
Code:
- I use pywikibot, and currently I have a piece of software which gets P1417, makes a request with URL, gets page text, recognize article absence and stops with permissions exception:
item = pywikibot.ItemPage.fromPage(page)
if item:
item.get()
if item.claims:
if 'P1417' in item.claims:
brit_value = item.claims['P1417'][0].getTarget()
brit_url = "https://www.britannica.com/" + brit_value
r = requests.get(url=brit_url)
if r.status_code == 200:
if "Britannica does not currently have an article on this topic" in r.text:
item.removeClaims(item.claims['P1417'], summary=f"Article in Britannica is absent (URL: 'Template:Brit url').")
pass
Afterwards, I'm going to make test runs and integrate it with the other bot functions (I work with external sources at ruwiki, and in some cases auto-captured links from wikidata are broken and it leads to user complains).
Function details: --Bsivko (talk) 19:37, 28 December 2019 (UTC)[reply]
- Please create an account for your bot here and make some test edits.--Ymblanter (talk) 21:26, 28 December 2019 (UTC)[reply]
- I logged in by BsivkoBot via ruwiki and went to wikidata. It created the account (user BsivkoBot is existed here now). After that, I made a couple of useful actions by hand (not with bot), so BsivkoBot can do smth on the project. Next, I tried to run the code above and the exception changed to a different one:
{'error': {'code': 'failed-save', 'info': 'The save has failed.', 'messages': [{'name': 'wikibase-api-failed-save', 'parameters': [], 'html': {'*': 'The save has failed.'}}, {'name': 'abusefilter-warning-68', 'parameters': ['new editor removing statement', 68], 'html': {'*': 'Warning: The action you are about to take will remove a statement from this entity. In most cases, outdated statements should not be removed but a new statement should be added holding the current information. The old statement can be marked as deprecated instead.'}}], 'help': 'See https://www.wikidata.org/w/api.php for API usage. ..
- I checked that it possible to remove the claim. So, the problem is on the bot side. Could you please help me, is it a permission problem or the code should be different? (as I see, it requires write rights, but I do not see any rights now) Bsivko (talk) 00:15, 29 December 2019 (UTC)[reply]
- I changed the logic to setting of deprecated rank, and it was a success! Bot changed the rank and it was dissapeared for users in our article. Afterwards a test run, the code is the following:
- I checked that it possible to remove the claim. So, the problem is on the bot side. Could you please help me, is it a permission problem or the code should be different? (as I see, it requires write rights, but I do not see any rights now) Bsivko (talk) 00:15, 29 December 2019 (UTC)[reply]
if item.claims:
if 'P1417' in item.claims:
for claim in item.claims['P1417']:
brit_value = claim.getTarget()
brit_url = "https://www.britannica.com/" + brit_value
r = requests.get(url=brit_url)
if r.status_code == 200:
if "Britannica does not currently have an article on this topic" in r.text:
claim.changeRank('deprecated', summary="Article in Britannica is absent (URL: '" + brit_url + "').")
pass
Currently, it works. I'll integrate it into production. Bsivko (talk) 11:58, 29 December 2019 (UTC)[reply]
- @Bsivko: The above error means you will require a confirmed flag for your bot.--GZWDer (talk) 21:03, 29 December 2019 (UTC)[reply]
- Ok, I've got it, thank you for the explanation! I already implemented the function and rank changing is enough, it resolved the problem. Bsivko (talk) 21:10, 29 December 2019 (UTC)[reply]
- Note your edits may be controversial. You should reach a consensus for such edits. (I don't support such edits, but someone may.)--GZWDer (talk) 21:48, 29 December 2019 (UTC)[reply]
- I understand. I just started the discussion on chat. Please, join. Bsivko (talk) 00:20, 30 December 2019 (UTC)[reply]
- Strong oppose per my comments when this was discussed in 2016. These are not "invalid claims". Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 19:07, 30 December 2019 (UTC)[reply]
- @Bsivko: Therefore, please revert all the edits your bot has made to uses of this property, to date. Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 19:11, 30 December 2019 (UTC)[reply]
- @Bsivko: BsivkoBot appears to be editing without authorization; there isn't support for more edits here, and I don't see another permissions request. Please stop the bot, or I will have to block it --DannyS712 (talk) 02:58, 8 May 2020 (UTC)[reply]
- As I see, current topic is still under discussion, and functions above are off till that moment. For the extra stuff I'll open another branch. Bsivko (talk) 12:35, 8 May 2020 (UTC)[reply]