I'm having problems getting a test page from inside GetPaths() with following code:
HQSite = new Site("http://www.armadahq.com/wiki/", "Bot", "BotPassword");
My site operates on index.php5, so I changed that in code as well, its not a concern (I think).
I don't understand what that test is there for - whats the date there for...
When running, at line 211, mainPage has value of "http://www.armadahq.com/wiki/index.php5?title=Main_Page", however indexPath fails in producing a group (it defaults to string.empty)
Whole thing (404 page not found) is produced on DownloadString invocation at line 220.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see. The problem is that short URLs are misconfigured. Bot doesn't understand the path "http://www.guiadebolsa.com/bolsa/index.php/Página_principal", it thinks that "index.php" is a script file.
To fix that quickly you can set wikiPath and indexPath variables in DotNetWikiBot code manually in GetPaths() function, like that:
...
webResp.Close();
wikiPath = "/bolsa/index.php/";
indexPath = "/bolsa/";
Uri testPage = new Uri(site +
...
And then recompile the framework.
But it would be better to reconfigure the short URLs properly and remove that "/index.php/" from short path to pages. Short URLs configuration manual is located at http://www.mediawiki.org/wiki/Manual:Short_URL.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried that, but it still fails on Line 220 where it tries to access test page, attempting to retrieve page "http://www.armadahq.com/wiki/8ca5e0c018dabba" (last part is DateTime bit). It misses "
index.php5?" part there, correct code should be:
Uri testPage = new Uri(site +
((string.IsNullOrEmpty(indexPath) ? wikiPath : indexPath) + "index.php?title=") +
DateTime.Now.Ticks.ToString("x"));
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is no fundamental difference between index.php and index.php5. You should just carefully change this extension in EVERY place in the script. I guess, you've just forgotten to change it somewhere.
For example, look at lines 200 and 201 - there are regular expressions, but you should change the extension there too. So it must be:
Regex indexPathRE1 = new Regex("(?i)" + Regex.Escape(site) + "(/.+?/)index\\.php5\\?");
Regex indexPathRE2 = new Regex("(?i)href=\"(/[^\"\\s<>?]*?)index\\.php5\\?");
There is no problem with line 217, because "wikiPath" is an Apache server alias for "indexPath + "index.php?title="". Don't change it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Afterwards I tried but didn't manage to get the short URLs running on this mediawiki (I have another where they run fine, different host).
After trying the solution you gave me, it still doesn't work. I managed to get it logging in by hard coding the address, but it blows up a bit further along, because it produces bad URLs (I think it's the regex, which I really really hat ... all those hieroglyphs).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, now I've mostly taken care of the 404 problems, but on a Page.Load it gives me a 403 forbidden, and on a Save, it says this bot operation is not allowed even though I've given bot (and sysop, and bureocrat) permissions to the user ...
Some of it seems to be MediaWiki 1.13.2, for instance, I have ConfirmEdit turned off YET Mediawiki STILL displays a math Captcha on every edit (even by sysops) !!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having problems getting a test page from inside GetPaths() with following code:
HQSite = new Site("http://www.armadahq.com/wiki/", "Bot", "BotPassword");
My site operates on index.php5, so I changed that in code as well, its not a concern (I think).
I don't understand what that test is there for - whats the date there for...
When running, at line 211, mainPage has value of "http://www.armadahq.com/wiki/index.php5?title=Main_Page", however indexPath fails in producing a group (it defaults to string.empty)
Whole thing (404 page not found) is produced on DownloadString invocation at line 220.
Please, try removing /wiki/ from your URL:
HQSite = new Site("http://www.armadahq.com", "Bot", "BotPassword");
Does it work now?
No, I tried everything ...
The wiki is accessible, yes, it's over at
www.guiadebolsa.com/bolsa
I tried
www.guiadebolsa.com
www.guiadebolsa.com/bolsa
www.guiadebolsa.com/bolsa/index.php
Always gives me the 404 error, even though I can log in normally using the bot's username and password.
I see. The problem is that short URLs are misconfigured. Bot doesn't understand the path "http://www.guiadebolsa.com/bolsa/index.php/Página_principal", it thinks that "index.php" is a script file.
To fix that quickly you can set wikiPath and indexPath variables in DotNetWikiBot code manually in GetPaths() function, like that:
...
webResp.Close();
wikiPath = "/bolsa/index.php/";
indexPath = "/bolsa/";
Uri testPage = new Uri(site +
...
And then recompile the framework.
But it would be better to reconfigure the short URLs properly and remove that "/index.php/" from short path to pages. Short URLs configuration manual is located at http://www.mediawiki.org/wiki/Manual:Short_URL.
I tried that, but it still fails on Line 220 where it tries to access test page, attempting to retrieve page "http://www.armadahq.com/wiki/8ca5e0c018dabba" (last part is DateTime bit). It misses "
index.php5?" part there, correct code should be:
Uri testPage = new Uri(site +
((string.IsNullOrEmpty(indexPath) ? wikiPath : indexPath) + "index.php?title=") +
DateTime.Now.Ticks.ToString("x"));
There is no fundamental difference between index.php and index.php5. You should just carefully change this extension in EVERY place in the script. I guess, you've just forgotten to change it somewhere.
For example, look at lines 200 and 201 - there are regular expressions, but you should change the extension there too. So it must be:
Regex indexPathRE1 = new Regex("(?i)" + Regex.Escape(site) + "(/.+?/)index\\.php5\\?");
Regex indexPathRE2 = new Regex("(?i)href=\"(/[^\"\\s<>?]*?)index\\.php5\\?");
There is no problem with line 217, because "wikiPath" is an Apache server alias for "indexPath + "index.php?title="". Don't change it.
Still doesn't work, gives a 404 on the test page, same error.
I did some additional workaround in version 2.5. Try it.
I'm having the same problem. Did anyone find any solution?
See my message at https://sourceforge.net/forum/message.php?msg_id=4866132.
Still doesn't work, 404 all the same, it's on the test page ...
Is your wiki accessible from the Internet?
BTW, I am using MediaWiki 1.13.2, and the bot is Dotnetwikibot v2.4.
It was not misconfigured, that's a base installation, Mediawiki now behaves like that as per Mediawiki's site:
"MediaWiki's default page addresses looks like these examples:
http://example.com/w/index.php/Page_title (recent versions of MediaWiki, unless using CGI)
http://example.com/w/index.php?title=Page_title (recent versions of MediaWiki, using CGI) "
Afterwards I tried but didn't manage to get the short URLs running on this mediawiki (I have another where they run fine, different host).
After trying the solution you gave me, it still doesn't work. I managed to get it logging in by hard coding the address, but it blows up a bit further along, because it produces bad URLs (I think it's the regex, which I really really hat ... all those hieroglyphs).
Well, now I've mostly taken care of the 404 problems, but on a Page.Load it gives me a 403 forbidden, and on a Save, it says this bot operation is not allowed even though I've given bot (and sysop, and bureocrat) permissions to the user ...
Some of it seems to be MediaWiki 1.13.2, for instance, I have ConfirmEdit turned off YET Mediawiki STILL displays a math Captcha on every edit (even by sysops) !!
Well, I've solved all problems except for one, it gives me a 403 on Page.Load()
One of the problems was because there was a mismatch between versions with ConfirmEdit (it's sensitive to the issue).
Also something weird happened where "recent changes" is not updating. Ever came across that?
I can successively load pages from your site with Page.Load() , I don't get error 403.
Ups, that was dumb ... recent changes does not update because on preferences I don't have "bots" selected, so I don't see what they do ... heheh.
Ok, will do and report on it soon.
CodeDriller, v2.5 works PERFECT, not a single error.
Thanks very much, no doubt this is the best wikibot out there, at least for .NET.