User:SOTO/bot tricks: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
No edit summary
Tag: sourceedit
Tag: sourceedit
Line 20: Line 20:
=== Piped italics ===
=== Piped italics ===
<pre style="background:black;color:white">
<pre style="background:black;color:white">
python replace.py -regex "\[\[(.*?) \((.*?)\)\|''\1''\]\]" "''[[\1 (\2)|\1]]''" -summary:"Cosmetic changes" -pt:1 -start:!
python replace.py -regex "\[\[(.*?) \((.*?)\)\|''\1''\]\]" "''[[\1 (\2)|\1]]''"  "\[\[(.*?)\|''\1''\]\]" "''[[\1]]''" -summary:"Cosmetic changes" -pt:1 -start:!
</pre>
</pre>


= Videos =
= Videos =

Revision as of 20:03, 6 June 2017

Categories

Adding a category to the bottom of a page

Step 1

python add_text.py -cat:"category" -text:"[[Category:New category]]" -pt:1 -except:"New category"

Step 2

python replace.py -cat:"New category" -regex "\[\[Category:(New category)\]\]\r\n([\s\S]*)\r\n\[\[Category:(.*?)\]\]" "\2\n[[Category:\3]]\n[[Category:\1]]" -pt:1


Adding FTRW category only if contains {{wikipediainfo}}

python replace.py -catr:"Example" -regex "\{\{[Ww]ikipediainfo([\s\S]*)\[\[Category:(.*?)\]\]" "{{wikipediainfo\1[[Category:\2]]\n[[Category:Example from the real world]]" -excepttext:"Example from the real world" -pt:1


General

Piped italics

python replace.py -regex "\[\[(.*?) \((.*?)\)\|''\1''\]\]" "''[[\1 (\2)|\1]]''"  "\[\[(.*?)\|''\1''\]\]" "''[[\1]]''" -summary:"Cosmetic changes" -pt:1 -start:!

Videos

Good vids

Step 1: DPL search

{{#dpl:
|category=Videos
|modifiedby=SOTO
}}

Step 2

Find-and-replace list into a usable format.

python replace.py "[[Category:Videos]]" "{{good video}}" -pt:1 -page:"File:Video name 1" -page:"File:Video name 2"

You may have to handle videos with double quotation marks in their titles, manually.