1.0.3-hotfix • Published 4 years ago

samlib-api v1.0.3-hotfix

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Самиздат API

NPM модуль для упрощения работы с самиздатом

Возможности

  • Получить список авторов по префиксу
  • Получить все книги автора по ссылке на его страницу

Документация

Получение книг автора

getBooks(url)

Получения списка авторов

getAuthros(prefix)

Примеры

Получить всех авторов на букву "з"

const samlib = require('samlib-api')

samlib.getAuthors('z')
.then((authors) => {
    console.log(authors)
})
.catch((error) => {
    console.log(err)
})

Результат

[
  { link: 'http://samlib.ru/z/z_a_k/', name: 'З А К' },
  { link: 'http://samlib.ru/z/z_e/', name: 'З Елена' },
  {
    link: 'http://samlib.ru/z/z_igorx_ljubomirowich/',
    name: 'З Игорь Любомирович'
  },
  ...
]

Получить все книги определенного автора

samlib.getBooks('http://samlib.ru/z/z_a_k/')
.then((books) => {
    console.log(books)
})
.catch((error) => {
    console.log(err)
})

Результат

[
  {
    name: 'Осінь, дощ і трошки туману',
    link: 'http://samlib.ru/z/z_a_k/automn.shtml',
    comments: { count: '7', lastCommentDate: 2016-04-07T21:00:00.000Z },
    size: '0k'
  },
  {
    name: '. . .',
    link: 'http://samlib.ru/z/z_a_k/love_left.shtml',
    comments: { count: '7', lastCommentDate: 2014-03-16T20:00:00.000Z },
    size: '0k'
  }
]
1.0.3-hotfix

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1-alpha

4 years ago

1.0.0-alpha0.0.2

4 years ago

1.0.0-alpha0.1

4 years ago

1.0.0

4 years ago