Commons:Bots/Requests/Gabrielchihonglee-Bot (4)
Gabrielchihonglee-Bot (talk · contribs) (4)
Operator: Gabrielchihonglee (talk · contributions · Statistics · Recent activity · block log · User rights log · uploads · Global account information)
Bot's tasks for which permission is being sought: Remove redundant interlanguage links from category pages that are already linked by {{Interwiki from Wikidata}}. Eg.: It would remove [[nl:Postzegel]]
(nl:Postzegel) from Category:Stamps because its a duplication.
This task is similar in both functionality and logic to Commons:Bots/Requests/YiFeiBot_(22); requested at User_talk:Zhuyifei1999/Archive_33#Complex_Interwiki.
The bot:
- scans a complete dump of Commons
- filters out Category pages with at least one interlanguage link at the time of the dump
- check to see if the current revision transcludes (both directly and indirectly) {{Interwiki from Wikidata}} by using MediaWiki API.
- searches for a direct {{Interwiki from Wikidata}} call in the current page wikitext using mwparserfromhell, and expand that with expandtemplates MediaWiki API call. If not found, expand
{{Interwiki from Wikidata}}
without parameters instead as it is very unlikely (as of now) that any indirect use supplies a custom Wikidata item ID. - search for and remove duplicated interlanguage links in current page wikitext and in the expanded template. Duplication does not require the link wikitext to be exactly equal, but the page it points to must be the same.
Similar to YiFeiBot (22), this bot will not edit Wikidata; any interlanguage removed are "redundant" that another user or bot added to wikidata.
Automatic or manually assisted: Automatic unsupervised
Edit type (e.g. Continuous, daily, one time run): Weekly
Maximum edit rate (e.g. edits per minute): 6 edits per minute
Bot flag requested: (Y/N): N
Programming language(s): Python: pywikibot & mwparserfromhell
Script: [1]
Gabrielchihonglee (talk) 02:51, 31 March 2018 (UTC)
Zhuyifei1999 (talk) 02:55, 31 March 2018 (UTC)
Discussion
- Pinging those whom I talked to about this task. @Liné1 and Mike Peel: And I think @Jarekt: is probably interested as well. --Zhuyifei1999 (talk) 03:17, 31 March 2018 (UTC)
- Support but can the bot also add or remove Category:Pages with local interwiki links (or better name) for pages where old style links are still present. --Jarekt (talk) 03:54, 31 March 2018 (UTC)
- I think I'd make another bot task that solely maintains (adds & removes) the category for all namespaces, since this task is limited to category pages only ;) Can you create the category? --Zhuyifei1999 (talk) 04:05, 31 March 2018 (UTC)
- ran test (~25 edits, [2]) -- Gabrielchihonglee (talk) 03:55, 31 March 2018 (UTC)
- Support. Does it interact OK with {{Wikidata Infobox}}, which auto-includes {{Interwiki from Wikidata}} where needed (and should replace direct usage of that template in category space shortly)? E.g., at Category:Den Danske Frimurerorden. Thanks. Mike Peel (talk) 10:36, 31 March 2018 (UTC)
- Yes it does work on those pages. [3] -- Gabrielchihonglee (talk) 23:52, 31 March 2018 (UTC)
- That's great, thank you! Mike Peel (talk) 00:02, 1 April 2018 (UTC)
- Yes it does work on those pages. [3] -- Gabrielchihonglee (talk) 23:52, 31 March 2018 (UTC)
- This bot is needed (even if already implemented by other bot). But I see 2 important feature requests:
- {{VN}} has the same behavior than {{Interwiki from Wikidata}}. So your bot should also treat {{VN}}
- {{Interwiki from Wikidata}} get interwiki from wikidata ('Category:Achariaceae' (Q8833475)), but also from wikidata's P301 (category's main topic) ('Achariaceae' (Q651518)). So your bot should remove both set categories. User:YiFeiBot could not implement that. Would you do it, please? Best regards Liné1 (talk) 12:00, 31 March 2018 (UTC)
- @Liné1: Does {{VN}} call or expand {{Interwiki from Wikidata}}? If so, the bot should handle it automatically. If not, I don't think it would be a great idea to reinvent the wheel, especially when {{VN}} expands into many other texts besides interlanguage links.
- Sorry Zhuyifei1999, {{VN}} did it before {{Interwiki from Wikidata}} ;-) Also calling lua module twice is bad for performances. It really involve 5-6 lines of code max. Cheers Liné1 (talk) 08:11, 1 April 2018 (UTC)
- @Liné1: Let's dissect this:
- {{VN}} did it before {{Interwiki from Wikidata}}
- From a bot operator's perspective, which ones does first does not matter; an alternative implementation can require a complete different code path, and we would have to reinvent the wheel. Besides, an alternative uncommon implementation will likely to eventually become code rot, which I do not endorse, and I don't think Gabriel will either.
- Also calling lua module twice is bad for performances.
- Performance is a really bad argument without solid reasoning to back up the argument. Did you do profiling? Or is there some theoretical bottleneck that cannot be fixed?
- It really involve 5-6 lines of code max.
- Do you mean changing {{VN}}? In that case, probably. You could just to remove the old langlink code and add
{{Interwiki from Wikidata}}
ormw.getCurrentFrame():expandTemplate{ title ='Interwiki from Wikidata' }
in the case of calling in-lua. - Or do you mean changing the bot code? In that case, probably not. In the above bot description steps 3 & 4 are bound to {{Interwiki from Wikidata}}. Support for another template will require some rewriting.
- --Zhuyifei1999 (talk) 17:34, 1 April 2018 (UTC)
- @Liné1: Let's dissect this:
- Sorry Zhuyifei1999, {{VN}} did it before {{Interwiki from Wikidata}} ;-) Also calling lua module twice is bad for performances. It really involve 5-6 lines of code max. Cheers Liné1 (talk) 08:11, 1 April 2018 (UTC)
- Currently this bot uses whatever {{Interwiki from Wikidata}} expands into, which is the latter case. The former should be handled by User:YiFeiBot. Providing both functionalities in a single bot script adds unnecessary complexity, hence two complementary bot tasks. --Zhuyifei1999 (talk) 00:41, 1 April 2018 (UTC)
- Sorry again Zhuyifei1999, I did not understand your answer. My problem has to be adressed and you said that your bot YiFeiBot could not do it. Cheers Liné1 (talk) 08:11, 1 April 2018 (UTC)
- Let's dissect this again:
- {{Interwiki from Wikidata}} get interwiki from wikidata ('Category:Achariaceae' (Q8833475))
- No it does not. Direct linking is handled by Wikibase Client natively. This part is referred to the 'former' in my above comment and is handled by User:YiFeiBot
- but also from wikidata's P301 (category's main topic) ('Achariaceae' (Q651518))
- This bot uses whatever {{Interwiki from Wikidata}} expands into (the 'latter' case). Whether the template uses P0 or P1 or P301 or P302 or P303 pr Pinfinity is outside its concern.
- So your bot should remove both set categories.
- Do you mean both sets of interlanguage links? They will be handled by two separate bots.
- User:YiFeiBot could not implement that.
- I did not say I could not implement that, but I implied that I should not implement that into a single bot run. My original words were "I'd personally think that two separate bot runs, one solely for direct wikidata and one solely for {{Interwiki from wikidata}}, can simplify the code a lot."
- --Zhuyifei1999 (talk) 17:34, 1 April 2018 (UTC)
- Let's dissect this again:
- Sorry again Zhuyifei1999, I did not understand your answer. My problem has to be adressed and you said that your bot YiFeiBot could not do it. Cheers Liné1 (talk) 08:11, 1 April 2018 (UTC)
- @Liné1: Does {{VN}} call or expand {{Interwiki from Wikidata}}? If so, the bot should handle it automatically. If not, I don't think it would be a great idea to reinvent the wheel, especially when {{VN}} expands into many other texts besides interlanguage links.
- I would like to see this clean-up as part of {{Wikidata Infobox}} deployment. --EugeneZelenko (talk) 14:00, 31 March 2018 (UTC)
- Both bot codes are Python/pywikibot, so in principle this would be relatively straightforward to do. However, I think it's better to keep the tasks separate, so that a revert of a Wikidata infobox addition doesn't also revert trimming the interwiki links, and vice versa. Although I don't think either is likely in large quantities, it keeps things cleaner if they are separate. Thanks. Mike Peel (talk) 23:35, 31 March 2018 (UTC)
Can anybody please summarize if there are unaddressed issues/concerns? @Zhuyifei1999: ? --Krd 06:44, 7 April 2018 (UTC)
- Can someone else summarize? I wrote parts of the script and as a semi-bot-operator I think I addressed whatever that needs to be addressed. --Zhuyifei1999 (talk) 15:38, 7 April 2018 (UTC)
- Most of the above arguments were about expanding the code or merging bot tasks. In terms of the original task requested, everything looks OK, and it's a useful task to do. Adding support for {{VN}} might be useful, but not doing so doesn't harm this task, and it's something that could be added later / be the subject of another bot request. Merging bot tasks together might be good, but adds complexity to the code and to the edits, so it's simpler to keep them separate, and there's negligible downside. So I'd suggest that the points here are suitably resolved and this should be ready to go. Thanks. Mike Peel (talk) 15:38, 11 April 2018 (UTC)
Approved. --Krd 06:15, 13 April 2018 (UTC)