Commons:Bots/Requests/YiFeiBot (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:
- Operates recursively on Category:Multilingual_tags:_Locations_by_country
- Get the Wikidata IDs similar to task 20's method, from interwiki links of all parameters (except "lang" which is explicitly ignored) of {{LangSwitch}}
- Instead of adding a
|Wikidata=
this task replace the {{LangSwitch}} with{{Label|Q123|{{{1|{{int:lang}}}}}}}
where Q123 is the Wikidata item ID - Because Category:Multilingual_tags:_Locations_by_country is not a explicit "Location multilingual tags still using LangSwitch", finding what pages the bot had errors on are likely harder (I can't think of a better way to handle this).
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)
Discussion
- I rolled-back the first test run, as I noticed a parameter, namely "nolink" removed. @Jarekt: Do you have a solution of supporting the parameter with {{Label}}? Or should it be considered obsolete and we'll discontinue its support? --Zhuyifei1999 (talk) 13:53, 18 July 2016 (UTC)
- 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)- 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)- 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)
- Ok so a new test run
Done at [1] (Also corrected regex to
\{\{\{([^\{\|\}]*)(?:\|.*?)?\}\}\}
) --Zhuyifei1999 (talk) 16:14, 19 July 2016 (UTC)- The edits look good to me. I think this task is ready for approval. --Jarekt (talk) 17:37, 19 July 2016 (UTC)
- Looks OK for me. --EugeneZelenko (talk) 14:03, 20 July 2016 (UTC)
- Ok so a new test run
- 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)
- 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
- 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 "
Speedy approved. Experienced operator, broad support. --Krd 15:57, 21 July 2016 (UTC)