User:SOTO/API

From Tardis Wiki, the free Doctor Who reference

Generate API content[[edit] | [edit source]]

  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 "\]\] \[\[" "}}|{{subst:PAGENAMEE:" "\* Start \[\[([^\[]*?)\]\] End\n" "* Start ({{subst:PAGENAMEE:\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"