API: Difference between revisions
Maximum Joe (talk | contribs) No edit summary |
No edit summary |
||
| Line 20: | Line 20: | ||
"gidlist": [ | "gidlist": [ | ||
[618395,"0439fa3666"] | [618395,"0439fa3666"] | ||
] | ], | ||
"namespace": 1 | |||
}</pre> | }</pre> | ||
| Line 29: | Line 30: | ||
"gid": 618395, | "gid": 618395, | ||
"token": "0439fa3666", | "token": "0439fa3666", | ||
"archiver_key": " | "archiver_key": "403565--d887c6dfe8aae79ed0071551aa1bafeb4a5ee361", | ||
"title": "( | "title": "(Kouroumu 8) [Handful☆Happiness! (Fuyuki Nanahara)] TOUHOU GUNMANIA A2 (Touhou Project)", | ||
"title_jpn": "( | "title_jpn": "(紅楼夢8) [Handful☆Happiness! (七原冬雪)] TOUHOU GUNMANIA A2 (東方Project)", | ||
"category": "Non-H", | "category": "Non-H", | ||
"thumb": "<nowiki>http://gt1.ehgt.org/14/63/1463dfbc16847c9ebef92c46a90e21ca881b2a12-1729712-4271-6032-jpg_l.jpg</nowiki>", | "thumb": "<nowiki>http://gt1.ehgt.org/14/63/1463dfbc16847c9ebef92c46a90e21ca881b2a12-1729712-4271-6032-jpg_l.jpg</nowiki>", | ||
| Line 39: | Line 40: | ||
"filesize": 51210504, | "filesize": 51210504, | ||
"expunged": false, | "expunged": false, | ||
"rating": "4. | "rating": "4.43", | ||
"torrentcount": " | "torrentcount": "0", | ||
"tags": [ | "tags": [ | ||
"touhou project", | "parody:touhou project", | ||
"handful happiness", | "group:handful happiness", | ||
"fuyuki | "artist:nanahara fuyuki", | ||
"full color" | "full color", | ||
"artbook" | |||
] | ] | ||
} | } | ||
| Line 59: | Line 61: | ||
===Gallery Tokens=== | ===Gallery Tokens=== | ||
Individual page links cannot be used directly for requesting gallery metadata; they contain the gallery ID but not the token. The ''gtoken'' method can be used to find the gallery token by providing the page data from the link. Page links use the following format: | Individual page links cannot be used directly for requesting gallery metadata; they contain the gallery ID but not the token. The ''gtoken'' method can be used to find the gallery token by providing the page data from the link. Page links use the following format: | ||
<pre<includeonly></includeonly> style="overflow: auto;{{{style|}}}">http://g.e-hentai.org/s/{page_token}/{gallery_id}-{pagenumber}</pre> | <pre<includeonly></includeonly> style="overflow: auto;{{{style|}}}"><nowiki>http://g.e-hentai.org/s/{page_token}/{gallery_id}-{pagenumber}</nowiki></pre> | ||
Example: http://g.e-hentai.org/s/40bc07a79a/618395-11 would require the following request: | Example: http://g.e-hentai.org/s/40bc07a79a/618395-11 would require the following request: | ||
| Line 98: | Line 100: | ||
*'''posted''' - UNIX time-stamp, UTC. | *'''posted''' - UNIX time-stamp, UTC. | ||
*'''filesize''' - Gallery size in bytes. | *'''filesize''' - Gallery size in bytes. | ||
*'''tags''' - A list of the gallery tags as strings. [[Namespaces]] will not be included unless the "namespace" argument is set to "1". | *'''tags''' - A list of the gallery tags as strings. [[Namespaces]] will not be included unless the optional "namespace" argument is set to "1". | ||
==Multiple Requests== | ==Multiple Requests== | ||
To get the metadata for multiple galleries users simply add entries to the ''gidlist''. Users can have up to 25 entries in a single request. The same applies for tokens but with entries in the ''pagelist''. | To get the metadata for multiple galleries users simply add entries to the ''gidlist''. Users can have up to 25 entries in a single request. The same applies for tokens but with entries in the ''pagelist''. | ||
==See also== | |||
*[http://forums.e-hentai.org/index.php?showtopic=157779 Gallery Filecount] - A userscript that uses API requests to add information to search results | |||
{{EHGNav}} | {{EHGNav}} | ||
[[Category:E-Hentai Galleries]] | [[Category:E-Hentai Galleries]] | ||
Revision as of 05:45, 15 January 2016
The E-Hentai API can be used to request metadata information for galleries. This can be done for links to galleries or to individual images.
Basics
- API URL: http://g.e-hentai.org/api.php
- Request method: POST
- Request type: JSON
- Response type: JSON
- Load limiting: 25 entries per request, 4-5 sequential requests usually okay before having to wait for ~5 seconds
Commands & Responses
Gallery Metadata
Users must provide a gallery ID along with its token in order to retrieve metadata. Both of these can be found in a gallery's URL which has the following format:
http://g.e-hentai.org/g/{gallery_id}/{gallery_token}/
Example: http://g.e-hentai.org/g/618395/0439fa3666/ would require the following request:
{
"method": "gdata",
"gidlist": [
[618395,"0439fa3666"]
],
"namespace": 1
}
Which gives the following JSON payload in response:
{
"gmetadata": [
{
"gid": 618395,
"token": "0439fa3666",
"archiver_key": "403565--d887c6dfe8aae79ed0071551aa1bafeb4a5ee361",
"title": "(Kouroumu 8) [Handful☆Happiness! (Fuyuki Nanahara)] TOUHOU GUNMANIA A2 (Touhou Project)",
"title_jpn": "(紅楼夢8) [Handful☆Happiness! (七原冬雪)] TOUHOU GUNMANIA A2 (東方Project)",
"category": "Non-H",
"thumb": "http://gt1.ehgt.org/14/63/1463dfbc16847c9ebef92c46a90e21ca881b2a12-1729712-4271-6032-jpg_l.jpg",
"uploader": "avexotsukaai",
"posted": "1376143500",
"filecount": "20",
"filesize": 51210504,
"expunged": false,
"rating": "4.43",
"torrentcount": "0",
"tags": [
"parody:touhou project",
"group:handful happiness",
"artist:nanahara fuyuki",
"full color",
"artbook"
]
}
]
}
If an invalid token is specified its entry in the gmetadata array will consist of the following:
{
"gid":519325,
"error":"Key missing, or incorrect key provided."
}
Gallery Tokens
Individual page links cannot be used directly for requesting gallery metadata; they contain the gallery ID but not the token. The gtoken method can be used to find the gallery token by providing the page data from the link. Page links use the following format:
http://g.e-hentai.org/s/{page_token}/{gallery_id}-{pagenumber}
Example: http://g.e-hentai.org/s/40bc07a79a/618395-11 would require the following request:
{
"method": "gtoken",
"pagelist": [
[618395,"40bc07a79a",11]
]
}
Which gives the following JSON payload in response:
{
"tokenlist": [
{
"gid":618395,
"token":"0439fa3666"
}
]
}
If any entries are invalid however, users will get an "error": "File not found" instead of the "token" for that entry.
Gallery Metadata Specification
- token
- archiver_key - Archiver keys change every hour, but an individual key is good for up to 24 hours.
- category - Category names differ slightly from the ones used on the actual site. The following are how they are called in the API:
- Doujinshi
- Manga
- Artist CG Sets
- Game CG Sets
- Western
- Image Sets
- Non-H
- Cosplay
- Asian Porn
- Misc
- Private
- posted - UNIX time-stamp, UTC.
- filesize - Gallery size in bytes.
- tags - A list of the gallery tags as strings. Namespaces will not be included unless the optional "namespace" argument is set to "1".
Multiple Requests
To get the metadata for multiple galleries users simply add entries to the gidlist. Users can have up to 25 entries in a single request. The same applies for tokens but with entries in the pagelist.
See also
- Gallery Filecount - A userscript that uses API requests to add information to search results
| E-Hentai Galleries Navigation | ||
|---|---|---|
| Finding | Gallery Searching • Bounty System • Favorites • Making Requests | |
| Directory | Anthologies • Artist Recommendations | |
| Uploading | Making Galleries • Gallery Categories • Gallery Manager • Gallery Descriptions | |
| Downloading | Archives • Hentai@Home • EHTracker | |
| User Actions | Tagging | Fetish Listing • Know The Difference • Mechanics (Namespaces, Tag Creation) • My Tags • New Tags |
| Other | Commenting • Expunging • Mod Power • Rating • Renaming • Reporting | |
| Rewards | Credits • Gallery Points • Hath Perks • Toplists | |
| Viewing | Lo-Fi • Multi-Page Viewer | |
| System | API • Bans • FAQ • My Home • Technical Issues | |