Skip to content

Instantly share code, notes, and snippets.

@JadeMaveric
Created January 25, 2016 13:05
Show Gist options
  • Save JadeMaveric/bed36ef2986431a44bb6 to your computer and use it in GitHub Desktop.
Save JadeMaveric/bed36ef2986431a44bb6 to your computer and use it in GitHub Desktop.
WikiTemplate Transclusion Count
import requests
templates = ["abbreviations",
"advert",
"all plot",
"audio requested",
"autobiography",
"bad summary",
"biblio",
"BLP IMDb refimprove",
"BLP primary sources",
"BLP self-published",
"BLP sources",
"BLP unsourced",
"buzzwords",
"category unsourced",
"check category",
"cherry picked",
"CIA",
"citation broken",
"citation style",
"cite check",
"cleanup",
"cleanup AfD",
"cleanup Congress Bio",
"cleanup red links",
"cleanup-bare URLs",
"cleanup-biography",
"cleanup-book",
"cleanup-film",
"cleanup-gallery",
"cleanup-HTML",
"cleanup-images",
"cleanup-infobox",
"cleanup-lang",
"cleanup-list",
"cleanup-list",
"cleanup-remainder",
"cleanup-reorganize",
"cleanup-rewrite",
"cleanup-school",
"cleanup-tense",
"cleanup-university",
"close paraphrasing",
"coat rack",
"COI",
"condense",
"confusing",
"context",
"contradict",
"contradict-other",
"contradict-other-multiple",
"copy edit",
"copypaste",
"create-list",
"criticism section",
"crystal",
"db-spam",
"dead end",
"debate",
"disambiguation cleanup",
"disputed",
"disputed-category",
"disputed-list",
"duplicated citations",
"duplicates",
"editorial",
"essay-like",
"example farm",
"expert-subject",
"external links",
"famous",
"famous players",
"fiction",
"fiction trivia",
"film IMDb refimprove",
"find sources",
"find sources 3",
"format footnotes",
"formula missing descriptions",
"further reading cleanup",
"game guide",
"game trivia",
"generalize",
"geographical imabalance",
"globalize",
"howto",
"ibid",
"improve categories",
"in popular culture",
"in-universe",
"inadequate lead",
"inappropriate person",
"incoming links",
"incomprehensible",
"infobox requested",
"Lacking ISBN",
"lacking overview",
"lead missing",
"lead rewrite",
"lead too long",
"lead too short",
"like resume",
"list to table",
"local",
"manual",
"medref",
"metricate",
"misleading",
"missing information",
"more footnotes",
"More plot",
"more-specific-links",
"MOS",
"MOSLOW",
"multiple issues",
"multiple issues|section=yes",
"new infobox",
"news release",
"no footnotes",
"No plot",
"non-free",
"notability",
"obituary",
"off-topic",
"one source",
"original research",
"orphan",
"over-quotation",
"overcoloured",
"overlinked",
"overly detailed",
"page numbers improve",
"page numbers needed",
"partisan",
"peacock",
"plot",
"POV",
"POV-check",
"POV-lead",
"POV-title",
"primary sources",
"pro and con list",
"prose",
"recategorize",
"recentism",
"refimprove",
"refimprove science",
"religious text primary",
"repetition",
"Requires attention",
"research paper",
"review",
"schedule",
"search",
"sections",
"self-published",
"single infobox request",
"spacing",
"specific",
"speculation",
"story",
"technical",
"third-party",
"time-context",
"time-context",
"tone",
"too many photos",
"too many see alsos",
"travel guide",
"trivia",
"trivia",
"unbalanced",
"uncategorize",
"uncategorized",
"uncategorized stub",
"unclear date",
"underlinked",
"undue",
"unfocused",
"unreferenced",
"unreliable sources",
"update",
"update|inaccurate=y",
"USRD-wrongdir",
"verbosity",
"verify spelling",
"very long",
"weasel"
]
output = open('output.txt', 'w')
for template in templates:
data = {'name': template, 'namespace': 10, 'lang': 'en'}
url = 'https://tools.wmflabs.org/templatecount/index.php'
site = requests.get(url, data)
text = site.text
start = text.find('transclusion(s)') - 10;
start = text.find('<p>', start-10)
start += 3
end = text.find(' ', start)
num = text[start:end]
print(template,num, sep='\t')
output.write(num + "\n")
output.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment