Commons:Bots/Requests/YiFeiBot (27)

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

YiFeiBot (talk · contribs) (27)

Operator: Zhuyifei1999 (talk · contributions · Statistics · Recent activity · block log · User rights log · uploads · Global account information)

Bot's tasks for which permission is being sought: From COM:BWR, mostly similar to task 20 & task 26, differences:

Since on BWR it's said that these tags are created from interwiki links I'll assume the Wikidata version of links is always superior to our LangSwitch links

Automatic or manually assisted: Automatic unsupervised

Edit type (e.g. Continuous, daily, one time run): One time run (because of #1 & #3 this isn't as safe as the previous two tasks)

Maximum edit rate (e.g. edits per minute): 6 edits per min

Bot flag requested: (Y/N): N

Programming language(s): python: pywikibot

Zhuyifei1999 (talk) 13:43, 18 July 2016 (UTC)[reply]

Discussion

I see templates in Category:Multilingual tags: Country names use "nolink" parameter. Those can be rewriten like this, so {{Hungary}} gives "Hungary" and {{Hungary|nolink=1}} gives "Hungary". To think about it we can rewrite all those templates with "nolink" parameter, so they are all consistent. Your code could skip a template if no {{LangSwitch}} is found, any other parameter than "{{{1|}}}" or "{{{nolink|}}}" is found or no interwiki links are found (like in Template:Thuringia/nolink). --Jarekt (talk) 16:26, 18 July 2016 (UTC)[reply]
How about putting the parameter inline? About detecting parameters, mwparserfromhell has no documented method to detect parameters; while it sounds bad, I could use a regex to find all \{\{\{([^\{\|\}]*)(?:\|.+?)\}\}\} and check it against "1" and "nolink". About missing {{LangSwitch}} and missing interwiki links, nothing would be done naturally, as the script is dependent on the interwiki links inside the parameters of {{LangSwitch}}; and iw links outside the template is ignored. --Zhuyifei1999 (talk) 10:47, 19 July 2016 (UTC)[reply]
That sounds like a good plan. I like your template improvement. Regex to check input parameter names is also a good idea. Most of those templates are supposed to be very similar, following the same pattern and if something is different, than the bot should just skip and go to the next one. --Jarekt (talk) 15:49, 19 July 2016 (UTC)[reply]
Ok so a new test run ✓ Done at [1] (Also corrected regex to \{\{\{([^\{\|\}]*)(?:\|.*?)?\}\}\}) --Zhuyifei1999 (talk) 16:14, 19 July 2016 (UTC)[reply]
The edits look good to me. I think this task is ready for approval. --Jarekt (talk) 17:37, 19 July 2016 (UTC)[reply]
Looks OK for me. --EugeneZelenko (talk) 14:03, 20 July 2016 (UTC)[reply]

Speedy approved. Experienced operator, broad support. --Krd 15:57, 21 July 2016 (UTC)[reply]