Danbooru

Trouble with the API

Posted under General

Hey there.

First of all i want to apologize for my not so well english :(

Okay here are my questions.

If i make a request like:
http://danbooru.donmai.us/posts.json?tags=swimsuit&limit=100&page=5

http://danbooru.donmai.us/posts.json?tags=swimsuit&limit=100&page=4

once i list up 100 posts from page 5 and once 100 posts from page 4?

but there are never 100posts per page?
How does it count? I could not figure it out ;(

Than i would like to make a request like that with wget (im using Linux)
like:

--------

user@ubustation-01:~/Desktop/$ wget http://danbooru.donmai.us/posts.json?login=Tyc0rc&api_key=abcdefghijklmnopqrstuvwxyz&tags=swimsuit&limit=10&page=2
[1] 14640
[2] 14641
[3] 14642
[4] 14643
[2] Fertig api_key=abcdefghijklmnopqrstuvwxyz
[3]- Fertig tags=swimsuit
user@ubustation-01:~/Desktop/tt$ --2013-06-02 17:29:55-- http://danbooru.donmai.us/posts.json?login=Tyc0rc
Auflösen des Hostnamen »danbooru.donmai.us (danbooru.donmai.us)«... 67.202.114.134, 67.202.114.133
Verbindungsaufbau zu danbooru.donmai.us (danbooru.donmai.us)|67.202.114.134|:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 403 Forbidden
2013-06-02 17:29:55 FEHLER 403: Forbidden.

-------

So i always got a 403 answer?
what im doing wrong?

very thanks for helping me ;)

Greetings

Does that link work in your browser? making sure you are not logged in (so it doesn't go to session). I just tried it with my login name & API key, it seemed to work fine.

http://danbooru.donmai.us/posts.json?tags=swimsuit&limit=100&page=5
http://danbooru.donmai.us/posts.json?tags=swimsuit&limit=100&page=4

once i list up 100 posts from page 5 and once 100 posts from page 4?
but there are never 100posts per page?

I'm not sure what you mean, both those links return 100 posts.

Mhh the link works with my username and login.
It seems that wget have a problem with the format of the link.

But i think i can figure that out by myself.

thanks ;)

Hehe, yeah they return both 100posts but from where?
whats de difference between page 4 and 5?
And how many posts are there on every page?

are there exactly 100posts per page?

greetings

I know nothing of wget so i can't help with that, gl :)

For example, swimsuit has 70085 posts, default sorted by ID.
This is split in pages, either 20 posts per page (default), or you can set it with the "&limit=xx"

"limit=20" -> page 4 has posts 61-80. There are 3,505 pages (70,085/20).
"limit=100" -> page 4 has posts 301-400. There are 701 pages.

itsonlyaname said:

I know nothing of wget so i can't help with that, gl :)

For example, swimsuit has 70085 posts, default sorted by ID.
This is split in pages, either 20 posts per page (default), or you can set it with the "&limit=xx"

"limit=20" -> page 4 has posts 61-80. There are 3,505 pages (70,085/20).
"limit=100" -> page 4 has posts 301-400. There are 701 pages.

Ah okay.
Thanks for that.

But how did you figure out how many posts swimsuit has? :)

You forgot to quote your URL like so:

wget "http://danbooru.donmai.us/posts.json?login=Tyc0rc&api_key=abcdefghijklmnopqrstuvwxyz&tags=swimsuit&limit=10&page=2"

Without the quotes, the shell breaks the URL at every ampersand (the &) and all wget gets is this:

wget http://danbooru.donmai.us/posts.json?login=Tyc0rc

No key, no tag → doesn't work.

The numbers in brackets are an indication that exactly that problem happened:

[1] 14640
[2] 14641
[3] 14642
[4] 14643

Incidentally, there are four ampersands in the URL.

1