ویکی‌پدیا:درخواست‌های ربات/تصویر همسنگ: تفاوت میان نسخه‌ها

محتوای حذف‌شده محتوای افزوده‌شده
Reza1615 (بحث | مشارکت‌ها)
Reza1615 (بحث | مشارکت‌ها)
←‏کد: رفع مشکلات تول‌سرور روی ۲۰۰ مقاله تست شد و چند مورد هم کار کرد و مشکلی نبود :)
خط ۸۲:
try:
im = re.search(ur'\|\s*(?:[Ff]ile|[Pp]hoto|[Ii]mage).*?\=\s*([^\|]*?)\s*\|', text_en2)
imagename=im.group(0).split(u'=')[1].replace(u'|',u'').strip()
return imagename
except:
im = re.search(ur'\[\[([Ff]ile|[Ii]mage):.*?\|', text_en2)
imagename=im.group(0).split(u':')[1].replace(u'|',u'').strip()
return imagename
def BotRun(page,text_fa,text_en):
try:
pagename=str(page).replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
except:
pagename=unicode(str(page),'UTF-8').replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
page=wikipedia.Page(faSite,pagename)
#--------------------------------------------------------------action that you want to do on pages-----------------
سطر ۱۰۹ ⟵ ۱۱۲:
else:
imageparameter=imfa.group(0).split(u'=')[0]
text_fa=text_fa.replace(imageparameter+u'=',imageparameter+u'='+imagename,1)
wikipedia.output( u"--image added to infobox!--" )
return text_fa
سطر ۱۲۹ ⟵ ۱۳۲:
for inter in interwiki:
inters=str(inter)
if inters.find(secondwiki+u':')!=-1:
enSite = wikipedia.getSite(secondwiki)
page=wikipedia.Page(enSite,inter.title())
سطر ۱۵۱ ⟵ ۱۵۴:
def run(generator):
for pages in generator:
try:
pagename=unicode(str(pages),'UTF-8').replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
except:
pagename=str(pages).replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
if pagename.find(u':')!=-1:
continue
pagefa=wikipedia.Page(faSite,pagename)
try:
if not pagefa.canBeEdited():
wikipedia.output( u'Skipping locked page %s' % pagefa.title() )
continue
سطر ۱۷۸ ⟵ ۱۸۴:
continue
text_en=enpageget(interwikis)
try:
test=text_en.replace(u'\n',u'')
except:
wikipedia.output( u'---------------------------')
wikipedia.output( pagename)
wikipedia.output( u"dosen't have english page!")
continue
if text_en==u' ' or text_en==u'':
wikipedia.output( u'---------------------------')
سطر ۱۹۳ ⟵ ۲۰۶:
def savepart( page,new_text):
pagename=str(page).replace(u'Fa:',u'').replace(u'fa:',u'').replace(u'[[',u'').replace(u']]',u'').strip()
page=wikipedia.Page(faSite,pagename)
try: