Registry / http-networking / narou
library2.0.1jsnpmunverified

Narou is a TypeScript library that provides a fluent interface wrapper for the Narou Developer APIs (dev.syosetu.com), which allow programmatic access to data from the Japanese web novel publishing site Shousetsuka ni Narou. It supports various APIs including novel search, ranking retrieval, ranking history, and R18 novel search. The library currently stands at version 2.0.1, with recent releases showing active maintenance and minor bug fixes. It differentiates itself by offering a method-chaining syntax, full TypeScript type safety, and multi-environment compatibility, automatically selecting between native `fetch` for Node.js and JSONP for browser environments. It also boasts comprehensive coverage of all Narou Developer APIs, ensuring access to the full range of data provided by the Narou Developer Portal.

npm install narou
INSTALL
IMPORT
SIG · NAROU
N
narou
http-networkingjavascriptv2.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

search
import { search } from 'narou'
const { search } = require('narou')
Use named import for Node.js environments. CommonJS `require` is not supported for this ESM-first library.
ranking
import { ranking } from 'narou'
import ranking from 'narou'
Individual API functions are exported as named exports, not as a default export.
search
import { search } from 'narou/browser'
import { search } from 'narou'
For browser environments, use the explicit '/browser' subpath import to enable JSONP and browser-specific optimizations.
Genre
import { Genre } from 'narou'
Enums and helper types like `Genre` are also named exports.

This quickstart demonstrates searching for novels by keywords and genre, and retrieving daily rankings, showcasing the fluent API.

import { search, ranking } from 'narou'; import { Genre, Order, RankingType } from 'narou'; async function getNovels() { // Search for 'isekai' romance novels, ordered by favorite count const searchResult = await search('異世界') .genre(Genre.RenaiIsekai) .order(Order.FavoriteNovelCount) .limit(10) .execute(); console.log(`Found ${searchResult.allcount} novels matching the criteria.`); for (const novel of searchResult.values) { console.log(`- ${novel.title} (NCODE: ${novel.ncode})`); } // Get daily ranking for a specific date const rankingResult = await ranking() .date(new Date('2023-04-01')) .type(RankingType.Daily) .execute(); console.log('\nDaily Ranking (2023-04-01):'); for (const novel of rankingResult) { console.log(`- Rank ${novel.rank}: NCODE ${novel.ncode} (Points: ${novel.pt})`); } } getNovels().catch(console.error);
Debug
Known issues
breakingVersion 1.0.0 removed the internal `node-fetch` dependency. This might affect applications relying on specific `node-fetch` behavior or polyfills, as the library now uses native `fetch` in Node.js environments (which requires Node.js 18+ or a global polyfill for earlier Node.js 16+ versions).
fix
Ensure your Node.js environment is v18+ for native `fetch`, or provide a global `fetch` polyfill if using Node.js v16-v17. This usually does not require changes unless you had custom `fetchOptions`.
affects: >=1.0.0
breakingThe package now requires Node.js version 16.0.0 or higher. Older Node.js versions are not supported and will lead to runtime errors or installation failures.
fix
Upgrade your Node.js runtime to version 16.0.0 or later. Use `nvm` or a similar tool for managing Node.js versions.
affects: <16.0.0
gotchaWhen targeting browser environments, a specific import path (`narou/browser`) is required. Importing from the main 'narou' package directly in a browser environment will result in module resolution errors or incorrect functionality as it's optimized for Node.js.
fix
Change your import statement from `import { search } from 'narou'` to `import { search } from 'narou/browser'` for browser builds.
affects: >=0.9.0
gotchaWhile the library supports both Node.js and browser environments, the `rankingHistory` function in the browser version did not correctly respect `fetchOptions` prior to v2.0.1.
fix
Upgrade to `narou@2.0.1` or later if you are using `rankingHistory` in a browser environment and rely on `fetchOptions`.
affects: >=1.0.0 <2.0.1
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use CommonJS `require()` syntax with this ESM-first library in a module context or a Node.js version configured for ESM.
fix
Use ES module import syntax: `import { search } from 'narou';` instead of `const { search } = require('narou');`.
TypeError: (0, _narou_browser__WEBPACK_IMPORTED_MODULE_0__.search) is not a function
Attempting to use the `narou/browser` specific import in a Node.js environment, or vice-versa, or an incorrect bundling setup.
fix
Ensure you are using `import { search } from 'narou'` for Node.js and `import { search } from 'narou/browser'` for browser environments. Check your bundler configuration to ensure correct module resolution.
UnhandledPromiseRejectionWarning: TypeError: fetch is not a function
Running the Node.js version of the library in a Node.js environment older than v18, which does not have `fetch` globally available, after `node-fetch` was removed in v1.0.0.
fix
Upgrade your Node.js environment to v18 or newer, or install a `fetch` polyfill (e.g., `node-fetch`) and ensure it's globally available before importing `narou`.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
10
Resources
narou — npm install narou · libregistry