Wikipedia:Bots/Requests for approval/JL-Bot
- The following discussion is an archived debate. Please do not modify it. Subsequent comments should be made in a new section. The result of the discussion was Approved.
Operator: JLaTondre
Automatic or Manually Assisted: Automatic (operator initiated & supervised)
Programming Language(s): Perl (uses perlwikipedia)
Function Summary: Replace incorrect external links to Wikipedia & sister sites with internal link syntax
Edit period(s) (e.g. Continuous, daily, one time run): Daily to weekly
Edit rate requested: 10 accesses per minute (built in delay of at least 6 seconds between any read or write)
Already has a bot flag (Y/N): N
Function Details: It will correct links, only within articles & templates, to Wikipedia & sister sites that are incorrectly formatted using the external link syntax. It uses Special:Linksearch to determine pages to process, but each run is limited to links starting with a random character (ex. en.wikipedia.org/wiki/A) to keep the number of pages being processed to a reasonable number. It is conservative in the patterns that it matches.
The following replacements are made:
- [link:target name] → [[target|name]]
- target[link:target] → [[target]]
- [[target]][link:target] → [[target]]
- [[target|name]][link:target] → [[target|name]]
- <a href="link:target">name</a> → [[target|name]]
where link: is of the form:
- http://\w+.wikipedia.org/wiki/
- http://\w+.wikipedia.org/w/index.php?title=
- http://\w+.wikibooks.org/wiki/
- http://\w+.wikinews.org/wiki/
- http://\w+.wikisource.org/wiki/
- http://\w+.wiktionary.org/wiki/
- http://commons.wikimedia.org/wiki/
- http://meta.wikimedia.org/wiki/
- http://www.mediawiki.org/
The replacement target is properly prefixed if it is a Category:, Image:, or interwiki link.
It also fixes minor formatting errors with internal links, but only if an external to internal link fix has been made.
Discussion
edit- Looks pretty good. My bot does something similar to this I believe. Does the bot change external links to interwiki links, does it correct interwiki links, or both? ~ Wikihermit 03:32, 3 July 2007 (UTC)[reply]
- It changes external links to interwiki links. The original purpose was to deal with "external" links to enwikipedia itself, but handling interwiki links was similar enough that I added it in. As far as correcting interwiki links, it doesn't validate that interwiki links lead to the correct page. It will do some minor clean-up such as remove excess spaces and decode URL-encoded characters. -- JLaTondre 11:23, 3 July 2007 (UTC)[reply]
- How will this handle oldids and other cases where there is a query string? Matt/TheFearow (Talk) (Contribs) (Bot) 12:02, 3 July 2007 (UTC)[reply]
- It ignores them (with one exception). It looks for (using examples)
http://en.wikipedia.org/wiki/Page_name and
http://en.wikipedia.org/w/index.php?title=Page_name
patterns only. The exception is http://en.wikipedia.org/wiki/Special:Search/Page_name. It will also convert that as I cannot see a reason why, in article space, there should be a link to a search instead of linking to the actual page. -- JLaTondre 12:40, 3 July 2007 (UTC)[reply]
- It ignores them (with one exception). It looks for (using examples)
- How will this handle oldids and other cases where there is a query string? Matt/TheFearow (Talk) (Contribs) (Bot) 12:02, 3 July 2007 (UTC)[reply]
- It changes external links to interwiki links. The original purpose was to deal with "external" links to enwikipedia itself, but handling interwiki links was similar enough that I added it in. As far as correcting interwiki links, it doesn't validate that interwiki links lead to the correct page. It will do some minor clean-up such as remove excess spaces and decode URL-encoded characters. -- JLaTondre 11:23, 3 July 2007 (UTC)[reply]
Approved for trial. Please provide a link to the relevant contributions and/or diffs when the trial is complete. 50 edits. --ST47Talk 12:53, 6 July 2007 (UTC)[reply]
- 45 edits made. I had two issues at the start that I resolved. I forgot to specify an edit summary on my first edit. I also had two UTF-8 problems (edits 5-6) that I had to revert. Updating to the latest perlwikipedia resolved those & when re-ran (edits 10 & 12), everything was fine. -- JLaTondre 21:33, 6 July 2007 (UTC)[reply]
\n:Great, Approved! ----ST47Talk 13:36, 8 July 2007 (UTC)[reply]
- Approved. --ST47Talk 13:36, 8 July 2007 (UTC)[reply]
- The above discussion is preserved as an archive of the debate. Please do not modify it. Subsequent comments should be made in a new section.