npm install livejournal
This package provides access to both XMLRPC and JSONRPC APIs for LiveJournal.
- http://wh.lj.ru/s2/developers/f/LiveJournal_XML-RPC_Specification_(EN).pdf
- http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.protocol.html
Examples
// get posts inside the journal using XMLRPC
LiveJournal.xmlrpc.getevents({
journal: 'brad',
auth_method: 'noauth',
selecttype: 'lastn',
howmany: 20
}, function(err, value) {
console.log(value.events);
});
// get post content using XMLRPC
LiveJournal.xmlrpc.getevents({
journal: 'brad',
auth_method: 'noauth',
selecttype: 'one',
ditemid: '29215'
}, function(err, post) {
console.log(post.events[0]);
});
There is no official public description of LiveJournal JSON RPC methods, but you can check Site.rpc.public
on http://livejournal.com
. Because the data is stored on CDN, you can access the data from anywhere.
Those are current ones (badly documented, contributions are welcome):
Get comments thread
Params:
journal -- Journal username
itemid -- Post id
Get latest posts
Params:
first_timepost
Examples
// get latest posts using JSONRPC
LiveJournal.jsonrpc.request('latest.get_entries', {
first_timepost: 1435262400
}, function(err, res) {
console.log(res.body.result.params.recent);
});
// get comments using JSONRPC
LiveJournal.jsonrpc.request('comment.get_thread', {
journal: 'tema',
itemid: '1987717'
}, function(err, res) {
console.log(res.body.result.comments)
});
You can access method list using LiveJournal.jsonrpc.methods
.
LiveJournal.API is wrapper around some resources provided at http://www.livejournal.com/bots/
- http://www.livejournal.com/developer/
- http://lj-dev.livejournal.com/
- http://www.livejournal.com/bots/
npm install jasmine -g
npm test