Bythmusters
Joined 18 November 2025
Bythmusters (talk | contribs) finishing link dump from bookmarks |
Bythmusters (talk | contribs) Documented methodology to find pages without templates |
||
| Line 33: | Line 33: | ||
Search queries are a good way to find articles that have starter text: [https://consumerrights.wiki/index.php?search=%5BIncident%5D&title=Special%3ASearch&wprov=acrw1_-1 <nowiki>Pages containing [Incident]</nowiki>] | Search queries are a good way to find articles that have starter text: [https://consumerrights.wiki/index.php?search=%5BIncident%5D&title=Special%3ASearch&wprov=acrw1_-1 <nowiki>Pages containing [Incident]</nowiki>] | ||
Also template search, pages with: [https://consumerrights.wiki/index.php?title=Special:WhatLinksHere/Template:InfoboxCompany&limit=500 InfoboxCompany] [https://consumerrights.wiki/w/Special:WhatLinksHere?target=Template%3AInfoboxProductLine&namespace=&limit=50 InfoboxProductLine] | Also template search, pages with: [https://consumerrights.wiki/index.php?title=Special:WhatLinksHere/Template:InfoboxCompany&limit=500 InfoboxCompany] [https://consumerrights.wiki/w/Special:WhatLinksHere?target=Template%3AInfoboxProductLine&namespace=&limit=50 InfoboxProductLine] (mostly gone) | ||
Scroll through every page at once by namespace: [[Special:AllPages]] | Scroll through every page at once by namespace: [[Special:AllPages]] | ||
{| class="wikitable" | {| class="wikitable" | ||
|} | |} | ||
== Finding articles without certain templates == | |||
As of 1/31/26, I am trying to find articles which are missing any of the four [[Help:Templates#Cargo|cargo templates]]. I have manually scraped the list of pages with certain templates copying lists from[[Special:WhatLinksHere]] and all pages in the main namespace (excluding redirects) from [[Special:AllPages]] into text documents. Using these lists, you can run a basic Python script and count how many lists each page is present in. Any page found in only 1 list must have no cargo templates, any page found in 2 lists has one cargo template, any pages with 3-5 lists has several cargo templates. | |||
I am not an advanced programmer but here is my script: | |||
<code># these files all generated 1/30/26 21 UTC | |||
# generate list of filepaths to be read | |||
filenames = ["allpages.txt", "company.txt", "incident.txt", "productline.txt", "product.txt"] | |||
pathprefix = "[your-path-here]" | |||
filepaths = [] | |||
for x in filenames: | |||
filepaths.append(pathprefix + x) | |||
# print(filepaths) | |||
# read files line-by-line, sanitize lines, and count in dictionary | |||
match = " (transclusion) (← links | edit)" | |||
table = {} # String to Int: line, count | |||
for x in filepaths: | |||
with open(x, "r") as file: # auto closes file | |||
content = file.read() | |||
lines = content.split('\n') | |||
for line in lines: | |||
line = line.replace(match, "") | |||
# print(line) | |||
if line in table: | |||
table[line] += 1 | |||
else: | |||
table[line] = 1 | |||
# print(table) | |||
# read unsorted dict and sort into new dict with count as key | |||
sortedtable = {} # Int to List[String]: count, lines | |||
for pair in table.items(): | |||
line = pair[0] | |||
count = pair[1] | |||
if count in sortedtable: | |||
sortedtable[count].append(line) | |||
else: | |||
sortedtable[count] = [line] | |||
print("#####Only in AllPages#####") | |||
for x in sortedtable[1]: | |||
print(x)</code> | |||
Then a list can be displayed or saved with Bash: <code>python3 table.py | less</code> | |||