If you use Emacs and have a local Wikipedia, you may be interested in some code I'm working on. This code can access Wikipedia through Emacs. I am currently extending the code into a full wkp-mode.
For more details, check my User page at http://meta.wikipedia.org/wiki/User:MwZurp
On Thu, 2004-06-17 at 18:40 -0400, rickm@golden.net wrote:
If you use Emacs and have a local Wikipedia, you may be interested in some code I'm working on. This code can access Wikipedia through Emacs. I am currently extending the code into a full wkp-mode.
For more details, check my User page at http://meta.wikipedia.org/wiki/User:MwZurp
To get the source of a page, you can also use the action=raw method.
Example url: http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw
Gabriel Wicke
Gabriel Wicke lists@wikidev.net writes:
On Thu, 2004-06-17 at 18:40 -0400, rickm@golden.net wrote: To get the source of a page, you can also use the action=raw method. Example url: http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw
Interesting. This URL gets XML which I may find useful later on. However, I'm aiming for something that would get the wiki-markup. Is there an action that would get the wiki-markup? I just tried "&action=markup" which doesn't work.
Anyway, Evan Prodromou just told me about wikipedia.el which is definitely the direction that I'm heading in. However, I working towards something that is more emacs-centric and will allow browsing/editing of Wikipedia in a fashion that entirely bypasses the browser.
But, first, I need to digest this wikipedia.el.
Rick wrote:
Gabriel Wicke lists@wikidev.net writes:
On Thu, 2004-06-17 at 18:40 -0400, rickm@golden.net wrote: To get the source of a page, you can also use the action=raw method. Example url: http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw
Interesting. This URL gets XML which I may find useful later on. However, I'm aiming for something that would get the wiki-markup. Is there an action that would get the wiki-markup? I just tried "&action=markup" which doesn't work.
The above URL *does* get the wiki-markup.
-- brion vibber (brion @ pobox.com)
Brion Vibber brion@pobox.com writes:
Rick wrote:
Gabriel Wicke lists@wikidev.net writes:
http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw
... gets XML ... [want] an action that would get the wiki-markup?
The above URL *does* get the wiki-markup.
My mistake. I forgot to enclose the URL in quotes. This command does indeed get the wiki-markup:
$ wget "http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw"
Thanks.
Gabriel Wicke lists@wikidev.net writes:
To get the source of a page, you can also use the action=raw method. Example url: http://en.wikipedia.org/w/wiki.phtml?title=Main_Page&action=raw
So if I wanted to look at the wiki-markup in Emacs, I can issue:
(let ((article "Edit: Apple")) (if (get-buffer article) (kill-buffer article)) (switch-to-buffer article) (insert (shell-command-to-string (format "wget -q -O - "%s?title=%s&action=raw"" "http://en.wikipedia.org/w/wiki.phtml" "Apple"))))
Now let's say that I edited the buffer in Emacs and, then, wanted to promote the edits. Let's say that I saved the buffer in "Apple.wiki".
Is there some kind of command-line operation that I can issue that would be equivalent to clicking "Save page" during an edit operation?
I'd also want some way to specify the "Edit summary" field and indicate if the operation is a minor edit. Hmm, there is also specifying my User name which, I assume, would be even trickier.
Well, if I could get past all that, could I issue some kind of command-line operation that would be equivalent to presing the "Show preview" button? Then, for instance, my firefox web-browser would come up with my edits already present in the edit-box.
Rick rickm@golden.net writes:
Is there some kind of command-line operation that I can issue that would be equivalent to clicking "Save page" during an edit operation?
I guess you can make use of the 'url' package. I don't know how good cookie support is.
Directly talking to the SQL database would be another possibility.
Or a webdav interface. Or, dreaming, access via CVS...
Rick rickm@golden.net writes:
Is there some kind of command-line operation that I can issue that would be equivalent to clicking "Save page" during an edit operation? ... etc
I just had an idea about how to do Save-page from command-lines (and, ultimately, within Emacs).
Aren't there various bots doing updates to Wikipedia? I know there are server-side bots but aren't there also some client-side bots (including bots used by trolls :-|)? Just how do the client-side bots work?
I'm starting to go through http://en.wikipedia.org/wiki/Wikipedia:Bots but I'm not too clear on what code a bot actually uses. If there are easy/preferred/clean approaches, I'd appreciate some URLs (or search keywords).
Or am I mistaken on what bots do and how they do their work? Do bots bypass the browser and, essentially, operate on the command-line? I've never used a bot before so I'm pretty clueless about them.
By the way, I am not interested in creating a bot. I just want to promote my edits from within Emacs. That is, I want to give Emacs users the same abilities that, apparently, bots have.
Rick rickm@golden.net writes:
Is there some kind of command-line operation that I can issue that would be equivalent to clicking "Save page" during an edit operation? ... etc
I just had an idea about how to do Save-page from command-lines (and, ultimately, within Emacs).
Aren't there various bots doing updates to Wikipedia? I know there are server-side bots but aren't there also some client-side bots (including bots used by trolls :-|)? Just how do the client-side bots work?
I'm starting to go through http://en.wikipedia.org/wiki/Wikipedia:Bots but I'm not too clear on what code a bot actually uses. If there are easy/preferred/clean approaches, I'd appreciate some URLs (or search keywords).
Or am I mistaken on what bots do and how they do their work? Do bots bypass the browser and, essentially, operate on the command-line? I've never used a bot before so I'm pretty clueless about them.
By the way, I am not interested in creating a bot. I just want to promote my edits from within Emacs. That is, I want to give Emacs users the same abilities that, apparently, bots have.
Is there some kind of command-line operation that I can issue that would be equivalent to clicking "Save page" during an edit operation?
I'd also want some way to specify the "Edit summary" field and indicate if the operation is a minor edit. Hmm, there is also specifying my User name which, I assume, would be even trickier.
I've no idea what equivalents or bindings or whatever there are for EMACs, but all of the above can be done pretty easily with "libwww-perl". Essentially, you can control exactly what HTTP requests get sent, just like a browser would, and it will handle things like cookies for you quite happily (you just give it a text file to use as a "cookie jar" IIRC).
If the worst comes to the worst, it's not that hard to code HTTP requests by hand: it's all just plaintext, and forms are simply sent as part of the data (he says, fudging it bacause he's never coded anything that used POST requests yet); cookies are just sent as an extra header, so that's easy enough too, once you've gone through the login screen and acquired one.
You might want to have a look at the "livehttpheaders" mozilla extension, which allows you to see exactly what is being sent between the browser and the web server, in real time: watch what it does when you save / preview a change in a sandbox somewhere, and that's what you're code has to do. http://livehttpheaders.mozdev.org/index.html
wikitech-l@lists.wikimedia.org