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

@grodno-city/alis-web-request

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grodno-city/alis-web-request

Request data from ALIS WEB system

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
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

Package last updated on 16 Jun 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc