danieltanfh95 / btapi

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

[Enhancement] Add last update timestamp for each chapter #7

Closed Nandaka closed 9 years ago

Nandaka commented 9 years ago

you can query the revisionid and timestamp using this query:

http://www.baka-tsuki.org/project/api.php?action=query&prop=info|revisions&format=json&titles=Zero%20no%20Tsukaima:Volume1%20Illustrations|Zero%20no%20Tsukaima:Volume1%20Insert%20and%20Back%20Cover

You can append multiple titles using pipe character ('|'), but I believe there is a limitation on the total url length. I'm not sure if you can use POST method to overcome this limitation.

if you know the pageid, you can use this: http://www.baka-tsuki.org/project/api.php?action=query&prop=info|revisions&format=json&pageids=1941|1912

which is shorter, but you need to know the page ids beforehand.

danieltanfh95 commented 9 years ago

http://www.baka-tsuki.org/project/api.php?action=query&prop=info%7Crevisions&format=json&titles=Zero_no_Tsukaima

Would it be enough just to know the last revision data for the title?

Nandaka commented 9 years ago

you means the project page? might not be useful, as the page may be updated (e.g. translator name added), but the actual chapter is not, or the other way around.

but then, it may not really useful...

Maybe it is better to create separate API to get the updated timestamp, with input of the titles or pageid.

danieltanfh95 commented 9 years ago

Getting the timestamp of when the chapter is last updated is pretty nice, but I will keep this as a separate API to keep it simple, since the titles list can be obtained from the /api API. The maximum number for bots is 500 separate values to query so I think it's more than enough.

I was thinking that this API can be used for application to show the last updated chapter, like in wenku8's windows app

danieltanfh95 commented 9 years ago

What does the touched property tells us?

Nandaka commented 9 years ago

I think that one related to the wiki caching stuff: http://www.mediawiki.org/wiki/Manual:Page_table#page_touched

it is not related to the actual update timestamp.

danieltanfh95 commented 9 years ago

I used aggregation for this so users can use either both at the same time.

http://btapi-shadowys.ngapp.io/api/time?titles=Zero_no_Tsukaima|Kino_no_Tabi&pageids=1912