Wikipedia:Bots/Requests for approval/UrbanBot


 * The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at Bots/Noticeboard. The result of the discussion was

UrbanBot
Operator:

Time filed: 19:54, Thursday, June 29, 2023 (UTC)

Automatic, Supervised, or Manual: supervised

Programming language(s): Python (Pywikibot)

Source code available: Main UrbanBot code repository Source code for task

Function overview: Bot will scan through draft articles looking for headings that duplicate the page title

Links to relevant discussions (where appropriate): User:Urban_Versis_32/Hot_Tips (Permalinks to drafts with duplicate headers)

Edit period(s): Whenever the program is run

Estimated number of pages affected: Unknown, but any article in the draft namespace with a duplicate header including AfC submissions

Exclusion compliant (Yes/No): Yes

Already has a bot flag (Yes/No): No

Function details: In many drafts and AfC submissions, the articles will have duplicate headers, which means the article creator added a header with the same text as the article header preceding the opening paragraph. UrbanBot's purpose is to remove this header with the following steps (bot operator is me):


 * 1. Bot operator runs program. Bot asks user for a category name (Usually the category will be something like Category:AfC pending submissions by age/0 days ago).
 * 2. Bot loops through each page in the category and performs the following actions:
 * 2a. Bot checks if page is excluded from bot edits (Exclusion compliance). If not, the bot continues to the next step.
 * 2b. Bot checks each line to see if it contains a duplicate header. If it doesn't, the bot will add it to a variable containing every line that does not contain a duplicate header. If it does, the bot will set the "duplicate_header_detected" variable to True.
 * 2c. If "duplicate_header_detected" is set to true (one or more duplicate headers were detected), Bot will remove all text from the page, then re-add all text in the variable containing lines without a duplicate header. Bot will save the page.

Discussion
I'm not sure if this is worth it. It is common for drafts to contain a lot of junk markup. Identifying one such piece of markup and removing it while doing nothing about the others (which still need to be handled by a human) is like applying lipstick on a pig. – SD0001  (talk) 06:36, 30 June 2023 (UTC)
 * I thought something similar when I first saw this task; while this is not "cosmetic" in the COSMETICBOT sense, it is cosmetic in the fact that it does not affect the review (or the page as a whole) and will likely be cleaned up either shortly before or shortly after a review. I know whenever I see one of these in the wild I will fix it, even if I'm doing nothing more than looking at someone's draft when they ask for help. Primefac (talk) 06:51, 6 July 2023 (UTC)
 * You make a good point, maybe I could add other things to the bot to possibly detect and fix more commonly seen errors in AfC submissions? Urban Versis 32KB ⚡ (talk / contribs) 01:17, 9 July 2023 (UTC)
 * per the above issues. This is one of a number of minor/trivial issues that does not need a bot to fix. Primefac (talk) 12:40, 18 July 2023 (UTC)
 * The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at Bots/Noticeboard.