Help talk:Creating a bot/Archive 1

Latest comment: 6 years ago by Wikidushyant in topic Ceterach
Archive 1

Things to expand/add

We should add more info on:

  • bot speed and timers
  • more specifics on getting the bot approved
  • pages for a bot to be disabled (ie if User:Bot/disableme contains "end" then stop editing)
  • checking for things such as edit conflicts, being blocked, non-existant pages
  • Different modules other than bot frameworks, like http clients, xml parsers, etc...

GeorgeMoney (talk) 03:11, 10 December 2006 (UTC)

The article is still very very new so there is loads of stuff like the above yet to add. i am going to be working to expand the article further today - PocklingtonDan 09:35, 10 December 2006 (UTC)

stuff

I know this idea might be a litte over-the-top and pointless, so feel free to say how stupid doing this would be, etc... but does anyone think we should add syntax highlighting to the example code using http://tools.devshed.com/webmaster-tools/syntax-highlighting/ ? GeorgeMoney (talk) 21:56, 10 December 2006 (UTC)

No, I think that is an excellent idea. I think perhaps we should try and standardise the code at some point in the future so that each code chunk produces exactly the same output, to give a good example of how each language achieves the same output. We don't have to do this right now though, there's other areas that need expanding first. - PocklingtonDan 08:17, 11 December 2006 (UTC)

Requesting the building of a bot

Is it possible for someone to build me a wiki bot? I just need it for editing articles in another wiki. Is that at all possible?--H*bad 07:16, 1 January 2007 (UTC)

See Wikipedia:Bot_requests -- SatyrTN (talk | contribs) 16:02, 31 January 2007 (UTC)

Need some useful content

They weren't kidding with the "needs an overhaul" tag. This article needs some serious work.

To start, the title of the article is "creating a bot". One of the very first things mentioned is that this article is geared towards experienced programmers. However, the majority of the article talks about programming techniques; testing, testing again, development cycles, etc. While there is a place for that, there's way to much of it. On the other hand, there are no examples of code to show what a bot may look like. It describes what an edit token is, but not how to use one, or even how to make the changes (I assume through some form of regular expressions, but its not discussed at all.)

IMHO, without having any experience progamming bots, here's what I would expect this article to look like:

  1. intro... what a bot is, some examples of how to use one
  2. a short discussion on the administrative process required to make a bot. Note that many folks are - probably the majority of folks coming to this page - are not making wikipedia bots, but rather bots for their own wikis.
  3. a programming language-nonspecific discussion of how a bot should look. Use lots of pseudocode here.
  4. some short examples of bots in different languages, with links to existing bots in those languages.
  5. links to useful stuff... development cycle discussions, "intro to programming" links, FAQ link, etc.

That would be what I would expect. I would love to see some of that implemented. At the very least, the pseudocode section is crucial. I hope this is helpful in rewriting this article.

I would love to see this article be useful, but I know nothing about programming bots. However, if I can be helpful in any other ways, please let me know on my talk page. Thanks! -- eykanal talk 14:43, 14 February 2007 (UTC)

ok... nnnow what did you say ???
From what i saw it looks like you have to be a technology expert or have a masters degree from Harvard or be a 3 yrs old!:P to figure out how to make one of these things! --Takaomi I. Shimoi 16:03, 20 March 2007 (UTC)
Hi eykanal. I'm afraid you have been mislead. This is not an ecyclopedic Wikipedia article! This is a Wikipedia internal project page. Your ideas are not bad. You can write an article on the bot creating process under Creating a bot. But not here. This page might be helpful: Bot. There is a great diversity of bots, as is among computer programs in general. There is no typical look of a bot, as far as I know. — Ocolon 16:39, 20 March 2007 (UTC)

Software?

Do you need specal software to make a bot?! please no!--Takaomi I. Shimoi 16:14, 22 March 2007 (UTC)

Nope, no "special" software. Programming languages, interpreters, compilers are free and you can get free development environments too — or use Notepad. — Ocolon 18:08, 22 March 2007 (UTC)

PHP Bot - RfC

I think this is (now) the place to put this, but if not, let me know.

I've put together a PHP bot for WikiProjects. It reviews all articles that are tagged with a project's tag, determines which ones have cleanup tags, and puts them all on a "full list of things to-do". It also pulls a random subset of that list suitable for using in a project's "to-do" list. I created it for WP:LGBT, but I've set it up to be used by other WikiProjects. You can see the current results at User:SatyrBot/Maintenance results full and User:SatyrBot/Maintenance results short. And those results have been copied manually to the LGBT project's page, if you want to see how they'll be used.

What I'm looking for is some input as to how it works and if it needs anything. Right now it has to be manually fired, but I'd like to set a cron job so it will fire weekly for any projects that want it - but I don't want to do that until I've gotten some input.

Thanks in advance, -- SatyrTN (talk | contribs) 16:14, 31 January 2007 (UTC)

Doh! I guess I should mention that, since it's currently manually fired, it's accessible through a web page: [1] That page is password protected, so email me for the login info. -- SatyrTN (talk | contribs) 16:32, 31 January 2007 (UTC)

I'm not sure if I understood you correctly: Do you want to know how cronjobs work and where you can get them? I'm using free cronjobs from cronjob.de. Setting them up is very easy. Your cronjob provider will explain everything. You might need to include ignore_user_abort(TRUE); because the cron job provider might not want to wait until your script finished and set_time_limit(???) to stop your server from aborting it early. I hope that answered your question. If not, ask again. You can use my talk page, too. By the way, don't forget to request approval for your bot / major changes! — Ocolon 18:20, 22 March 2007 (UTC)

API section

This whole section is misleading and could do with a clean up/removing.

  • "An API is an Application Programming Interface." - True.
  • "It describes how a bot should interact with wikipedia." - Not true. While there are guidelines for how a bot should interact with wikipedia (under "guidelines" lower down), they are not related to any API.

There is an API which I /think/ can be used to interact with wikipedia, which you can find here: http://meta.wikimedia.org/wiki/API

It's not helpful to call techniques like "screen scraping" APIs, because they're not. Perhaps this section could be replaced by something like "Ways bots can interact with wikipedia". 58.106.147.155 04:32, 18 April 2007 (UTC)

Why there is no wsdl?

Could you tell me, why you give web api, instead of just releasing wsdl. http://www.google.com/search?hl=uk&q=define:wsdl Why should we write for each platform/language new wrapper, instead of just using wsdl, which is implemented and tested on each platform? uk:User:Alex_Blokha— Preceding unsigned comment added by 85.25.148.242 (talkcontribs) 13:15, 16 July 2007 (UTC)

Question

So when I edit, my bot will automatically edit?? Just a question.  PNiddy  Go!  0 16:53, 3 August 2007 (UTC)

I'm not sure what you mean. If your code includes a login to Wikipedia, all edits will be performed under the bot's account. — Madman bum and angel (talkdesk) 17:49, 3 August 2007 (UTC)

Bot Exchange?

I'm a technology freak, but not advanced enough to create a bot. Is there any place where users give away bots? If so, press "Sonic" on my signature to leave a note. Thanks, HyperSonicBoom 02:22, 9 October 2007 (UTC)

Not really, only because bot operators should be experienced in the bot's language, and expert enough to fix any problems that may arise. — madman bum and angel 02:32, 9 October 2007 (UTC)

PyWikipedia test script

I'm having trouble with m:Pywikipedia's test.py file - it's not printing any output from it's normal output functions (although manually adding a print statement works fine.) Is anyone familiar with what would cause that and how to fix it?

As far as I know, it's still a stock installation, and I know that Windows Vista wouldn't cause problems for the standard output. --Sigma 7 16:12, 15 November 2007 (UTC)

Planning to make a new bot

Hi, I am planning to make a new bot and I need some help. Please try not to bite me because this is my first time planning to make a bot. Currently featured portal candidates is undergoing a revamp and we want to make a bot to help streamline the promotion process (like adding categories, the feature star, etc.) I'm planning to use AWB for this bot. Can someone give me a quick step-by-step of what I need to do? OhanaUnitedTalk page 01:20, 20 December 2007 (UTC)

Move this page to another wiki?

Since almost all said on this project page applies to bots operating on any mediawiki wiki, and the rest applies to all WikiMedia Foundation owned wikis, nearly nothing is specific to the English language Wikipedia, I suggest, to move the content of this page to either Meta Wiki or the MediaWiki wiki, and leave only a short summary and a link here.

I believe the added benefit of being found in a central place and becoming more available to every other community outweighs the cost of an additional click for English language Wikipedians.

Also, unburdoning the English Wikipedia from stuff that is not genuine its own, is imho a good idea, as well as having this good material at a place where it is more likel sought for. -- Purodha Blissenbach (talk) 09:53, 15 March 2008 (UTC)

wpStarttime not served

Hey everybody,

I'm writing a bot from scratch (yes, I know, reinventing the wheel -- I'm a control freak that way :-)). My poison is PHP. Everything's working great, except the edit page I retrieve in order to get the token and the rest of the variables doesn't contain wpStarttime and wpEdittime. I get this:

<input type='hidden' value="" name="wpStarttime" />
<input type='hidden' value="" name="wpEdittime" />

If I retrieve the page with wget, I do get them (but of course with wget I'm not logged in; my script does get authenticated first). If I retrieve the page with a browser, I do get them. But if I retrieve the page with PHP's curl, nada. That obviously leads to edit conflicts and nil results. So, what gives?

Thanks,
Gutza T T+ 21:33, 23 November 2007 (UTC)

Thank you for the reply – I was able to identify the problem and fix it though, after much trial and error. The problem was way more insidious than I had expected. I ended up grafting my code on SxWiki (the Pro version) – and, lo and behold, the same problem resurfaced! I am using a pre-fabricated method to do all CURL requests. The method accepts two parameters: the URL and the POST variables (the latter is optional). If I get POST variables, I do a POST – if I don't, I do a GET. Or so I thought. In order to clear all POST stuff from my existing CURL object (which might have just done a POST) in the GET branch, I used to do the following code:

<?
  curl_setopt($ch, CURLOPT_POST, 0);
  curl_setopt($ch, CURLOPT_POSTFIELDS, '');
?>

After a lot of hair pulling I was able to determine that the second line above activated the CURL object's POST method (yes, even though I was passing nothing). You can appreciate how difficult it was to come from "not receiving wpStarttime" to "CURL does a POST when you set the POSTFIELDS, and MediaWiki doesn't like that, so it doesn't serve wpStarttime". Anyway, problem solved, and SxWiki Pro is on its way out, if only I could find some testers (see the news on SourceForge if you're interested). --Gutza T T+ 21:37, 15 March 2008 (UTC)

French template bot

Can anyone assess the possibility of making a bot to add Template:French commune to any article lacking it in Category:Cities, towns and villages in France. Template data would be access through the French interwiki and would be taken from fr:Modèle:Infobox Commune de France already in place on the French pages which uses the same parameters. If the template already existed on EN (under any of its redirect) or didn't exist on FR then no edit would be made. One small caveat is that the French use:

arrondissement=[[Arrondissement de Bordeaux]] canton=[[Canton de Saint-André-de-Cubzac]]

Whereas on EN we remove the Arrondisement de (or d') and Canton de (or d'). We have hundreds of Canton articles with easily accessible data from FR that could/should be transferred and sanitized. Obviously they need sourcing but that can be fixed later since most efforts so far to transfer the data don't deal with that. gren グレン 06:46, 19 April 2008 (UTC)

Notes on using SxWiki Lite

If you're trying to use SxWiki Lite, there are a couple of things to note. First, make sure you create a cookiejar.txt file in the same directory as your bot and make it world writable. Secondly, if you're trying to use the sxGetCat() function, you'll need to update the code to reflect recent API changes. See the bug report. Kaldari (talk) 17:55, 4 June 2008 (UTC)

WikiFunctions.dll or DotNetWikiBot

I'm planning to rewrite my old bot in .NET, well at least implement similar functionality. Will probably not even bother to look at the old code. Anyway my simple but I guess very hard to answer question is should I make a AWB plugin and use WikiFunctions.dll or use the DotNetWikiBot frame work? The bot will not need lots of GUI, but seeing what it is doing would be nice so I guess AWB is better from that point of view, not sure if DotNetWikiBot have help for that? How is the functionality in the 2 frameworks? Are they very similar or is one generally much better. Any suggestions? --Stefan talk 12:58, 8 June 2008 (UTC)

Perl packages

I want to write a new bot in Perl. This page mentions several Perl packages for bots, but there no comparison between them. Can anyone recommend once of them?

Also, there's a package called MediaWiki, which looks quite impressive, but is not mentioned. Is it intentional or was it just missed? --Amir E. Aharoni (talk) 08:10, 30 May 2008 (UTC)

You could also test my new module @ http://www.exotica.org.uk/wiki/User:BuZz/MediaWiki::API 87.194.172.115 (talk) 19:08, 21 June 2008 (UTC)

Process

I think it goes 1. Do something 2. Do it several times 3. Get fed up 4. Think about automating it 5. Realise you can 6. Try - fail - try 7. Suceed! (with lots of manual testing) 8. Ask permission 9. Get permission to test 10. Test 11. Get permission to run 12. Run 13. Laurels and brickbats.

Rich Farmbrough, 21:43 12 December 2006 (GMT).

Heh. That's exactly why I'm here...I'm currently at Step #5. Pmcginty (talk) 23:19, 24 July 2008 (UTC)

Possible for bot to take information off of wikipedia or a webpage?

Is it possible for a bot to take information off of wikipedia or the below two webpages and then contact editors about an Article for deletion:

It is for a project here:

How to use POST?

I have evverything down, I just keep getting the error "needs to be in POST" what do i do?Tim1357 (talk) 20:14, 30 August 2009 (UTC)

You do an HTTP POST instead of a GET. The details of how exactly to do that depends on the programming language (and HTTP communication libraries) you are using. Anomie 00:37, 31 August 2009 (UTC)

To complicated

Hi I would like to create a bot that operates via toolserver could I please have some step by step instructions Venustas 12 (talk) 06:28, 23 December 2009 (UTC)

Java errors

Sorry that I have to post it here, but the Java Wiki Bot Framework wiki doesn't even have talk pages.

In Java, using JWBF, I made the sample bot:

package tidyBot;

import net.sourceforge.jwbf.bots.MediaWikiBot;
import net.sourceforge.jwbf.contentRep.mw.SimpleArticle;

public class Basic {
   public static void main(String[] args) throws Exception {
	  MediaWikiBot b = new MediaWikiBot("http://en.wikipedia.org/w/");
	  b.login("TidyBot", "I'm not going to tell you my password");
	  SimpleArticle sa = new SimpleArticle(b.readContent("Main Page"));
	  System.out.println(sa.getText());
   }
}

And I get an error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
	at tidyBot.Basic.main(Basic.java:8)

How do I fix this? I use EasyEclipse. Again, sorry about having to post this here.  Awesomeness  talk  22:17, 5 March 2010 (UTC)

PS: How are bots operated? Do I have to keep my computer running day and night, or is it done on a server? Should I have my own server to run it on?  Awesomeness  talk  22:18, 5 March 2010 (UTC)

PPS: If the fix for this is really difficult, should I just make it in Python or PHP? Although I am very good at Pythion, I haven't used it in a long time, and I don't like to use PHP. I am still adequate enough in PHP to make a bot though.  Awesomeness  talk  22:28, 5 March 2010 (UTC)

The framework may well be out of date, but I haven't checked. There was a recent change - a couple of weeks back - that may have broken the framework if it weren't prepared or patched. - Jarry1250 [Humorous? Discuss.] 16:39, 6 March 2010 (UTC)
So what about my other questions? Do I have to keep my computer running? Should I just make it in PHP instead?  Awesomeness  talk  19:26, 6 March 2010 (UTC)
Whether or not you need to keep your computer running depends on what kind of bot you're writing. If it needs to run continuously, then yes. If it only runs periodically, then no. The Toolserver can provide hosting for Wikimedia bots. Mr.Z-man 01:41, 7 March 2010 (UTC)

Broken characters (Unicode)

Hello. I've got an issue with my custom parser ignoring two LFs (#10) in a row in an article. Here's the diff for what WP has stored and what it sees/returns [2]. The bot uses mediawiki api POST's in xml format. The character encoding stays C-normalized utf-8 within all strings. It may be the normalization which does this or api or something in between that sees broken end-line syntax and "fixes it". It seems the parser loses the characters as soon as it retrieves the data from the api.

I cannot even effectively copy the symbols of the editbox (winxp64, firefox 3.6). The only way I can handle this is to view source, save it as a utf file, then parse it with some custom code and output the bytes - which pretty much says it's CR and two LFs - "13 10 10". This is probably due to someone editing on unix or something. So my question - can I let the bot (who is unaware there were such characters in the first place) do the edit and inadvertently fix the characters? Thanks.

P.S. I'm uncertain if there is a better (more technical) place to post this, some irc or something?  Hellknowz  ▎talk  22:03, 11 May 2010 (UTC)

Solved with a slight tinkering and proper edit testing. It was as much my browser problem as was my response stream processing. Hellknowz  ▎talk  23:09, 12 May 2010 (UTC)

How to actually make a bot with no programming experience

I think there should be a section which can tell you how to make a bot without any experience (or a new page) Sir Stupidity (talk) 07:32, 11 June 2010 (UTC)

If you have no programming experience, making a Wikipedia (etc) bot is probably not the place to learn. I would direct any such people to AWB, which can do all the technical work for you. - Jarry1250 [Humorous? Discuss.] 10:33, 11 June 2010 (UTC)
Many of the APIs are quite friendly, though I wouldn't know any by heart. Perhaps a mention of this under the library section. I do suspect thought that more intricate tasks would require a certain level of programming. And creating a bot for a live editing, as motivating and cool it may be, is indeed not the best starting point. I don't think we should advocate "learn to program by making a bot". —  HELLKNOWZ  ▎TALK 13:13, 11 June 2010 (UTC)
Thanks alot. I shall see that I first start by making 500 good edits. However, for the ambitious, we should create a page just for that. I would assume most people would like the idea of creating a bot. —Preceding unsigned comment added by Sir Stupidity (talkcontribs) 08:49, 12 June 2010 (UTC)

BasicBot Problem

Hello, i am trying to make my first bot using the BasicBot template in PHP, however i can't get it to log in, i wondered if anyone else has used this code. I have put my username and password in the code but i keep getting the 'Unable to connect' error. I wondered whether this due to the fact that my account is not an authorised bot, i am giving it the details of my second account CAGBot, which i created to become a bot. I havent submitted a bot request yet because i want to do a bit of initial testing in my namespace sandbox first I can't think of any other reason why it won't log in thank you in advance PiTalk - Contribs 23:51, 25 January 2008 (UTC)

Same with me too. I entered in further code to debug, and found out its not able to save the cookies, or proper cookies, thats (one of the reason) why probably its failing to login, for editing, but viewing mode was okay up until 2 weeks ago, but i tried yesterday, after developing my bot's actual function codes, it failed even for viewing mode ! (wikimedia probably changed even more codes), i fixed couple of bugs to reach that point, where it was at least trying for editing, but with "200"(editing failed), not the "302"(editing success). This "BasicBot" is using the "Snoopy" class library, both are outdated and still have many more bugs in it. Hope this helps, and, any help will be much appreciated. -- Tarikash 03:57, 8 February 2008 (UTC).
I have the same problem. I get an "unable to connect" error every time. If I look at the Snoopy variables, it says that the server is returning a "403 Forbidden" response code. Also the following shows up in the response headers: "X-Squid-Error: ERR_ACCESS_DENIED". Any ideas? Kaldari (talk) 23:37, 3 June 2008 (UTC)
I used to use the BasicBot extensively on a fairly old version of MediaWiki (1.6.7), and it worked just fine. But now, trying it on the latest version (1.16.0) I get the same "Cannot connect" problem, so it must be related to some authorization changes that happened in the meantime. 206.248.186.179 (talk) 16:08, 17 August 2010 (UTC)

Bot School

Wikipedia:New admin school provides step by step instructions for some admin actions and allows new admins to actually take those actions on test pages. I think a bot school likewise would be valuable. Perhaps it could be something as simple as writing a bot from scratch that corrects the spelling of the word "orange" (from "oraange" to "orange") on five test pages. Wikipedia:Bot school could be patterned after Wikipedia:New admin school. -- Uzma Gamal (talk) 03:15, 21 March 2011 (UTC)

That would be a bad idea for a sample bot, actually; see WP:SPELLBOT.
Who exactly would be the target audience for this "bot school"? For people who don't already know how to program, this really isn't the place to try to teach them; for people who do, most should just need a pointer to the API documentation and maybe a list of libraries to use so they don't have to do everything from scratch. People wanting to use AWB or interwiki.py would be better served by going to places specific to those tools. Anomie 15:25, 21 March 2011 (UTC)
I probably would be one of the few in the target audience. All the programming tutorials give me trivial examples (writing "Hello world!", adding numbers, etc...), and no guidance on how to apply them in actually situations. You can get pretty far with AWB, but the logic becomes hackish to get around the AWB limitations, and you'll never be able to get as far as you would if you make your own bot or AWB module. Browsing the libraries is a mess if you can't make sense of them, or have good working examples, or get a bot to log in, fetch the page, [process it], and save it. If someone could write everything but "process the page", that would probably be 90% of the work involved in making a bot, and you could start playing with the libraries to see what it is they actually do. Headbomb {talk / contribs / physics / books} 16:08, 21 March 2011 (UTC)
See, m:pywikipedia, it handles everything that your talking about, just run generate_user_files.py. then its trivial.
site = wikipedia.getSite()
page = wikipedia.Page(site, 'Wikipedia talk:Creating a bot')
text = page.get()
=========================================================================================================
insert processing here
=========================================================================================================
page.put(new_text,comment,is_edit_minor_true_false)

ΔT The only constant 16:20, 21 March 2011 (UTC)

Could it handle something like Wikipedia:Bot requests/Archive 40#Help with citation cleanup (templates) or Wikipedia:Bot requests/Archive 41/Archives/ 23#Bibcode bot? Headbomb {talk / contribs / physics / books} 16:26, 21 March 2011 (UTC)

С++/Qt4.5

I do not find any link to source code. Either this is only available when I create an account in that russian forum (which I do not want) or it has vanished. Any ideas where to find that beast? Thanks --84.245.130.149 (talk) 20:54, 24 July 2011 (UTC)

How can I create one?

How can I create a bot from scratch for myself? Fhusafnwfszdfsfgas (talk) 19:05, 11 February 2012 (UTC)

First, you need to think of which programming language you're going to use. — Preceding unsigned comment added by This Is M4dn355 300 (talkcontribs) 01:56, 14 March 2012 (UTC)

Bot Login in VB.net

Could someone please post how to login a bot in vb.net ? I keep getting a 417 error when I try.

private sub login
        'http://stackoverflow.com/questions/566437/http-post-returns-the-error-417-expectation-failed-c-resolved
        Dim client As New WebClient
        'client = new WebClient(); 
        Dim postdata As New NameValueCollection
        'NameValueCollection postData = new NameValueCollection(); 
        postdata.Add("lgname", "MyUserName")
        postdata.Add("lgpassword", "MyPassword")
        Dim response As Byte() = client.UploadValues("http://en.wikipedia.org/w/api.php?action=login&format=xml", postdata)
        MsgBox(New System.Text.ASCIIEncoding().GetString(response))

Any help/advice would be greatly appreciated! Smallman12q (talk) 23:45, 17 January 2010 (UTC)

You need to add "System.Net.ServicePointManager.Expect100Continue = false;". See T28631.Smallman12q (talk) 01:13, 10 April 2012 (UTC)

What constitutes a framework?

So I've created http://github.com/kalebheitzman/mediawikibot

I don't know that it really constitutes a bot framework. It simply a php class-based wrapper around the mediawiki api. It creates most of its methods dynamically through the php __call() method. There is a login method but that's it as far as programming a specific mediawiki action. It's up to the user to pass the right action and params i.e. $bot->query($params) and manipulate the data however the user sees fit. I hope it makes sense that all the class does is wrap action and param calls into a php object to be manipulated.

My question is this: It's not necessarily a framework, so where does this fit into the scheme of things? Kalebheitzman (talk) 21:47, 13 December 2011 (UTC)

I would call it a low-level wrapper for the MediaWiki API. It reminds me of simplemediawiki. →Στc. 02:50, 10 April 2012 (UTC)

Help!

this is too complicated :( can someone simplify this 4 me? ~OrigamiCalamari~ YES!!!!!!!!!!! — Preceding unsigned comment added by OrigamiCalamari (talkcontribs) 01:00, 29 June 2012 (UTC)

Testing a "hello world" bot and running it under Windows PowerShell

I'm an experienced programmer, though I haven't programmed much recently, and have no PHP experience. I would like to test run a "hello world" bot on Wikipedia, just to understand how they run in this environment.

<?php

echo "Hello world. testing 1—2—3\n\n";

?>

How do I actually run this as a program which simply displays Hello world. testing 1—2—3

rather than displaying it as a source code page? Do I need to go through the Wikipedia:Bots/Requests for approval just to get approval for simple practice and testing of this sort? Thanks Wbm1058 (talk) 19:10, 23 July 2012 (UTC)

Not at all. But you'll need to install PHP on your machine in order to execute the script; once you have, you can run php hello.php (or whatever your script file is named) and Hello world. testing 1—2—3 should be echoed. Please feel free to let me know if you have any further questions. Cheers! — madman 19:20, 23 July 2012 (UTC)
To clarify: You do not run a bot by uploading the source code to Wikipedia and somehow convincing MediaWiki to execute it. You write code that runs on your own machine (or under your account on a third-party server) and uses the MediaWiki API to interact with Wikipedia. See Wikipedia:Creating a bot for details. Anomie 21:16, 23 July 2012 (UTC)
Thanks for your replies, very helpful. Should I download and install PHP from here, and which version should I use for Wikipedia bots—thread safe or non thread safe? Do I need to have a web server running on my machine too? My machine is running Windows 7. Thanks Wbm1058 (talk) 00:43, 24 July 2012 (UTC)
You would download from there, yes. It's best to run bots from the command-line so they can run indefinitely; therefore, a Web server is not necessary. As a Web server's not necessary, thread-safe or non-thread-safe doesn't matter.  madman 01:54, 24 July 2012 (UTC)
Ah yes, Command Line PHP on Microsoft Windows, I can follow that. And as that says, I did Manual Installation. All I needed to run my "hello" program were two files: php.exe and php5ts.dll—seems most if not all the rest of the files in the package are not needed to run cmd line bots that edit Wikipedia. Now I'm ready to step up to the next level of complexity. The sample code I'm using for my learning exercise "includes" two files:
  • include("./public_html/botclasses.php"); // Botclasses.php was written by User:Chris_G and is available under the GNU General Public License
  • include("logininfo.php");
Do you by chance know where I can find those? Thanks again! Wbm1058 (talk) 16:37, 24 July 2012 (UTC)
If you search Wikipedia:Creating a bot for "botclasses.php", you'll find this link. "logininfo.php" is presumably a file setting two variables (likely named $user and $pass) to be passed to the login method. Access permissions on that file would be set as strictly as possible to avoid leaking the bot account's password. Anomie 20:18, 24 July 2012 (UTC)
Very good. And I noted that "include" files are also php files, so they need the <?php at the top and ?> at the end. Are there any php.ini defaults I should make sure to use on Wikipedia. What character set should I default to, which supports the en dashes and diacritics used in Wikipedia titles? Wbm1058 (talk) 13:56, 25 July 2012 (UTC)
You are correct; you only need php.exe and php5ts.exe, as long as you have the VC9 runtime installed (which almost everyone does; it's used for a lot of things). You should be using character set UTF-8 when you're reading and editing Wikipedia. Thanks, — madman 19:19, 25 July 2012 (UTC)
In Windows 7 command prompt mode, use chcp 65001 to change the code page to UTF-8, and change the font to Lucida Console. Right-click at the top of the command prompt window, and choose Properties. The Font tab offers three options: Consolas, Lucida Console and Raster fonts. None of these may be entirely satisfying, as I believe there is no font which supports all UTF-8 characters. Lucida Console seems to be the best option. Is this all we're stuck with, or is it possible to install additional fonts that the command prompt window can use? Wbm1058 (talk) 20:57, 27 July 2012 (UTC)

Microsoft Q247815 says "In Windows 2000, the installation of Console Fonts is no longer automated. This was done to give the console window greater stability in multilanguage environments." and gives a workaround. — madman 20:46, 28 July 2012 (UTC)

Thanks. I think I found a more satisfying solution: Windows PowerShell, Version 2.0, Windows PowerShell Integrated Scripting Environment (ISE): PowerShell 2.0 includes a GUI-based PowerShell host (formerly known as Graphical Windows PowerShell) that provides integrated debugger, syntax highlighting, tab completion and up to 8 PowerShell Unicode-enabled consoles (Runspaces) in a tabbed UI, as well as the ability to run only the selected parts in a script. Unicode-enabled consoles, yay! In Windows 7, All Programs→Accessories→Windows PowerShell→Windows PowerShell ISE Wbm1058 (talk) 00:34, 29 July 2012 (UTC)
I've had good results using PowerShell ISE to manually run my bot during the development and testing phase. Now I need to automate it. Anyone have experience with running automated bots under Windows? I'm looking for the best way to do this. I want my bot to run, say, every 15 minutes, and I want the process that runs the bot to automatically start when my Windows 7 system boots up. Tips & pointers appreciated. Wbm1058 (talk) 23:16, 21 August 2012 (UTC)
Start | Task Scheduler. Should be able to create a task and trigger it to begin on startup, repeated every 15 minutes. Cheers, — madman 00:02, 22 August 2012 (UTC)
I did figure out how do it with Windows Task Scheduler, but it took me the better part of a day to find how. I was frustrated until I Googled this up: Use Scheduled Tasks to Run PowerShell Commands on Windows. The secrets it revealed made setup a snap, and my bot was soon automated!
  • Use the Start / Run command to test out my command prior to going to all the trouble to schedule it  Y
  • Call PowerShell with the -command parameter, then an ampersand, a pair of curly brackets, and the Windows PowerShell command to run  Y
  • Use -noexit before -command for testing, remove -noexit once the command works correctly  Y
  • Redirect the console output to a text file, using the redirection arrows  Y
  • Use a semi-colon to separate a series of Windows PowerShell commands  Y I used the date command before and after running PHP to put a record of start & finish times in the output
Hope this helps the next guy who comes along that wants to use Windows to run a bot. Wbm1058 (talk) 21:59, 27 August 2012 (UTC)
Wow. Never would have guessed it was so difficult. Good job! — madman 01:25, 28 August 2012 (UTC)

Ideas for a Simple Helpful Bot

I've decided to try and see what I can do with bots. Could anyone give me something that won't put me in the deep end of the pool but is in high demand?

Thanks, GEOFBOT (talk) 00:49, 2 October 2011 (UTC)

I think you should read Wikipedia:Not ready to be a bot operator. In short, the community expects bot operators to be familiar with our policies, guidelines, and unwritten norms; you've had your account for about 2 days and made a total of 14 edits, so it is very unlikely that you have this familiarity. Spend some time as a normal editor and gain some experience, and come back in a few months or so. By that time you will probably have come up with an idea on your own, too. Anomie 01:11, 2 October 2011 (UTC)
OK, I'll do some more editing, first. GEOFBOT (talk) 20:37, 2 October 2011 (UTC)
After two years, I'm back! hahaha. I've gotten to know the Pywikibot framework and even contributed code to it; one day I will write a bot... Sn1pe! (talk) 13:23, 28 December 2013 (UTC)
You mean a request? There are some at WP:BOTREQ, you can dig through the archives and find something easy. →Στc. 01:14, 2 October 2011 (UTC)

Step by step implementation process of a bot

I have used only AWB. I have basic knowledge in programming. How do I implement a bot in Our Wikipedia/en Wikipedia. Say for example I want to implement GA bot, whitch was created and operated by harej. Source code. I shall to change code for our Wikipedia. I want to know step by step process. Assume that I have no knowledge of programming. I have a bot account in my native wikipedia; bn:user:joyBot. --- Jayanta Nath (Talk|Contrb) 10:00, 17 March 2012 (UTC)

No response about more than one year!!! Just silly question how do I run bot, I think above bot is automatic bot. So where to upload of our wikipedia?- Jayanta Nath (Talk|Contrb) 19:49, 15 September 2013 (UTC)
If you have no knowledge of programming, you shouldn't be trying to create a bot, IMO. Step 1 is learn to program.
OTOH, it would be appropriate IMO, if this page provided/pointed to an example of a simple bot that was implemented, and the steps that were taken, even though Anomie's answer above is helpful, I don't think it's too much to ask for an EXAMPLE! --Elvey (talk) 02:40, 2 May 2014 (UTC)

Bot hosting resources

Where are bots (that are designed to run on a regular/ongoing basis) typically hosted? I think it would be helpful if there was a bot hosting resource section on this page. The old (.de-hosted) toolserver vs the WMF hosted one... Or simply point out that people can/should start by hosting on their own desktop/laptop... ? Agreed? --Elvey (talk) 02:34, 2 May 2014 (UTC)

Most bots now are run on someone's personal computer or Tool Labs. The German Toolserver is going to be shut down in a month in favor of Labs. People can run bots on their own computer, but I'm not sure if we should go as far to say that they should start that way. If they have no prior Unix experience, using Labs will increase the learning curve, but it does make some things easier. Windows does have the capability to set up jobs to run on a schedule, but it's not particularly simple to set up. And if it's something that needs to run constantly, a server is a better idea in general. Mr.Z-man 20:21, 4 May 2014 (UTC)

Create a BOT to alphabetize and organize categories automatically

As someone who has been doing this manually for years, I hereby dutifully beg of anyone who is technically proficient and knows how to create and run a bot that will:

  1. Automatically sort all Categories on each article and category page alphabetically;
  2. Create a uniform system for where to place categories on each article and category page that commence with numbers, such as years of birth/death, centuries, and any category that starts with a number/numeral.

Please see the centralized discussion at Wikipedia:Bot requests/Archive 61#Create a BOT to alphabetize and organize categories automatically. Thank you, IZAK (talk) 09:27, 4 August 2014 (UTC)

Discussion re-opened at VPP

Please see Wikipedia:Village pump (policy)/Archive 114#Create a BOT to alphabetize and organize categories automatically. Thank you, IZAK (talk) 22:51, 5 August 2014 (UTC)

Tech help required to improve categories

Please see Wikipedia:Village pump (policy)#CatVisor and User:Paradoctor/CatVisor#Planned features if you are willing and able to assist this innovative WP project move along it would be greatly appreciated. Thank you, IZAK (talk) 23:36, 12 August 2014 (UTC)

Bot for linking pages

Hi, I'm looking for a bot that will add links to pages that already exist. So for instance "The rain in Spain falls mainly on the plains" does anyone know of one?--Stuartbman (talk) 15:00, 15 July 2015 (UTC)

Help

I go to http://en.wikipedia.org/w/api.php?action=login&format=xml this URL. I got this message

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<api servedby="mw1231">
<error code="mustbeposted" info="The login module requires a POST request" xml:space="preserve">
See https://en.wikipedia.org/w/api.php for API usage
</error>
</api>

--Maathavan (talk) 07:11, 11 December 2015 (UTC)

Yes, that's correct behavior. Login requires POST to prevent your password from being visible in server logs and browser history. — Earwig talk 07:43, 11 December 2015 (UTC)
@The Earwig:, How can I do this. How can I POST --Maathavan (talk) 10:21, 15 December 2015 (UTC)
Help me to create a BOT--Maathavan (talk) 10:28, 15 December 2015 (UTC)
First off, you can read the page on creating a bot. If you go for a bot framework, it'll handle that stuff semi-automatically; otherwise, your HTTP library should provide some sort of way to make POST requests (the specific method depends on the specific library, so I'm not sure how to be more helpful than this). — Earwig talk 10:31, 15 December 2015 (UTC)

JWBF

  1. I downloaded JWBF with git clone git://github.com/eldur/jwbf.git
  2. Then I compiled with mvn package. So I got the files jwbf-4.0.0-SNAPSHOT.jar and jwbf-4.0.0-SNAPSHOT-javadoc.jar
  3. I created a new project in Eclipse and added the two jar-files as external libraries.
  4. I created a new file in the project and pasted the code sample into it.

So far - so good. But when I tried to start it, I got the error java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory. I found the jar-file for it somewhere the net. Then I started and got the next error of this type ...
Is there any list of the required libraries for jwbf? If not, there would be no chance to run it, because of a lot dependencies.
--84.161.130.47 (talk) 20:24, 16 June 2016 (UTC)

The link at the "Request 1" and "Request 2" sections are broken. Could someone fix them?—‎Lost Whispers talk 00:28, 26 May 2017 (UTC)

Technical Advice IRC meeting

We'd like to invite you to the weekly Technical Advice IRC meeting. The next one is tomorrow, Wednesday 3-4 pm UTC on #wikimedia-tech.

The Technical Advice IRC meeting is open for all volunteer developers, topics and questions. This can be anything from "how to get started" over "who would be the best contact for X" to specific questions on your project.

If you know already what you would like to discuss or ask, please add your topic to the page. -- Michael Schönitzer (WMDE) (talk) 12:37, 19 September 2017 (UTC)

JavaScript library adding

Hi.

I personally am running a bot on a wiki that bases itself upon MediaWiki API, but it uses a different library - still in Javascript - than the mentioned MediaWiki Bot in the article (as it contains a long-lasting bug and its owner has been nowhere to be seen - last edit was 4 years ago), and here is its link. Just made sure I'd tell about that one, as another possibility. -- N tonio36 (talk) 22:20, 11 November 2017 (UTC)

Ceterach

Added description for ceterach bot framework — Preceding unsigned comment added by Wikidushyant (talkcontribs) 07:06, 18 November 2017 (UTC)