User:SOTO/API

From Tardis Wiki, the free Doctor Who reference
< User:SOTO
Revision as of 04:26, 24 May 2022 by SOTO (talk | contribs)

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[^\[]*?\}[^\[]*?\}[^\[]*?\}" "* 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" -pt:2 -summary:"Generating API link"