
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
JavaScript bindings for Philomena JSON API. Supports sites such as Derpibooru and Furbooru.
JavaScript bindings for Philomena JSON API. Supports sites such as Derpibooru and Furbooru.
You can install this package from npm:
npm install dinky.js
Or with yarn:
yarn add dinky.js
Dinky implements individual class for each API resourse to build a request. All requests will return a Promise that resolves data taken from API.
import {Images} from "dinky.js"
const images = new Images()
// The following request will return the 1th uploaded image from Derpibooru.
// Equivalent to https://derpibooru.org/api/v1/json/images/0 request
images.getById(0).then(console.log)
Search
class:import {Search} from "dinky.js"
const search = new Search()
// You can specify tags right in the .query() method
// The following example is equivalent of this requests:
// https://derpibooru.org/api/v1/json/search/images?q=artist:rainbow,safe&sf=random&per_page=1
search.query(["artist:rainbow", "safe"]).random().limit(1)
.then(console.log)
import {Search} from "dinky.js"
const search = new Search({url: "https://furbooru.org"})
search.query(["safe", "loona"]).then(console.log)
import {Search} from "dinky.js"
const search = new Search()
search
.query(["scootaloo", "princess luna", "safe", "sleepless in ponyville"])
.minScore(200)
.random()
.limit(1)
// Will search for random image with parameters from above
await search
// ...and once more
await search
.page()
method. Note that after each .page()
call you have to send a new request to API:import {Search} from "dinky.js"
const search = new Search()
serch.query("twilight sparkle").minScore(200)
// Search class is thenable, so you don't have to call `.exec()`,`.then()` and `.catch()` methods to commit a request.
// By default, will API will return results from the first page
await search
// Results for 2nd page
await search.page(2)
import {Search} from "dinky.js"
const search = new Search({filter: 37430})
search.query(["dinky", "derpy hooves"])
await search.exec()
// You can also set per-request filter from .exec() method
await search.exec({filter: 100073})
import {Search} from "dinky.js"
const search = new Search({key: "<your key here>"})
search.query(["trixie", "safe"]).faves()
.then(console.log)
class Images > Entities
constructor() -> {Images}
Creates a request handler for /api/v1/json/images
getById(id) -> {Promise<object>}
Returns an image with given ID
featured() -> {Promise<object>}
Returns featured image
class Comments > Entities
constructor() -> {Comments}
Creates a request handler for /api/v1/json/comments
.
getById(id) -> {Promise<object>}
Returns a comment with given ID
class Tags > Entities
constructor() -> {Tags}
Creates a request handler for /api/v1/json/tags
.
getById(id) -> {Promise<object>}
Returns a tag with given ID
class Profiles > Entities
constructor() -> {Profiles}
Creates a request handler for /api/v1/json/tags
.
getById(id) -> {Promise<object>}
Returns a user with given ID
class Search > Request
constructor() -> {Search}
Creates a request handler for /api/v1/json/search
.
query([list]) -> {Search}
Appends list of query params to the current search request.
This method will not apply the q=
parameter to if called without arguments.
faves() -> {Search}
Sets my:faves param to the search request.
Note that this method requires user's key.
watched() -> {Search}
Sets my:watched param to the search request.
Note that this method requires user's key.
upvotes() -> {Search}
Sets my:upvotes param to the search request.
Note that this method requires user's key.
downvotes() -> {Search}
Sets my:downvotes param to the search request.
Note that this method requires user's key.
uploads() -> {Search}
Sets my:uploads param to the search request.
Note that this method requires user's key.
favedBy(user) -> {Search}
Search for images faved by given user.
uploadedBy(user) -> {Search}
Search for images uploaded by given user.
limit(value) -> {Search}
Specifies how many images per page should API return
minScore(value) -> {Search}
Sets the minimal score of requested images.
maxScore(value) -> {Search}
Sets the maximal score of requested images
random() -> {Search}
Sets the "sf" parameter to "random"
class Entities > Request
constructor() -> {Entities}
Creates an Entity providing a few common methods for Images
, Comments
and Tags
getById(id) -> {Promise<object>}
Finds an entity by given ID
class Request
constructor() -> {Request}
Creates a new request handler.
Sets images ordering to descending
page(offset) -> {Request}
Sets the page offset
exec([options]) -> {Promise<object>}
Executes current request.
then(onFulfilled, onRejected) -> {Promise<object>}
This method takes up to two arguments: callback functions for the success and failure cases of the Promise. See Promise#then() documentation for more info.
catch(onRejected) -> {Promise<any>}
This method returns a Promise and deals with rejected cases only. See Promise#catch() documentation for more info.
class NetworkError > Error
constructor() -> {NetworkError}
This class can be used to check if network error was thrown.
response -> {Response}
Returns a Response
object.
url -> {string}
Contains the URL of the response.
status -> {number}
Contains the status code of the response (e.g., 200
for a success
).
statusText -> {string}
Contains the status message corresponding to the status code (e.g., OK
for 200
).
FAQs
JavaScript bindings for Philomena JSON API. Supports sites such as Derpibooru and Furbooru.
The npm package dinky.js receives a total of 1 weekly downloads. As such, dinky.js popularity was classified as not popular.
We found that dinky.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.