/livejournal-api-ts

Typescript client for the LiveJournal XMLRPC API

Primary LanguageTypeScript

LiveJournal XML-RPC API client

This is a pure Typescript LiveJournal XMLRPC API client, primarily meant for backing up LiveJournal user data into JSON for archiving and self-hosting.

The API is based on the LiveJournal XML-RPC Specification as well as the LiveJournal source code

Apart from XML-RPC methods, the client also implements the livejournal post/comment export functions as well as web-scraping functions to make up for functionalities the api lacks.

For not getting yourself banned, read up on the LiveJournal Bot Policy

Archived information on exporting comments can be found here: Exporting comments

Example usage

import LiveJournalApi from "./LiveJournalApi";

const ljApi = new LiveJournalApi({
    authMethod: "clear",
    username: "your_username",
    password: "your_password",
});

ljApi.getUserProfile({
    getcaps: 1,
    getmenus: 1,
    getmoods: 1,
    getpickws: 1,
    getpickwurls: 1
}).then(resp => console.log(resp));

Implemented auth methods

  • clear
  • challenge
  • cookie

Implemented methods

Currently no create, update or delete methods are implemented, only methods that read from the journal.

  • addcomment
  • checkfriends
  • checksession
  • consolecommand
  • createpoll
  • createrepost
  • deletecomments
  • deleterepost
  • editcomment
  • editevent
  • editfriendgroups
  • editfriends
  • editpoll
  • friendof
  • getchallenge
  • getcomments
  • getdaycounts
  • getevents
  • getfriendgroups
  • getfriends
  • getfriendspage
  • getinbox
  • getpoll
  • getpushlist
  • getrecentcomments
  • getrepoststatus
  • getuserpics
  • getusertags
  • login
  • postevent
  • pushsubscriptions
  • registerpush
  • resetpushcounter
  • sendmessage
  • sessionexpire
  • sessiongenerate
  • setmessageread
  • syncitems
  • unregisterpush
  • updatecomments
  • votepoll

Web-scraping functions

  • getUserIcons

Export functions

  • exportPosts1
  • exportComments

To Do

  • Handle lj user elements
  • Handle lj polls
  • Handle line breaks properly when converting to markdown
  • Add throttle function

Footnotes

  1. Export Journal