User:SOTO/API: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(Small fixes (forgot about the </pre> at the end))
Tag: 2017 source edit
No edit summary
Tag: 2017 source edit
Line 8: Line 8:
#: <pre style="background:black!important;color:white">python pwb.py replace -regex "\]\] \[\[" "|" "\* Start \[\[([^\[]*?)\]\] End\n" "* Start (\1) End\n" -page:"User:SOTO/test" -pt:2 -summary:"Generating pipe switch complex"</pre>
#: <pre style="background:black!important;color:white">python pwb.py replace -regex "\]\] \[\[" "|" "\* Start \[\[([^\[]*?)\]\] End\n" "* Start (\1) End\n" -page:"User:SOTO/test" -pt:2 -summary:"Generating pipe switch complex"</pre>
# Finally, input this variable into a link like this: https://tardis.fandom.com/api.php?action=query&prop=revisions&titles=Police_box|Kronkburger|Quantum_physics&rvslots=*&rvprop=content&formatversion=2
# Finally, input this variable into a link like this: https://tardis.fandom.com/api.php?action=query&prop=revisions&titles=Police_box|Kronkburger|Quantum_physics&rvslots=*&rvprop=content&formatversion=2
#: <pre style="background:black!important;color:white">python pwb.py replace -regex "\* Start \(([^\[]*?)\) End\n" "* https://tardis.fandom.com/api.php?action=query&prop=revisions&titles=\1&rvslots=*&rvprop=content&formatversion=2\n" -pt:2 -summary:"Generating API link"</pre>
#: <pre style="background:black!important;color:white">python pwb.py replace -regex "\* Start \(([^\[]*?)\) End\n" "* https://tardis.fandom.com/api.php?action=query&prop=revisions&titles=\1&rvslots=*&rvprop=content&formatversion=2\n" -page:"User:SOTO/test" -pt:2 -summary:"Generating API link"</pre>


[[Category:User SOTO]]
[[Category:User SOTO]]

Revision as of 04:34, 24 May 2022

Generate API content

  1. Generate a list of pages, in our case Tonys (Tonies?): https://tardis.fandom.com/api.php?action=query&list=prefixsearch&psnamespace=0&pssearch=Tony&pslimit=50
  2. Place results in pre tags.
  3. Run the following:
    python pwb.py replace -regex "\<pre\>\n([\s\S]*?)(.)title\2: \2(.*?)\2\,\n" "* Start [[\3]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])([\s\S]*?)(.)title\3: \3(.*?)\3\,\n" "* Start \1 [[\4]] " "\* Start (\[\[.*\]\])[^\[]*?[^\[]*?pageid[^\[]*?\}[^\[]*?\}[^\[]*?\}\n\</pre\>" "* Start \1 End" -page:"User:SOTO/test" -pt:2 -summary:"Generating link cluster"
    Adjust from 50 times to however many results you're working with.
  4. Once finished, if you'd like to grab page contents, try changing the format like this:
    python pwb.py replace -regex "\]\] \[\[" "|" "\* Start \[\[([^\[]*?)\]\] End\n" "* Start (\1) End\n" -page:"User:SOTO/test" -pt:2 -summary:"Generating pipe switch complex"
  5. Finally, input this variable into a link like this: https://tardis.fandom.com/api.php?action=query&prop=revisions&titles=Police_box%7CKronkburger%7CQuantum_physics&rvslots=*&rvprop=content&formatversion=2
    python pwb.py replace -regex "\* Start \(([^\[]*?)\) End\n" "* https://tardis.fandom.com/api.php?action=query&prop=revisions&titles=\1&rvslots=*&rvprop=content&formatversion=2\n" -page:"User:SOTO/test" -pt:2 -summary:"Generating API link"