nineapi
nineapi copied to clipboard
Unable to access sections other than 'hot' and 'trending'
Hey,
unfortunately I am unable to access different sections like 'fresh'. The get_posts() function is just working for the 'hot' and 'trending' section.
Trying to access a different section gives me the following reply:
"{\"meta\":{\"timestamp\":1519333793,\"status\":\"Failure\",\"sid\":\":IDWBRXTUNWeMRVRywEVRdHTUFVY\",\"errorMessage\":\"\",\"errorCode\":\"invalidListType\"},\"data\":{\"dummyField\":\"dummyValue\"}}"
It reports about an 'invalidListType' argument. Do you know which query argument is missing and what are the syntax and semantics of it?
Meanwhile I had a look at this issue and figured it out:
The 9GAG sections are not primarily selected with the type
attribute but with the group
attribute. Each 9GAG section corresponds to a specific group
id and the type
attribute selects between different sections inside a group, if the group contains several sections. Most groups differentiate the 'hot' and 'vote' subsections (selected with the type
attribute).
The first section group (group=1
) contains three sections and the type attribute selects between 'hot', 'trending' and 'vote' (which actually corresponds to the 'fresh' section).
So to access the 'Fresh' section you need to send the request with the following url query:
group=1&type=vote&itemCount=10&entryTypes=animated,photo,video,album&offset=10
and to get the post data from the 'Comic' section you need the following query:
group=17&type=hot&itemCount=10&entryTypes=animated,photo,video,album&offset=10
.
To get the data (group id, etc.) for all the 9GAG sections (excluding 'hot', 'trending' and 'fresh') you can send a request to the following API path:
/v2/group-list?entryTypes=animated,photo,video,article&locale=en_US
.