Socket
Socket
Sign inDemoInstall

@grodno-city/alis-web-request

Package Overview
Dependencies
93
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @grodno-city/alis-web-request

Request data from ALIS WEB system


Version published
Maintainers
3
Created

Readme

Source

alis-web-request

Request data from ALIS WEB system

Installing

npm

npm install @grodno-city/alis-web-request --save-dev

yarn

yarn add @grodno-city/alis-web-request

API methods

  • sendInitialQuery - make initial http query to alis library for get main page and cookie id.
  • getPage - get page body from the specified url.
  • getNumberedPageUrls - get firs ten numbered urls from main page.
  • getNextPageUrl - get next page url from the specified url.
  • processItems - to managements another functions getPage, getNextPageUrl, pushItemsToStream.
  • getItems - get id with title all books on the page.
  • run - run processItems function over queue with options.
  • ReadableStreamItems - readable stream for read items.

Example

import Stream from 'stream';
import { sendInitialQuery, getNumberedPageUrls, run, processItems, parsePage, ReadableStreamItems } from '@grodno-city/alis-web-request';

const WritableStreamItems = new Stream.Writable({ objectMode: true });

ReadableStreamItems.pipe(WritableStreamItems);

const initParams = {
  year: 2017,
  alisEndpoint: 'http://86.57.174.45',
};

sendInitialQuery(initParams, (err, res) => {
  if (err) {
    return new Error(err);
  }

  const options = {
    alisEndpoint: initParams.alisEndpoint,
    jar: res.jar,
  };
  const $ = parsePage(res.page);
  const firstNumberedPageUrls = getNumberedPageUrls($);

  run(processItems, firstNumberedPageUrls, options);
});

const items = [];

WritableStreamItems._write = (item, encoding, done) => {
  items.push(item);
  done();
};

Authors

  • Vadim Demyanchik - GitHub
  • Pavel Zubkou - GitHub

License

MIT License

FAQs

Last updated on 22 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc