@millenmortier/google-scholar-query
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Google Scholar query

A tiny library to ease making requests to Google Scholar.

Installation

npm i @millenmortier/google-scholar-query

Usage

The main file exports two mechanisms:

Promise-based

import { queryAsPromise } from '@millenmortier/google-scholar-query';

(async () => {
  const results = await queryAsPromise('YOUR_GOOGLE_SCHOLAR_QUERY_HERE');
})();

Event-based

import { queryAsEvent } from '@millenmortier/google-scholar-query';

const emitter = queryAsEvent('YOUR_GOOGLE_SCHOLAR_QUERY_HERE');

const allData = [];
emitter.on('data', (newResults) => {
  // newResults will be a new page of articles
  allData = allData.concat(newResults);
});

emitter.on('end', () => {
  // all results have been fetched
});

emitter.on('error', (err) => {
  // An error occurred
});

emitter.on('tooManyRequests', () => {
  // Google is rate-limiting us, so it's best to try again after a while
});

Readme

Keywords

none

Package Sidebar

Install

npm i @millenmortier/google-scholar-query

Weekly Downloads

5

Version

0.1.2

License

ISC

Unpacked Size

9 kB

Total Files

10

Last publish

Collaborators

  • millenmortier