Skip to content
yanghui edited this page Feb 23, 2014 · 6 revisions

V2EX api

获取所有节点

url: http://www.v2ex.com/api/nodes/all.json

[
    {
        "id" : 1,
        "name" : "babel",
        "url" : "http://www.v2ex.com/go/babel",
        "title" : "Project Babel",
        "title_alternative" : "Project Babel",
        "topics" : 1097,
        
            "header" : "Project Babel \u002D 帮助你在云平台上搭建自己的社区",
        
        
            "footer" : "V2EX 基于 Project Babel 驱动。Project Babel 是用 Python 语言写成的,运行于 Google App Engine 云计算平台上的社区软件。Project Babel 当前开发分支 2.5。最新版本可以从 \u003Ca href\u003D\u0022http://github.com/livid/v2ex\u0022 target\u003D\u0022_blank\u0022\u003EGitHub\u003C/a\u003E 获取。",
        
        "created" : 1272206882
    },
    {
        "id" : 2,
        "name" : "v2ex",
        "url" : "http://www.v2ex.com/go/v2ex",
        "title" : "V2EX",
        "title_alternative" : "V2EX",
        "topics" : 1790,
        
            "header" : "这里讨论和发布关于 V2EX 站点发展。",
        
        
            "footer" : null,
        
        "created" : 1272207021
    },
    ...
]

附:footer可能为null

获取单个节点信息

url: http://www.v2ex.com/api/nodes/show.json?id=2

{
    "id" : 2,
    "name" : "v2ex",
    "url" : "http://www.v2ex.com/go/v2ex",
    "title" : "V2EX",
    "title_alternative" : "V2EX",
    "topics" : 1791,
    
        "header" : "这里讨论和发布关于 V2EX 站点发展。",
    
    
        "footer" : null,
    
    "created" : 1272207021
}

附:footer可能为null

获取最新节点信息

url: http://www.v2ex.com/api/topics/latest.json

[	    
    {
        "id" : 101387,
        "title" : "领导突然安排我明天去相亲,对女方几乎没有了解,求建议或攻略!",
        "url" : "http://www.v2ex.com/t/101387",
        "content" : "之前领导只是跟我提了一下,没想到今晚打电话说明天中午去见面,我只了解到女方比我小2岁,做财会的...\u000D\u000A\u000D\u000A坐标宁波天一\u000D\u000A\u000D\u000A有什么要注意的?求分享!",
        "content_rendered" : "之前领导只是跟我提了一下,没想到今晚打电话说明天中午去见面,我只了解到女方比我小2岁,做财会的...\u003Cbr /\u003E\u003Cbr /\u003E坐标宁波天一\u003Cbr /\u003E\u003Cbr /\u003E有什么要注意的?求分享!",
        "replies" : 0,
        "member" : {
            "id" : 6319,
            "username" : "jasonchao",
            "tagline" : "",
            "avatar_mini" : "//cdn.v2ex.com/avatar/96f2/d606/6319_mini.png?m=1334594475",
            "avatar_normal" : "//cdn.v2ex.com/avatar/96f2/d606/6319_normal.png?m=1334594475",
            "avatar_large" : "//cdn.v2ex.com/avatar/96f2/d606/6319_large.png?m=1334594475"
        },
        "node" : {
            "id" : 12,
            "name" : "qna",
            "title" : "问与答",
            "title_alternative" : "Questions and Answers",
            "url" : "http://www.v2ex.com/go/qna",
            "topics" : 24440,
            "avatar_mini" : "//cdn.v2ex.com/navatar/c20a/d4d7/12_mini.png?m=1365191781",
            "avatar_normal" : "//cdn.v2ex.com/navatar/c20a/d4d7/12_normal.png?m=1365191781",
            "avatar_large" : "//cdn.v2ex.com/navatar/c20a/d4d7/12_large.png?m=1365191781"
        },
        "created" : 1393072232,
        "last_modified" : 1393072232,
        "last_touched" : 1393072052
    },
    ...
]

获取单个主题信息

url: http://www.v2ex.com/api/topics/show.json?id=101387
url: http://www.v2ex.com/api/topics/show.json?username=Livid
url: http://www.v2ex.com/api/topics/show.json?node_id=1

[{

"id" : 101387,
"title" : "领导突然安排我明天去相亲,对女方几乎没有了解,求建议或攻略!",
"url" : "http://www.v2ex.com/t/101387",
"content" : "之前领导只是跟我提了一下,没想到今晚打电话说明天中午去见面,我只了解到女方比我小2岁,做财会的...\u000D\u000A\u000D\u000A坐标宁波天一\u000D\u000A\u000D\u000A有什么要注意的?求分享!",
"content_rendered" : "之前领导只是跟我提了一下,没想到今晚打电话说明天中午去见面,我只了解到女方比我小2岁,做财会的...\u003Cbr /\u003E\u003Cbr /\u003E坐标宁波天一\u003Cbr /\u003E\u003Cbr /\u003E有什么要注意的?求分享!",
"replies" : 6,
"member" : {
    "id" : 6319,
    "username" : "jasonchao",
    "tagline" : "",
    "avatar_mini" : "//cdn.v2ex.com/avatar/96f2/d606/6319_mini.png?m=1334594475",
    "avatar_normal" : "//cdn.v2ex.com/avatar/96f2/d606/6319_normal.png?m=1334594475",
    "avatar_large" : "//cdn.v2ex.com/avatar/96f2/d606/6319_large.png?m=1334594475"
},
"node" : {
    "id" : 12,
    "name" : "qna",
    "title" : "问与答",
    "url" : "http://www.v2ex.com/go/qna",
    "topics" : 24441,
    "avatar_mini" : "//cdn.v2ex.com/navatar/c20a/d4d7/12_mini.png?m=1365191781",
    "avatar_normal" : "//cdn.v2ex.com/navatar/c20a/d4d7/12_normal.png?m=1365191781",
    "avatar_large" : "//cdn.v2ex.com/navatar/c20a/d4d7/12_large.png?m=1365191781"
},
"created" : 1393072232,
"last_modified" : 1393072232,
"last_touched" : 1393073085

}]

获取单个主题回复

url: http://www.v2ex.com/api/replies/show.json?topic_id=101387

[
    {
        "id" : 967462,
        "thanks" : 0,
        "content" : "凡量领导或者来自对你有比较大压力的人介绍的对象,不管合不合适,最好最后都找理由拒绝。\u000D\u000A\u000D\u000A想想看,如果将来谈了一段时间,你想分手,是不是比现在说“不合适“更麻烦?",
        "content_rendered" : "凡量领导或者来自对你有比较大压力的人介绍的对象,不管合不合适,最好最后都找理由拒绝。\u003Cbr /\u003E\u003Cbr /\u003E想想看,如果将来谈了一段时间,你想分手,是不是比现在说“不合适“更麻烦?",
        "member" : {
            "id" : 18737,
            "username" : "kinghenry",
            "tagline" : "",
            "avatar_mini" : "http://9429127371.a.uxengine.net/avatar/9ad117d3872a04893eacba70ae51c007?s=24&d=http%3A%2F%2Fcdn.v2ex.com%2Fstatic%2Fimg%2Favatar_mini.png",
            "avatar_normal" : "http://9429127371.a.uxengine.net/avatar/9ad117d3872a04893eacba70ae51c007?s=48&d=http%3A%2F%2Fcdn.v2ex.com%2Fstatic%2Fimg%2Favatar_normal.png",
            "avatar_large" : "http://9429127371.a.uxengine.net/avatar/9ad117d3872a04893eacba70ae51c007?s=73&d=http%3A%2F%2Fcdn.v2ex.com%2Fstatic%2Fimg%2Favatar_large.png"
        },
        "created" : 1393072516,
        "last_modified" : 1393072516
    },
...
]

获取单个用户信息

url: http://www.v2ex.com/api/members/show.json?id=18737
url: http://www.v2ex.com/api/members/show.json?username=kinghenry

{
    "status" : "found",
    "id" : 18737,
    "url" : "http://www.v2ex.com/member/kinghenry",
    "username" : "kinghenry",
    "website" : "",
    "twitter" : "",
    "location" : "",
    "tagline" : "",
    "bio" : "",
    "avatar_mini" : "http://9429127371.a.uxengine.net/avatar/9ad117d3872a04893eacba70ae51c007?s=24&d=http%3A%2F%2Fcdn.v2ex.com%2Fstatic%2Fimg%2Favatar_mini.png",
    "avatar_normal" : "http://9429127371.a.uxengine.net/avatar/9ad117d3872a04893eacba70ae51c007?s=48&d=http%3A%2F%2Fcdn.v2ex.com%2Fstatic%2Fimg%2Favatar_normal.png",
    "avatar_large" : "http://9429127371.a.uxengine.net/avatar/9ad117d3872a04893eacba70ae51c007?s=73&d=http%3A%2F%2Fcdn.v2ex.com%2Fstatic%2Fimg%2Favatar_large.png",
    "created" : 1332834859
}