User:SOTO/bot tricks: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
no edit summary
No edit summary
Tag: sourceedit
No edit summary
Tag: sourceedit
Line 1: Line 1:
= Categories =
= Categories =
== Adding a category to the bottom of a page ==
=== Adding a category to the bottom of a page ===
=== Step 1 ===
==== Step 1 ====
<pre style="background:black;color:white">python add_text.py -cat:"category" -text:"[[Category:New category]]" -pt:1 -except:"New category"</pre>
<pre style="background:black;color:white">
=== Step 2 ===
python add_text.py -cat:"category" -text:"[[Category:New category]]" -pt:1 -except:"New category"
<pre style="background:black;color:white">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</pre>
</pre>
==== Step 2 ====
<pre style="background:black;color:white">
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
</pre>


== Adding FTRW category only if contains {{tl|wikipediainfo}} ==
 
<pre style="background:black;color:white">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</pre>
=== Adding FTRW category only if contains {{tl|wikipediainfo}} ===
<pre style="background:black;color:white">
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
</pre>
 
 
= General =
=== Piped italics ===
<pre style="background:black;color:white">
python replace.py -regex "\[\[(.*?) \((.*?)\)\|''\1''\]\]" "''[[\1 (\2)|\1]]''" -summary:"Cosmetic changes" -pt:1 -start:!
</pre>




= Videos =
= Videos =
== Good vids ==
=== Good vids ===
=== Step 1: DPL search ===
==== Step 1: DPL search ====
<pre>{{#dpl:
<pre>{{#dpl:
|category=Videos
|category=Videos
|modifiedby=SOTO
|modifiedby=SOTO
}}</pre>
}}</pre>
=== Step 2 ===
==== Step 2 ====
Find-and-replace list into a usable format.
Find-and-replace list into a usable format.
<pre style="background:black;color:white">python replace.py "[[Category:Videos]]" "{{good video}}" -pt:1 -page:"File:Video name 1" -page:"File:Video name 2"</pre>
<pre style="background:black;color:white">python replace.py "[[Category:Videos]]" "{{good video}}" -pt:1 -page:"File:Video name 1" -page:"File:Video name 2"</pre>
You may have to handle videos with double quotation marks in their titles, manually.
You may have to handle videos with double quotation marks in their titles, manually.
[[Category:User SOTO]]
[[Category:User SOTO]]
Cookies help us deliver our services. By using our services, you agree to our use of cookies.