epanda

Grab everything from e-hentai.org(exhentai).

Usage no npm install needed!

<script type="module">
  import epanda from 'https://cdn.skypack.dev/epanda';
</script>

README

ehentai-js

Grab everything from e-hentai.org(exhentai).

Features

  • gallery metadata
  • hentaihome status
    • Static ranges
    • Quality, hathrate, hitrate...
  • exchange status
    • gallery point exchange
    • hath exchange
  • search support
    • search keyword
    • search image
    • advance options
  • user-related
    • rate gallery
    • favorite gallery

Installation

$ npm install ehentai-js

Configuration

Configuration file should be placed as os.homedir()/.ehentai.json(~/.ehentai.json)

[
  path.join(os.homedir(), ".ehentai.json"),
  path.join(process.cwd(), ".ehentai.json")
];

Format:

{
  "cookie": "ipb_member_id=*****; ipb_pass_hash=*************; igneous=**; sk=**",
  "apiuid": 123456,
  "apikey": "*************"
}

Cookie is required for visiting exhentai site or getting user-related information;

Apiuid and apikey are required for user-related operations such as rating.

Using environment variables is also supported.

EH_COOKIE=
EH_APIUID=
EH_APIKEY=

gallery

const h = require("ehentai-js");

// two ways to provide target url
h.gallery
  .get({ url: "https://e-hentai.org/g/1456937/9345049afa/" })
  .then(console.log);
// or
h.gallery
  .get({ gid: 1456937, token: "9345049afa", exhentai: true })
  .then(console.log);
{
  title: '[Shinozuka Yuuji] Hajimete no Hitozuma | 初品嘗的美艷人妻 [Chinese]',
  title_original: '[篠塚裕志] 初めてのヒトヅマ [中国翻訳]',
  category: 'Manga',
  tags: {
    language: [ 'chinese', 'translated' ],
    artist: [ 'shinozuka yuuji' ],
    male: [
      'dilf',
      'cheating',
      'schoolboy uniform',
      'condom',
      'muscle',
      'big penis',
      'glasses'
    ],
    female: [
      'big breasts',  'stockings',
      'netorare',     'teacher',
      'hairy',        'gyaru',
      'blackmail',    'dark skin',
      'paizuri',      'x-ray',
      'ponytail',     'mother',
      'milf',         'cheating',
      'nakadashi',    'pantyhose',
      'collar',       'impregnation',
      'huge breasts', 'lactation'
    ],
    misc: [ 'tankoubon', 'incest', 'inseki' ]
  },
  language: 'Chinese',
  translated: true,
  favorite_category: undefined,
  source: {
    site: 'exhentai',
    gid: 1456937,
    token: '9345049afa',
    parent_gallery: undefined,
    newer_versions: [],
    url: 'https://exhentai.org/g/1456937/9345049afa/'
  },
  favcount: 7623,
  rating: { average: 4.9, count: 468 },
  thumbnail: 'https://exhentai.org/t/33/81/3381628f4615c218cdd262bf45e6bea6e4f44f7d-6050794-4341-3000-jpg_250.jpg',
  uploader: 'dfsgg',
  filecount: 236,
  filesize: 717121126,
  posted: 2019-08-04T09:07:00.000Z,
  visible: 'Yes',
  comments: [
    {
      text: '速度好快 今晚社保!!!5555',
      date: 2019-08-04T09:25:00.000Z,
      score: 7
    },
    {
      text: '昨天才生肉,今天就出貨了,篠塚裕志的就是報社',
      date: 2019-08-04T09:46:00.000Z,
      score: 60
    },
    {
      text: '我還是等未來數位的出了再買吧',
      date: 2019-08-04T10:14:00.000Z,
      score: 144
    },
    { text: '🐍🐍🐍🐍🐍', date: 2019-08-04T10:14:00.000Z, score: 6 },
    // ...
  ],
  url: 'https://exhentai.org/g/1456937/9345049afa/',
  generated: 2020-01-10T02:19:47.430Z
}

search

Support 5 different display modes (this will effect the tags field in search results).

Support keyword search & image search.

const h = require("ehentai-js");
h.search.byKeyword('artist:"shinozuka yuujiquot;').then(console.log);

h.search
  .byKeyword('artist:"shinozuka yuujiquot;', {
    page: 1,
    expunged: true,
    exhentai: true,
    minPages: 100,
    minimumRating: 4,
    disableFilterForLanguage: true
  })
  .then(console.log);
[
  {
    url: 'https://exhentai.org/g/1458970/d7c3ad55be/',
    name: '[Shinozuka Yuuji] Hajimete no Hitozuma [Digital]',
    tags: [],
    page: 240
  },
  {
    url: 'https://exhentai.org/g/1458308/c4ceea2408/',
    name: '[Shinozuka Yuuji] Hajimete no Hitozuma',
    tags: [],
    page: 237
  },
  {
    url: 'https://exhentai.org/g/1456937/9345049afa/',
    name: '[Shinozuka Yuuji] Hajimete no Hitozuma | 初品嘗的美艷人妻 [Chinese]',
    tags: [ 'language:chinese' ],
    page: 236
  }
  //...
]
const h = require("ehentai-js");
const filepath = "Gaol_001.jpg";
h.search.byImage(filepath).then(console.log);
[
  {
    url: "https://exhentai.org/g/1456937/9345049afa/",
    name: "[Shinozuka Yuuji] Hajimete no Hitozuma | 初品嘗的美艷人妻 [Chinese]",
    tags: ["language:chinese"],
    page: 236
  }
];

exchange

const h = require("ehentai-js");

h.exchange.gpExchange().then(console.log);
h.exchange.hathExchange().then(console.log);

hentaihome

const h = require("ehentai-js");
h.hentaihome.clients().then(console.log);
[
  {
    cid: '*****',
    status: 'Online',
    created: 2019-12-19T00:00:00.000Z,
    lastSeen: 'Today, 02:22',
    served: 273739,
    ip: '***.***.***.***',
    port: '****',
    trust: 1000,
    quality: 9092,
    hitrate: 14.8,
    hathrate: 8.3,
    country: 'United States'
  }
]
const h = require("ehentai-js");
h.hentaihome.staticRanges("******").then(console.log);

user

Rate

const h = require("ehentai-js");
h.user
  .rate({ gid: 1477701, token: "1661b183ad", rating: 10 })
  .then(console.log);

Favorite

const h = require("ehentai-js");
h.user
  .addFavorite({
    gid: 1477701,
    token: "1661b183ad",
    favcat: 9,
    favnote: "test favorite"
  })
  .then(console.log);

h.user.deleteFavorite({ gid: 1477701, token: "1661b183ad" }).then(console.log);

agent

Getting library's request agent interface crawlx - npm

const h = require("ehentai-js");

console.log(h.x.agentOptions.headers);
h.x({ url: "https://exhentai.org/", parse: "title" }).then(
  ({ res, parsed }) => {
    console.log(res.status);
    console.log(parsed);
  }
);