Narou API Wrapper

2.0.1 · active · verified Tue Apr 21

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.

Common errors

Warnings

Install

Imports

Quickstart

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);

view raw JSON →