Coder Social home page Coder Social logo

danbooru-node's People

Contributors

dependabot[bot] avatar puddii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

danbooru-node's Issues

booru.posts sending response data instead of the post.

Heyo, not sure if this project is still active or if it's getting any updates, but I have encountered a bug.

When I call the booru.posts function, I don't get the post object, instead, I get completely useless data.

Data shown below.
[ [Symbol(status)]: 200, [Symbol(data)]: '[]', [Symbol(headers)]: { date: 'Thu, 23 Jan 2020 01:55:32 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '2', connection: 'close', 'set-cookie': [ '__cfduid=dcd8391fbadbe10a1d960aec15fe8a1b51579744532; expires=Sat, 22-Feb-20 01:55:32 GMT; path=/; domain=.donma i.us; HttpOnly; SameSite=Lax', '_danbooru2_session=xc%2FkzAs9W%2F9ht19L8ezVKPK%2B9hZbx8Dn5B4rSFKk%2FBAg0eSFmFrVyX2%2BUUu%2BqFOVQywwobed9vJK4oQh% 2BKWAYVOZWiExJ4iw%2BVHUBWgXW69psoWvMxTSQVe6C867HYZrpFLfKW3cDLHJOywcl7Uyfuh0Iq4WcNO8zefeIy6jBcnHiNVhBn%2FVtsK80VLHF1X1dkM xqJ%2Ba0l5TCWbYezmYKIEdRW76CUHyCnxVDMrj%2FpNPqA2eNwfeo38XXYB8Wx14fq03hZF33rShpftIvtTDEqd1H40%3D--S2XUWEdcw151HU4A--Xi4h2 8XC82R2unrT4zokSg%3D%3D; domain=.donmai.us; path=/; expires=Mon, 23 Jan 2040 01:55:32 GMT; secure; HttpOnly; SameSite=La x' ], 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'x-download-options': 'noopen', 'x-permitted-cross-domain-policies': 'none', 'referrer-policy': 'strict-origin-when-cross-origin', 'access-control-allow-origin': '*', etag: 'W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"', 'cache-control': 'max-age=0, private, must-revalidate', 'x-request-id': '9cf09e8d-c048-4125-8824-51807a2ce647', 'x-runtime': '0.069600', 'cf-cache-status': 'DYNAMIC', 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'alt-svc': 'h3-24=":443"; ma=86400, h3-23=":443"; ma=86400', server: 'cloudflare', 'cf-ray': '5596255f1deb9b12-DFW' } ]

Booru.posts return only 200 elements maximum.

I don't know is it a Danbooru problem itself or this wrapper's one, but when I'm trying to call this:

const Posts = await Booru.posts({
    limit: 1000 
});

I get a JSON array only with 200 elements in it. It's kinda inconvenient when you try to get all the favorites (because one could have more than 1000 favorited pictures).
Screenshot of console with query bellow.

image

authenticated post queries return 404s in the browser

OPTIONS https://danbooru.donmai.us/posts.json?tags=rating%3Asafe&limit=200 404
[ stack ]
index.html#:1 Access to fetch at 'https://danbooru.donmai.us/posts.json?tags=rating%3Asafe&limit=200' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
index.html#:1 Uncaught (in promise) TypeError: Failed to fetch

im not sure if this behaviour is intentional, or a bug. the same code works on the serverside, authenticated or not. however, on the browser, only unauthenticated works. If this isnt intended behaviour, this also might not be a problem with the library, but rather danbooru itself not allowing other domains via CORS.

posts array sometimes false?

I have this code

				console.log(posts instanceof Array);
				const newPosts = posts.filter(item => item !== undefined);
				const index = Math.floor(Math.random() * newPosts.length);
				const post = newPosts[index]; 
				const url = booru.url(post.file_url)
  				const name = `${post.md5}.${post.file_ext}`
				if (post.file_ext == ".mp4") {
					msg.edit(url);
					return;
				}

And it works most of the time but sometimes console.log(posts instanceof Array); returns false instead of true, And then i get an undefined response! Please help me

`file_url` and `large_file_url` always 403 when on danbooru.donmai.us

Images loaded from raikou1, raikou2, etc. always load properly, however, when a link is from danbooru.donmai.us, it fails with a 403.

Going to the image links manually work fine, but never in the page, with an img tag or background: url(). This may well be out of scope for this project, as im realizing this is a common issue with others who implement the API, like the hover zoom extension Imagus.

Edit: the ?idk=0.93458673945 is for cache busting, while i was tesing the error, and has no effect on the results. images that 403 are consistent in their behaviour

image

Missing file_url on posts with censored tags

Currently, this causes a 404 when trying to use post.get() and similar functions, because it tries to access a url containing 'undefined'. It should probably produce an error instead of leaving people confused about why they're downloading a html error file instead of the images they were expecting.

Add a 'scrolling' option to get all pages

As far as I know, the API currently returns a maximum of 200 posts per page. I think an option that recursively gets all the posts on all pages and merges them into a single array would be great.

Get image URL

Hi,

Can you search for an image using the npm package then return the image's URL instead of downloading it? If so, how?

Thanks

[Reserved]

The issue that was here is now #2, and I'm reserving this issue for future use!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.