Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

ExhentaiApi

IronKinoko edited this page Jun 23, 2020 · 6 revisions

这里展示所有用到的 exhentai 相关 api,所有ex接口都需要登录 e-hentai 获取 cookie 验证

相关说明

这是一段 exhentai 链接例子

https://exhentai.org/g/1666878/d6cd3601ba/

这是他的路由定义

https://exhentai.org/g/:gid/:token/

每一个详情页面都有对应的 gidtoken, 后面调用接口的时候会用到

接口列表

登录

url: https://forums.e-hentai.org/index.php
method: POST
Content-Type: application/x-www-form-urlencoded

query: {
  "act": "Login", // 固定值
  "CODE": "01", // 固定值
}

body: {
  "referer": "https://forums.e-hentai.org/index.php?act=Login&CODE=01", // 固定值
  "b": "",
  "bt": "",
  "CookieDate": "1",
  "UserName": "邮箱",
  "Password": "密码"
}

// 请求例子
POST https://forums.e-hentai.org/index.php?act=Login&CODE=01

queryString:
referer=https%3A%2F%2Fforums.e-hentai.org%2Findex.php%3Fact%3DLogin%26CODE%3D01&b=&bt=&CookieDate=1&UserName=&Password=

// 返回结果
// 成功情况下,返回登录成功的html。失败情况下,会返回302状态,并提示需要验证谷歌验证码

获取 gallery 详细信息

url: https://exhentai.org/api.php
method: POST
content-type: application/json; charset=utf-8

body: {
  "method": 'gdata',
  "gidlist": [
      [gid, token],
      [gid, token],
      [gid, token],
      ... 最多25条
    ]
}

// 请求例子
POST https://exhentai.org/api.php

{
  "method": 'gdata',
  "gidlist": [
      [1666878, "d6cd3601ba"],
      [1666879, "d6cd3601ba123"], // 这条演示错误信息
    ]
}
// 返回结果
// 所有数据会依次返回
{
  "gmetadata": [
    {
      "gid": 1666878,
      "token": "d6cd3601ba",
      "archiver_key": "442454--55daa3db9d8734a098409ab1fdcbc0126ffb9c68",
      "title": "[Pixiv] Feng [6423025]",
      "title_jpn": "[Pixiv] 馮 [6423025]",
      "category": "Non-H",
      "thumb": "https://exhentai.org/t/9b/e7/9be77feb1b1f0dbf3c9957cd59815f4d509495dd-3343655-4093-2894-jpg_l.jpg",
      "uploader": "Assassin_",
      "posted": "1592830827",
      "filecount": "99",
      "filesize": 113942365,
      "expunged": false,
      "rating": "4.18",
      "torrentcount": "1",
      "torrents": [
        {
          "hash": "1f187bb03cdb63088bcf9fb15e0d8b464086ed5f",
          "added": "1572096053",
          "name": "[Pixiv] Feng [6423025].zip",
          "tsize": "15650",
          "fsize": "100288209"
        }
      ],
      "tags": [
        "fate grand order",
        "overwatch",
        "feng",
        "feng mouren",
        "dark skin"
      ]
    }
    // 如果有错误的 gid/token 则会返回
    {
      "gid": 1666879,
      "error": "Key missing, or incorrect key provided."
    } // 错误结果
  ]
}

获取 gallery 列表

url: https://exhentai.org
method: GET

query:{
  "page": "分页 不传默认是0",
  "f_search": "搜索内容",
  "f_cats": "分类查询 用的是十位二进制控制,具体看可以看ex原页面分类点击事件 不传默认用设置中的分类",
  "inline_set": "'dm_' + [m, p, l, e, t] 列表展示模式,从这五个中选择一个和前面dm_组合。例子:dm_p,参数解释{m: Minimal, p: Minimal+, l: Compact, e: Extended,t: Thumbnail}"
}
 
// 请求例子
GET https://exhentai.org/?f_cats=761&f_search=chino

// 返回结果
// 返回html内容

gallery 种子列表

url: https://exhentai.org/gallerytorrents.php 
method: GET

query: {
  "gid":"gallery 的 gid",
  "t":"gallery 的 token",
}

// 请求例子
GET https://exhentai.org/gallerytorrents.php?gid=1666878&t=d6cd3601ba

// 返回结果
// 返回html内容

获取收藏列表

url: https://exhentai.org/favorites.php
method: GET

query:{
  "page": "分页 起始0",
  "favcat": "指定收藏夹 0-9的数字 默认空字符串"
}

// 请求例子
GET https://exhentai.org/favorites.php?page=3&favcat=1

// 返回结果
// 返回html内容  获取第2个收藏夹第4页内容

收藏/取消收藏

url: https://exhentai.org/gallerypopups.php
method: POST
Content-Type: application/x-www-form-urlencoded

query:{
  "gid":"gallery 的 gid",
  "t": "gallery 的 token",
  "act": 'addfav' // 固定值
}

data: {
  "favcat": "favdel:删除  0-9:添加/更新 ",
  "favnote": "可以不填 喜欢的理由",
  "update": 1 //固定值
}

// 请求例子一
POST https://exhentai.org/gallerypopups.php?gid=1666878&t=d6cd3601ba&act=addfav

queryString:
favcat=favdel&favnote=&update=1

// 返回结果
// 无返回内容 删除收藏

// 请求例子二
POST https://exhentai.org/gallerypopups.php?gid=1666878&t=d6cd3601ba&act=addfav

queryString:
favcat=3&favnote=&update=1

// 返回结果
// 无返回内容 将gallery收藏进第四个收藏夹中