Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

livejournal

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

livejournal - npm Package Compare versions

Comparing version 0.0.8 to 0.1.0

.travis.yml

79

index.js

@@ -1,75 +0,14 @@

var request = require('request');
'use strict';
var RPC = require('./rpc');
module.exports = {
utils: {
parseLink: require('./lib/utils/parseLink'),
getFacebookStats: require('./lib/utils/getFacebookStats')
},
var API = require('./api');
API: require('./lib/api'),
var rxLink = [
/([0-9a-zA-Z-_]+)\.livejournal\.com\/([0-9]+)\.html/,
/m\.livejournal\.com\/read\/[a-z]+\/([0-9a-zA-Z_-]+)\/(\d+)/,
/users\.livejournal\.com\/([0-9a-zA-Z-_]+)\/([0-9]+).html/
];
xmlrpc: require('./lib/xmlrpc'),
function _groupBy(arr, amount) {
var result = [], offset = 0;
do {
result.push(arr.slice(offset, offset + amount));
offset += amount;
} while (offset < arr.length);
return result;
}
function getFBStats(urls, callback) {
var groups = _groupBy(urls, 10),
result = {},
done = 0;
groups.forEach(function(group) {
request({
url: 'http://graph.facebook.com/?ids=' + group.join(','),
json: true
}, function(err, res, body) {
if (!err && res.statusCode == 200) {
for (var key in body) {
result[key] = body[key].shares || 0;
}
done++;
if (done >= groups.length) {
callback(null, result);
}
} else {
callback(err);
}
});
});
}
function parseLink(url) {
if (!url) {
return null;
}
for (var i = 0, match; i < rxLink.length; i++) {
match = url.match(rxLink[i]);
if (match && match.length === 3) {
return { journal: match[1], postId: match[2] };
}
}
return null;
}
module.exports = {
getFBStats: getFBStats,
parseLink: parseLink,
RPC: RPC,
API: API
jsonrpc: require('./lib/jsonrpc')
};
{
"name": "livejournal",
"version": "0.0.8",
"description": "LiveJournal XMLRPC",
"keywords": ["livejournal", "blog"],
"version": "0.1.0",
"description": "LiveJournal API",
"keywords": [
"livejournal",
"blog",
"social",
"xmlrpc",
"jsonrpc"
],
"scripts": {
"test": "jasmine"
},
"author": "Artem Tyurin <artem.tyurin@gmail.com>",

@@ -12,6 +21,9 @@ "repository": {

"dependencies": {
"xmlrpc": "git://github.com/agentcooper/node-xmlrpc.git",
"request": ">=2.25"
"superagent": "^1.2.0",
"xmlrpc": "^1.3.1"
},
"main": "index"
"main": "index",
"devDependencies": {
"jasmine": "^2.3.1"
}
}

@@ -1,6 +0,8 @@

## LiveJournal XMLRPC for Node
## LiveJournal API
[![Build Status](https://travis-ci.org/agentcooper/node-livejournal.svg?branch=master)](https://travis-ci.org/agentcooper/node-livejournal)
`npm install livejournal`
### Docs
This package provides access to both XMLRPC and JSONRPC APIs for LiveJournal.

@@ -12,11 +14,7 @@ ## XMLRPC

## Other
Examples
* http://www.livejournal.com/developer/
* http://lj-dev.livejournal.com/
### Example
```javascript
LiveJournal.RPC.getevents({
// get posts inside the journal using XMLRPC
LiveJournal.xmlrpc.getevents({
journal: 'brad',

@@ -32,3 +30,4 @@ auth_method: 'noauth',

```javascript
LiveJournal.RPC.getevents({
// get post content using XMLRPC
LiveJournal.xmlrpc.getevents({
journal: 'brad',

@@ -43,7 +42,76 @@ auth_method: 'noauth',

## JSONRPC
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):
##### `discovery.author_posts`
##### `comment.get_thread`
Get comments thread
```
Params:
journal -- Journal username
itemid -- Post id
```
##### `latest.get_entries`
Get latest posts
```
Params:
first_timepost
```
##### `browse.get_posts`
##### `gifts.get_gifts_categories`
##### `gifts.get_all_gifts`
##### `homepage.get_categories`
##### `discovery.suggest`
##### `sitemessage.get_message`
##### `discovery.get_categories`
##### `browse.get_categories`
##### `writers_block.get_list`
##### `discovery.today`
##### `discovery.get_feed`
##### `discovery.get_item`
##### `homepage.get_rating`
##### `browse.get_communities`
Examples
```js
// get latest posts using JSONRPC
LiveJournal.jsonrpc.request('latest.get_entries', {
first_timepost: 1435262400
}, function(err, res) {
console.log(res.body.result.params.recent);
});
```
```js
// 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`.
## API
LiveJournal.API is wrapper around some resources provided at http://www.livejournal.com/bots/
## Other docs and resources
* http://www.livejournal.com/developer/
* http://lj-dev.livejournal.com/
* http://www.livejournal.com/bots/
## Tests
```
npm install jasmine-node -g
jasmine-node spec/
npm install jasmine -g
npm test
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc