Unstable API
Source code related to this project is available. Currently the primary location is several github organizations:
API Terms of Use
Our public API is provided free of charge for personal tools, reader integrations, and non-commercial projects. By sending requests to our API, you agree to the following rules
-
Identify Your Client: You must include a clear,
accurate User-Agent header identifying your application or script (for
example,
MyReaderApp/1.0 (+https://example.com)). Do not spoof browser User-Agents. - Respect Rate Limits: You must honor all rate limits, HTTP 429 Too Many Requests responses, and Retry-After headers. Attempting to bypass rate limits by rotating IP addresses or splitting requests across multiple origins is prohibited.
- No Bulk Archiving or Commercial Redistribution: You may not use the API to bulk-scrape entire archives, build a public download mirror/library, or sell converted files. All API usage remains subject to our Terms of Service and Copyright / Author Opt-Out Policy.
- Availability & Enforcement: This API is provided "as is" without uptime guarantees or warranties, and endpoints may change or be discontinued at any time. We reserve the right to throttle or permanently block any IP address or User-Agent that violates these terms or places excessive load on our infrastructure.
You may make requests directly to FicHub's internal API, though no stability guarantee is made at this time.
- please set a custom user-agent including contact info
- please do not make concurrent requests
- handle 429 Too Many Requests/Retry-After response header
- do not try to export a large fraction of a site without getting into contact first
- do not expect v0 to be entirely stable
- if you want to use the API from a corporate IP or VPN please contact me to get an API key
Requesting exports
The main v0 endpoint is /api/v0/epub which takes a
q parameter for the fic to export. That is, make a GET
request to https://fichub.net/api/v0/epub?q={fic}. Ex (please
set a custom user-agent -- ie use some identifier for your project and
include contact info after the +, and make requests in serial):
> curl -s -A "fichub-client/0.0.1 +@iris on discord" https://fichub.net/api/v0/epub?q=https://forums.spacebattles.com/threads/nemesis-worm-au.747148 | jq '.'
{
"epub_url": "/cache/epub/NtePoQrV/Nemesis_by_BeaconHill-NtePoQrV.epub?h=47bd33893936ece7315060d0b09fe7c9",
"err": 0,
"fixits": [],
"hashes": {
"epub": "47bd33893936ece7315060d0b09fe7c9"
},
"html_url": "/cache/html/NtePoQrV?cv=26&eh=47bd33893936ece7315060d0b09fe7c9",
"info": "Nemesis by BeaconHill\n65754 words in 14 chapters\nStatus: ongoing\nUpdated: 2023-01-28 - 2 months 7 days ago\n",
"meta": {
"author": "BeaconHill",
"authorId": 2446,
"authorLocalId": "beaconhill.295356",
"authorUrl": "https://forums.spacebattles.com/members/beaconhill.295356/",
"chapters": 14,
"created": "2022-03-05T19:43:19",
"description": "<lt;p>Nemesis<lt;/p><lt;p>Worm AU<lt;/p><lt;p>It was June 2011, and Emma Barnes was the queen bee of her high school…<lt;/p>",
"extraMeta": null,
"id": "NtePoQrV",
"rawExtendedMeta": null,
"source": "https://forums.spacebattles.com/threads/nemesis-worm-au.747148/",
"sourceId": 12,
"status": "ongoing",
"title": "Nemesis",
"updated": "2023-01-28T23:13:19",
"words": 65754
},
"mobi_url": "/cache/mobi/NtePoQrV?cv=26&eh=47bd33893936ece7315060d0b09fe7c9",
"notes": [],
"pdf_url": "/cache/pdf/NtePoQrV?cv=26&eh=47bd33893936ece7315060d0b09fe7c9",
"q": "https://forums.spacebattles.com/threads/nemesis-worm-au.747148",
"slug": "Nemesis_by_BeaconHill-NtePoQrV",
"urlId": "NtePoQrV",
"urls": {
"epub": "/cache/epub/NtePoQrV/Nemesis_by_BeaconHill-NtePoQrV.epub?h=47bd33893936ece7315060d0b09fe7c9",
"html": "/cache/html/NtePoQrV?cv=26&eh=47bd33893936ece7315060d0b09fe7c9",
"mobi": "/cache/mobi/NtePoQrV?cv=26&eh=47bd33893936ece7315060d0b09fe7c9",
"pdf": "/cache/pdf/NtePoQrV?cv=26&eh=47bd33893936ece7315060d0b09fe7c9"
}
}
The response will have "err":0 if the fic was successfully
exported. You can then GET one of the urls fields to (generate
and) download the fic in a particular format:
curl -s -o "ex.epub" "https://fichub.net/cache/epub/NtePoQrV/Nemesis_by_BeaconHill-NtePoQrV.epub?h=47bd33893936ece7315060d0b09fe7c9" ; echo "status: $?"
status: 0
du -h ex.epub ; md5sum ex.epub
129K ex.epub
47bd33893936ece7315060d0b09fe7c9 ex.epub
Requesting metadata
An alternate endpoint is provided if you're simply trying to get
pre-parsed metadata. Call the /api/v0/meta endpoint, passing a
q parameter with the fic in question. Ex:
> curl -s -A "fichub-client/0.0.1 +@iris" https://fichub.net/api/v0/meta?q=https://forums.spacebattles.com/threads/nemesis-worm-au.747148 | jq '.'
{
"author": "BeaconHill",
"authorId": 2446,
"authorLocalId": "beaconhill.295356",
"authorUrl": "https://forums.spacebattles.com/members/beaconhill.295356/",
"chapters": 14,
"created": "2022-03-05T19:43:19",
"description": "<p>Nemesis</p><p>Worm AU</p><p>It was June 2011, and Emma Barnes was the queen bee of her high school…</p>",
"extraMeta": null,
"id": "NtePoQrV",
"rawExtendedMeta": null,
"source": "https://forums.spacebattles.com/threads/nemesis-worm-au.747148/",
"sourceId": 12,
"status": "ongoing",
"title": "Nemesis",
"updated": "2023-01-28T23:13:19",
"words": 65754
}