Utente:BimBot/Scripts: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
vocicorrelate.py: nuova sezione
PAWBot (discussione | contributi)
m Fix, replaced: <source → <syntaxhighlight (17), </source → </syntaxhighlight (17)
 
(3 versioni intermedie di 2 utenti non mostrate)
Riga 2:
Copiate gente, copiate! (<small>Che poi va a fuoco il computer...</small>) :-D
 
== <ttkbd>redirectlinks.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 71:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>lonelypages.py</ttkbd> ==
Prende le pagine da [[Speciale:Lonelypages]], verifica che siano veramente orfane e inserisce l'avviso in quelle che non lo hanno già.
Script spostato [http://www.botwiki.sno.cc/wiki/Python:Lonelypages.py qui].
 
== <ttkbd>proxyaperti.py</ttkbd> ==
Questo script fa semplicemente un edit in una pagina.
In verità serve per scovare i proxy aperti, agendo da sloggati.
Riga 83:
Utilizzabile solo da personale addestrato ;-)
 
<sourcesyntaxhighlight lang="python">
#! -*- coding: utf-8 -*-
 
Riga 98:
pagina.put(newtxt)
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>lavorosporco.py</ttkbd> ==
Questo script serve per aggiornare le [[Progetto:Coordinamento/Statistiche manutenzioni|statistiche del lavoro sporco]].
 
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 159:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>statistichemanutenzioni.py</ttkbd> ==
Questo script serve per aggiornare le statistiche manutenzioni dei progetti tematici. Andrebbe generalizzato ed unito con lavorosporco.py.
 
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 208:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>frazioni.py</ttkbd> ==
Questo script serve per aggiungere <ttkbd><nowiki>{{Tmp|Frazione}}</nowiki></ttkbd> a tutte le frazioni che non contengono il template {{Tl|Frazione}}.
 
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 248:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>monitoraggioimmagini.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- utf-8 -*-
Riga 289:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>aggiornaCitazioniPP.py</ttkbd> ==
Script usato per aggiornare le citazioni del giorno sulla pagina principale.
 
<sourcesyntaxhighlight lang="python">
#!/usr/bin/python
# -*- coding: utf-8 -*-
Riga 349:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>numero_voci_vetrina.py</ttkbd> ==
Aggiorna il template contenente il numero di voci in vetrina.
 
<sourcesyntaxhighlight lang="python">
# -*- coding: utf8 -*-
import wikipedia, catlib
Riga 390:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>codici_autori_fantascienza.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 437:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>articoli_defaultsort.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 506:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>newsPedia.py</ttkbd> ==
Prende le ultime notizie da 'news e le sbatte su 'pedia.
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 582:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>copyviolInversi.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 666:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>importa_asteroidi.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
# -*- coding: utf-8 -*-
import wikipedia, re, sys, codecs
Riga 731:
 
#K07B19V 15.7 0.15 K06CV 19.17898 347.71274 101.16774 10.08579 0.0550460 0.19108058 2.9853254 E2007-B48 13 1 16 days 0.37 MPC 0000 2007 BV19 20070124
</syntaxhighlight>
</source>
 
=== <ttkbd>modello_asteroide.txt</ttkbd> ===
<pre>
{{S|asteroidi}}
Riga 758:
</pre>
 
== <ttkbd>discussioneanonimi3.py</ttkbd> ==
 
<sourcesyntaxhighlight lang="python">
# -*- coding: utf-8 -*-
import wikipedia, re, commands
Riga 799:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <ttkbd>prefissiTelefonici.py</ttkbd> ==
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Riga 890:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source>
 
== <code>vocicorrelate.py</code> ==
 
<sourcesyntaxhighlight lang="python">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Lo script rimuove i piped links e i corsivi dai link nelle "Voci correlate".
# Si lancia con gli argomenti supportati da pagegenerators.py
#
# Esempi:
# $ python vocicorrelate.py -catr:Informatica
# $ python vocicorrelate.py -start:!
#
# Autore: Pietrodn
 
import wikipedia, pagegenerators, re
 
Line 912 ⟶ 922:
if not gen:
return
for p in gen:
try:
Line 970 ⟶ 981:
finally:
wikipedia.stopme()
</syntaxhighlight>
</source
 
== Eliminazione parametro "Stato" dal [[Template:Edificio religioso]] ==
 
Codice da inserire in <kbd>user-fixes.py</kbd>:
 
<syntaxhighlight lang="python">
import re
 
def EdRel(match):
# Le parentesi devono essere bilanciate, e le prime parentesi graffe trovate non devono essere chiuse
aperte = re.findall(ur'\{\{', match.group(1))
chiuse = re.findall(ur'\}\}', match.group(1))
if (len(aperte) == len(chiuse)) and (not re.match("(?s)[^{}]*\}\}.*", match.group(1))):
return ur"{{Edificio religioso" + match.group(1)
else:
return match.group() # Unchanged
fixes['EdificioReligioso'] = {
'regex': True,
'msg': {
'_default':u'Eliminazione parametro obsoleto del [[Template:Edificio religioso]] ([[Wikipedia:Bot/Richieste#Eliminazione_campo_dal_template_.22Edificio_religioso.22|richiesta]])',
},
'replacements': [
(ur"(?s)\{\{\s*[Ee]dificio[ _]religioso(.*?)\|\s*[Ss]tato\s*=\s*([^|\n]*)\n", EdRel),
],
'exceptions': {
'inside-tags': ['comment', 'header', 'pre', 'source', 'ref', 'table', 'hyperlink', 'gallery', 'link', 'interwiki' ],
}
}
</syntaxhighlight>