Skip to main content
 首页 » 编程设计

api之从 JSON 中的 subreddit 获取新帖子

2024年12月31日12mate10pro

我将如何获得 新品 JSON 中 subreddit 的帖子?只需将 .json 附加到 url (http://www.reddit.com/r/SOME_SUBREDDIT/new.json) 就会返回以下内容:

{ 
    kind: "Listing" 
    - 
    data: { 
        modhash: "" 
        children: [ ] 
        after: null 
        before: null 
    } 
} 

children 数组不包含任何帖子。我来找那个 http://www.reddit.com/r/SOME_SUBREDDIT/new实际上路由到 new?sort=rising 当我需要的是 新?排序=新 .

/new?sort=new.json 当然不会工作。

请您参考如下方法:

.json修饰符应该放在路径组件的末尾,而不是整个 URL。您要查找的网址是:

http://www.reddit.com/r/subreddit/new.json?sort=new