Go to file
Millennium Earl b0ce179e73
Merge pull request #84 from MillenniumEarl/2.0.0-ts
2.0.0 ts
2021-03-22 15:08:29 +01:00
.github Delete npm-publish.yml 2020-11-30 10:55:35 +01:00
.vscode Ignore internal scripts in debug 2021-03-11 22:12:34 +01:00
src Add method for changelog parse 2021-03-22 14:50:12 +01:00
test Update prettier printWidth 2021-03-15 15:39:26 +01:00
.eslintignore Configure ESLint and Prettier 2021-03-04 12:26:32 +01:00
.eslintrc Update rules 2021-03-04 13:13:50 +01:00
.gitattributes Initial commit 2020-09-26 13:37:43 +02:00
.gitignore Update .gitignore 2021-02-16 10:16:13 +01:00
.npmignore Update .npmignore 2021-03-08 12:07:09 +01:00
.prettierrc Change printWidth to 100 2021-03-15 15:38:19 +01:00
LICENSE Update license year 2021-03-04 13:19:41 +01:00
README.md Removed DeepSource badge 2021-03-04 10:47:23 +01:00
package-lock.json Remove @types/lodash 2021-03-11 16:16:21 +01:00
package.json Remove @types/lodash 2021-03-11 16:16:21 +01:00
tsconfig.json Remove external script for types, change module target 2021-03-08 12:16:39 +01:00

README.md

CodeFactor FOSSA Status Known Vulnerabilities codecov npm

F95API

Unofficial Node JS module for scraping F95Zone platform

These APIs have been developed to support this application and allow you to obtain data on games and mods on the platform F95zone (NSFW)

A simple usage example can be found in app/example.js

Attention: Two-factor authentication is not supported

Data scraping

Games/mods can be obtained by name or URL

// The name is case insensitive
let listOfFoundGames = await F95API.getGameData("your game name");
let listOfFoundMods = await F95API.getGameData("your mod name", true);

let specificGame = await F95API.getGameDataFromURL("the URL of your game");

While user data (after authenticating) with

let authResult = await F95API.login(username, password);

let loggedUserData = await F95API.getUserData();

Classes

Games and mods

Information about games and mods is stored in a GameInfo object with the following fields:

name: The game name
author: The game developer
url: The URL that leads to the game thread on F95Zone
overview: Description of the game
language: Main language of the game
supportedOS: List of supported OS (Windows/Linux/Mac/Android...)
censored: Are the NSFW parts censored?
engine: Game engine (Unity, Ren'Py, RPGM...)
status: Completed/Abandoned/Ongoing/Onhold
tags: List of tags
previewSrc: Source URL of the game description image
version: Version of the game
lastUpdate: Date of the last update (it's a Date object)
isMod: Is it a game or a mod?
changelog: Latest changelog available

The serialization in JSON format of this object is possible through JSON.stringify() while the deserialization must happen through the static method GameInfo.fromJSON().

User data

User data (after authentication) can be stored in a UserProfile object, consisting of the following fields:

username: Name of the logged in user
avatarSrc: Source URL of the user's profile picture
watchedGameThreads: List of URLs of threads followed by the user

Login results

The outcome of the authentication process is represented by the LoginResult object:

success: Was the authentication successful?
message: Possible error message (unrecognized user, wrong password...) 
         or authentication successful message

Logging

To log the behavior of the application log4js is used with a default level of "warn". This option can be changed with the loggerLevel property.

Guidelines for errors

  • If you can, return a meaningful value
  • Return null only if the function should return a complex object (including strings)
  • Return an empty array if the function should return an array
  • Return false, -1 when the function should return boolean or number
  • Throw an exception only if it is an error or if a wrong value could mess up the functioning of the library