Socket
Socket
Sign inDemoInstall

alis-request

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    alis-request

Get books by year in alis library


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
5.92 MB
Created
Weekly downloads
 

Readme

Source

alis-request

Scraper api to get book by years on alis library

Installing

npm

npm install alis-request --save

yarn

yarn add alis-request

API

  • ReadableStreamBooks - read all book by year in stream
  • sendInitialQuery - make initial http query
  • getPage - get page body
  • getNumberedPageUrls - get ten page urls
  • run - recursive runner

Examples

You can do what you want with books, for example save in database. Next example return all books 2015 year in stream.

import Stream from 'stream';
import { sendInitialQuery, getPage, getNumberedPageUrls, run, ReadableStreamBooks } from 'alis-request';

const WritableStreamBooks = new Stream.Writable();
ReadableStreamBooks.pipe(WritableStreamBooks);

const books = [];

const initParams = {
  year: 2015,
  ip: '86.57.174.45',
};

sendInitialQuery(initParams, (err, res) => {
  if (err) {
    console.log(err);
    return;
  }
  const firstTenPageUrls = getNumberedPageUrls(res.page, initParams.ip);
  run(getPage, firstTenPageUrls, initParams.ip, res.jar);
});

WritableStreamBooks._write = (book, encoding, done) => {
  books.push(book);
  console.log(`STREAM: ${books.length}`);
  // ready to process the next chunk
  done();
};

Built With

  • request - Simplified HTTP client
  • cheerio - Fast, flexible & lean implementation of core jQuery designed specifically for the server.

Authors

License

MIT License

FAQs

Last updated on 09 Apr 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