Wiktionary:Entries needing topical attention/bot code

Hello, you have come here looking for the meaning of the word Wiktionary:Entries needing topical attention/bot code. In DICTIOUS you will not only get to know all the dictionary meanings for the word Wiktionary:Entries needing topical attention/bot code, but we will also tell you about its etymology, its characteristics and you will know how to say Wiktionary:Entries needing topical attention/bot code in singular and plural. Everything you need to know about the word Wiktionary:Entries needing topical attention/bot code you have here. The definition of the word Wiktionary:Entries needing topical attention/bot code will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofWiktionary:Entries needing topical attention/bot code, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

Copyright (c) 2009 Betacommand.

Modified.

Copyright (c) 2009 NicDumZ.

Modified.

Copyright (c) 2014 msh210.

The copyright holders have licensed the code under the following license:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import re
import sys
import catlib
import pagegenerators
import wikipedia
site = wikipedia.getSite()

def main():
  flib = 0
  msg = u'{{shortcut|WT:TA}}\n'
  msg += u'Sometimes ] list of'
  msg += u'\n],'
  msg += u'\nlast updated ~~~~~.'
  msg += u'\n\nTo add an entry to this list, add the code'
  msg += u'\n<code>topic=\'\'\'\'</code> parameter to any of these templates:'
  msg += u'\n{{temp|attention}}, {{temp|look}}, {{temp|question}}, {{temp|rfc}}, {{temp|rfc-sense}},'
  msg += u'\n{{temp|rfv}}, {{temp|rfv-sense}}, {{temp|rfphoto}}, {{temp|rfdrawing}}, {{temp|rfdef}},'
  msg += u'\n{{temp|rfd-redundant}}, {{temp|rfex}}, {{temp|rfquote-sense}}, {{temp|rfexp}},'
  msg += u'\n{{temp|rfd}}, {{temp|rft}}, {{temp|rfr}}, {{temp|tearoom}}.'
  msg += u']\n\n{|class=\'wikitable sortable\'\n'
  msg += u'!page!!topic!!language code'
  cat = catlib.Category(site,'Category:Entries needing topical attention')
  gen = pagegenerators.CategorizedPageGenerator(cat)
  reTemplate = re.compile('\{\{((rf|question|tearoom|look)*?lang=(?P<langcode>*?)\|*?topic=(?P<topic>.*?)|(rf|question|tearoom|look)*?topic=(?P<topic4>.*?)(\|*?lang=(?P<langcode2>.*?))?|attention\|(?P<langcode3>*?)\|.*?topic=(?P<topic2>.*?)|attention\|topic=(?P<topic3>*?)\|(?P<langcode4>*?))', re.I)
  for page in pagegenerators.PreloadingGenerator(gen):
    try:
      text = page.get()
      for match in reTemplate.finditer(text):
        if match.group('topic'):
            topic = match.group('topic')
        elif match.group('topic2'):
            topic = match.group('topic2')
        elif match.group('topic3'):
            topic = match.group('topic3')
        elif match.group('topic4'):
            topic = match.group('topic4')
        else:
            topic = ' '
        if match.group('langcode'):
            langcode = match.group('langcode')
        elif match.group('langcode2'):
            langcode = match.group('langcode2')
        elif match.group('langcode3'):
            langcode = match.group('langcode3')
        elif match.group('langcode4'):
            langcode = match.group('langcode4')
        else:
            langcode = ''
        msg += u'\n|-\n|]||'+topic+'||'+langcode
        flib += 1
    except:
      pass
  logpage = wikipedia.Page(site,'Wiktionary:Entries needing topical attention')
  msg += u'\n|}'
  try:
    oldtext = logpage.get()
  except:
    oldtext = u''
  logpage.put(msg,comment='Update, '+str(flib)+' lines (bot)')
if __name__ == "__main__":
  try:
    main()
  finally:
    wikipedia.stopme()
#
  1. Many thanks to Betacommand and NicDumZ.