https://bugzilla.wikimedia.org/show_bug.cgi?id=66312
Bug ID: 66312 Summary: Update imageuncat.py to focus on templates Product: Pywikibot Version: core (2.0) Hardware: All URL: https://git.wikimedia.org/blob/pywikibot%2Fcore/HEAD/s cripts%2Fimageuncat.py OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: maarten@mdammers.nl Web browser: --- Mobile Platform: ---
imageuncat.py was written in the time we didn't have proper access to the list of categories using the api. So we had to parse the page text for categories, but that didn't catch categories added by template. So it contains quite a bit of trickery to work around this problem.
Now we do have proper api access a proper implementation becomes possible: * Loop over templates to see if doesn't contain a template to skip (like nominated for deletion). This should include template redirects * Loop over the categories. * Check for each category if it's hidden * If you find a category that is not hidden, break * If you finish without finding a category that's not hidden -> tag it
It's should be written with a Class (instead of the different functions we have right now).
We probably want to add a bit of caching of the categories at https://commons.wikimedia.org/wiki/Special:MostLinkedCategories so we don't have to look these up a gazillion times.