danieltanfh95 / btapi

baka tsuki api clean up
http://btapi-shadowys.rhcloud.com/
8 stars 5 forks source link

[Feature] Get the list of available light novels #1

Closed Nandaka closed 9 years ago

Nandaka commented 9 years ago

Need an API to fetch the list of novels based on the language and the type.

First you need to get the language category (or you can hardcoded it) http://www.baka-tsuki.org/project/index.php?title=Category:Language

For the type, I think you can hard-coded to:

Then you can get the light novel list from the page: http://www.baka-tsuki.org/project/index.php?title=Category:Teaser_(English)

Special notes on original novel: http://www.baka-tsuki.org/project/index.php?title=Category:Original_novel

danieltanfh95 commented 9 years ago

Should the end JSON look like this example:

{
  type: "Light novel",
  language: "English",
  titles: [
              Zero_No_Tsukaima,
              Date_A_Live
            ]
}
Nandaka commented 9 years ago

It is better to add the actual title too, not only the page id (the wiki page with _) as sometimes there are multiple alias/redirect to the same page title.

{
  type: "Light novel",
  language: "English",
  titles: [
              { "Zero_No_Tsukaima": "Zero no Tsukaima" },
              { "Date_A_Live" : "Date a Live" }
            ]
}

or with data structure for easy parsing.

{
  type: "Light novel",
  language: "English",
  titles: [
              { page: "Zero_No_Tsukaima", title: "Zero no Tsukaima" },
              { page: "Date_A_Live", title: "Date a Live" }
            ]
}
danieltanfh95 commented 9 years ago

Should both options be present at the same time or would one be optional?

Nandaka commented 9 years ago

No, just provide either one. It is better to have standardized api.

Personally, I prefer the 2nd one.

danieltanfh95 commented 9 years ago

I've done both, but to keep things simple for the 2nd one, it only provides the types available for a particular language, or the languages available for a particular type, which the application can then plug back into the original API.

Nandaka commented 9 years ago

Found the wiki api for this one: http://www.baka-tsuki.org/project/api.php?action=query&prop=info|revisions&generator=categorymembers&gcmlimit=500&gcmtype=page&format=json&gcmtitle=Category:Light_novel_(English)

it got the actual pageid and the lastrevid, which is good for checking any for updates...

do you want to call to this api and transform it to given format?

danieltanfh95 commented 9 years ago

Thanks. I was wondering how could we get the last revised date... May I know can the pageid be utilised? I think I will switch the type&lang url to this one for the lastrevid.

Nandaka commented 9 years ago

last revised date

use the timestamp from the revision node

pageid

should use it, as the page title might be changed, but the id will not.

danieltanfh95 commented 9 years ago

For the last revised date, is it relative to the server or?

Nandaka commented 9 years ago

it is using zulu timezone or in other word UTC+0

"timestamp": "2014-09-28T05:53:12Z"

if possible, use the same format.

danieltanfh95 commented 9 years ago

I think I will preserve the timestamp and leave it to the dev to parse it according to their liking.

http://btapi-shadowys.ngapp.io/api/category?type=LIGHT_NOVEL&language=ARABIC