231 bytes adicionados ,  22h53min de 23 de novembro de 2019
(migração para pywikibot-core)
<source lang="python">
#!/usr/bin/env python
import query
from pywikibot import config
from scripts import interwiki
site = None
reparsedtext = re.compile(r'(.*)<div class="mw-parser-output"><p>(.*?)</p>', re.DOTALL)
ignoreLangs = ['ine', 'ine-pro']
'prop' : 'text',
datas = querypywikibot.GetDatadata.api.Request(paramssite, siteparameters=params).submit()
data = datas['parse']['text'].values()[0'*']
mo = reparsedtext.match(data)
(langcode, transl))
return True # meaning there is a page there now
if not pageinterwiki.isEmptypage_empty_check(page):
pywikibot.output(u"Page '%s' already has contents. Skipping" % transl)
return True # meaning there is a page there now
page.put(text, commentsummary = u"Criada automaticamente a partir das traduções em [[%s]]" % title, minorEditminor = False)
except pywikibot.PageNotSaved:
print pywikibot.output("Failed to save page")
return False
except socket.timeout:
print pywikibot.output("Socket timeout, maybe not saving page")
return False
except socket.error:
print pywikibot.output("Socket error, maybe not saving page")
return False
newCat = pywikibot.Page(site, u"Categoria:!Entrada criada por robô (%s)" % langcat)
if not newCat.exists() or (not newCat.isRedirectPage() and newCatinterwiki.isEmptypage_empty_check(newCat)):
# Create the auto pages category for this language
pywikibot.output(u"Creating auto page category for language '%s'" % langcode)
for arg in sys.argv[1:]:
if arg.startswith('-'):
print pywikibot.output('Arguments not supported yet')
else: pageToProcess = unicode(arg, .encode('latin1utf8').decode(sys.stdout.encoding)
# make sure we are logged in
site = pywikibot.getSiteSite()
config.put_throttle = 1
if (pageToProcess == None):
entry = list(site.randompagerandompages(1))[0]
pageToProcess = entry.title()
33 202