Пример #1
0
 def save(self):
     """Save text to template"""
     site = wikipedia.getSite()
     httphelp.save(site, text = self._wikitext(),
         pagename = u"Шаблон:Случайные статьи с КУЛ",\
         comment  = u"Обновление шаблона", \
         minoredit = True, botflag = True, dry = False)
Пример #2
0
                d[u"Площадь водосбора"][1] = "Н/Д"
            r += [d]    
        except OSMAPI.OSMAPIException:
            pass
    # filter same OSM id. refactor this!
    r2 = []
    for dd in r: #NumberOfSame(glist, OSMid):
        #if NumberOfSame(r, dd["place_id"]) == 1:
        #    print ">%s, %s, %s<"%(dd, dd[u"state"], dd["place_id"])
        r2 += [dd]
        #else:
        #    logging.info(u"Дубль %s", dd)
    return r2

    
if __name__ == "__main__":
    site = wikipedia.getSite()
    a = 0
    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
    #gvrlist = gvr.GVRList(bo="1", rb="67", hep="591",subb="86", wot="11")
    ll = LakesList()
    for l in ll:
        print ">%s, %s, %s<"%(l, l[u"state"], l["place_id"])
        if l[u"state"].find(u"Карел") > 0:
            a += 1
            logging.info(u"[%s] Название %s, Регион %s OSM %s GVR %s", a, l[u"Название"], l["state"], l["place_id"], l[u"Код водного объекта"])
            httphelp.save(site, text=(Template%l), \
                 pagename=l[u"Название"], \
                 filename=u"/home/drakosh/озера/%s.txt"%l[u"Название"],\
                 dry=True, comment="Заливка озер")
Пример #3
0
            if m != None:
                self.littleedits = m.group(1).encode("utf-8")
        
    def __repr__(self):
        return u"|%s||%s||%s||%s||%s||%s||%s||%s||%s||%s" % (0, 0, 0, 0, self.articles, self.pages, self.redir, self.editors, self.edits, self.littleedits)
        #return self.lang + self.localname

if __name__ == "__main__": 
    site = wikipedia.getSite('incubator', 'incubator')
    text = u"""== Разделы Википедии в инкубаторе ==
{| border="1" cellpadding="2" cellspacing="0" style="background: #ffffff; border: 1px solid #777777; border-collapse: collapse; white-space: nowrap; text-align: right" class="sortable plainlinksneverexpand"
! style="background:#dde2e2; text-align: center" |{{comment|№|Порядковый номер раздела (по количеству статей)}}
! style="background:#dde2e0; text-align: center" |Код
! style="background:#dde2e2; text-align: center" |Язык
! style="background:#dde2e2; text-align: center" |Самоназвание
! style="background:#dde2e2; text-align: center" |Статей
! style="background:#dde2e2; text-align: center" |{{comment|Стр.|Число страниц}}
! style="background:#dde2e2; text-align: center" |{{comment|Редир.|Число перенаправлений}}
! style="background:#dde2e2; text-align: center" |{{comment|Участн.|Число участников}}
! style="background:#dde2e2; text-align: center" |{{comment|Правок|Число правок, в том числе малых}}
! style="background:#dde2e2; text-align: center" |{{comment|Малых|Число малых правок}}\r\n""".encode("utf-8")
    for c in catlib.Category(site, u"Category:Incubator:All_test_wikis").subcategories():
        try:
            i = WikiInfo(c)
            text += (u"|-\r\n%s\r\n" % i).encode("utf-8")
        except IncubatorException:
            pass
    text += u"|}".encode("utf-8")
    print text
    save(wikipedia.getSite(), text=text, pagename=u"Википедия:Список Википедий в инкубаторе/Тест", comment=u"Список Википедий в инкубаторе")