Hacker News API中的URI和版本

API都由https://hacker-news.firebaseio.com提供。

单个条目信息

故事,评论,招聘,问答,以及投票都叫做条目。它们有各自唯一的ID,是不相互重复的整数形式,接口地址是: https://hacker-news.firebaseio.com/v0/item/.

所有的条目都共有下面的属性:

属性 描述
id The item’s unique id. Required.
deleted true if the item is deleted.
type The type of item. One of “job”, “story”, “comment”, “poll”, or “pollopt”.
by The username of the item’s author.
time Creation date of the item, in Unix Time.
text The comment, Ask HN, or poll text. HTML.
dead true if the item is dead.
parent The item’s parent. For comments, either another comment or the relevant story. For pollopts, the relevant poll.
kids The ids of the item’s comments, in ranked display order.
url The URL of the story.
score The story’s score, or the votes for a pollopt.
title The title of the story or poll.
parts A list of related pollopts, in display order.

举例说明,一个故事的数据结构是这样的:: https://hacker-news.firebaseio.com/v0/item/8863.json?print=pretty

{
"by" : "dhouston",
"id" : 8863,
"kids" : [ 8952, 9224, 8917, 8884, 8887, 8943, 8869, 8958, 9005, 9671, 8940, 9067, 8908, 9055, 8865, 8881, 8872, 8873, 8955, 10403, 8903, 8928, 9125, 8998, 8901, 8902, 8907, 8894, 8878, 8870, 8980, 8934, 8876 ],
"score" : 111,
"time" : 1175714200,
"title" : "My YC app: Dropbox - Throw away your USB drive",
"type" : "story",
"url" : "http://www.getdropbox.com/u/2/screencast.html"
}

而评论的是: https://hacker-news.firebaseio.com/v0/item/2921983.json?print=pretty

{
"by" : "norvig",
"id" : 2921983,
"kids" : [ 2922097, 2922429, 2924562, 2922709, 2922573, 2922140, 2922141 ],
"parent" : 2921506,
"text" : "Aw shucks, guys ... you make me blush with your compliments.<p>Tell you what, Ill make a deal: I'll keep writing if you keep reading. K?",
"time" : 1314211127,
"type" : "comment"
}

投票的是: https://hacker-news.firebaseio.com/v0/item/126809.json?print=pretty

{
"by" : "pg",
"id" : 126809,
"kids" : [ 126822, 126823, 126993, 126824, 126934, 127411, 126888, 127681, 126818, 126816, 126854, 127095, 126861, 127313, 127299, 126859, 126852, 126882, 126832, 127072, 127217, 126889, 127535, 126917, 126875 ],
"parts" : [ 126810, 126811, 126812 ],
"score" : 46,
"text" : "",
"time" : 1204403652,
"title" : "Poll: What would happen if News.YC had explicit support for polls?",
"type" : "poll"
}

相关信息:https://hacker-news.firebaseio.com/v0/item/160705.json?print=pretty

{
"by" : "pg",
"id" : 160705,
"parent" : 160704,
"score" : 335,
"text" : "Yes, ban them; I'm tired of seeing Valleywag stories on News.YC.",
"time" : 1207886576,
"type" : "pollopt"
}

用户

用户的ID是区分大小写的,接口地址是 https://hacker-news.firebaseio.com/v0/user/.

举例说明: https://hacker-news.firebaseio.com/v0/user/jl.json?print=pretty

{
"about" : "This is a test",
"created" : 1173923446,
"delay" : 0,
"id" : "jl",
"karma" : 2937,
"submitted" : [ 8265435, 8168423, 8090946, 8090326, 7699907, 7637962, 7596179, 7596163, 7594569, 7562135, 7562111, 7494708, 7494171, 7488093, 7444860, 7327817, 7280290, 7278694, 7097557, 7097546, 7097254, 7052857, 7039484, 6987273, 6649999, 6649706, 6629560, 6609127, 6327951, 6225810, 6111999, 5580079, 5112008, 4907948, 4901821, 4700469, 4678919, 3779193, 3711380, 3701405, 3627981, 3473004, 3473000, 3457006, 3422158, 3136701, 2943046, 2794646, 2482737, 2425640, 2411925, 2408077, 2407992, 2407940, 2278689, 2220295, 2144918, 2144852, 1875323, 1875295, 1857397, 1839737, 1809010, 1788048, 1780681, 1721745, 1676227, 1654023, 1651449, 1641019, 1631985, 1618759, 1522978, 1499641, 1441290, 1440993, 1436440, 1430510, 1430208, 1385525, 1384917, 1370453, 1346118, 1309968, 1305415, 1305037, 1276771, 1270981, 1233287, 1211456, 1210688, 1210682, 1194189, 1193914, 1191653, 1190766, 1190319, 1189925, 1188455, 1188177, 1185884, 1165649, 1164314, 1160048, 1159156, 1158865, 1150900, 1115326, 933897, 924482, 923918, 922804, 922280, 922168, 920332, 919803, 917871, 912867, 910426, 902506, 891171, 807902, 806254, 796618, 786286, 764412, 764325, 642566, 642564, 587821, 575744, 547504, 532055, 521067, 492164, 491979, 383935, 383933, 383930, 383927, 375462, 263479, 258389, 250751, 245140, 243472, 237445, 229393, 226797, 225536, 225483, 225426, 221084, 213940, 213342, 211238, 210099, 210007, 209913, 209908, 209904, 209903, 170904, 165850, 161566, 158388, 158305, 158294, 156235, 151097, 148566, 146948, 136968, 134656, 133455, 129765, 126740, 122101, 122100, 120867, 120492, 115999, 114492, 114304, 111730, 110980, 110451, 108420, 107165, 105150, 104735, 103188, 103187, 99902, 99282, 99122, 98972, 98417, 98416, 98231, 96007, 96005, 95623, 95487, 95475, 95471, 95467, 95326, 95322, 94952, 94681, 94679, 94678, 94420, 94419, 94393, 94149, 94008, 93490, 93489, 92944, 92247, 91713, 90162, 90091, 89844, 89678, 89498, 86953, 86109, 85244, 85195, 85194, 85193, 85192, 84955, 84629, 83902, 82918, 76393, 68677, 61565, 60542, 47745, 47744, 41098, 39153, 38678, 37741, 33469, 12897, 6746, 5252, 4752, 4586, 4289 ]
}

实时数据

Firebase最酷的地方是支持实时数据更新通知。你可以订阅条目信息,这时你可以观察它们在首页的名次,那些新条目出现,或新的用户信息更新。

获取排名前100条信息

获取最新的排名前100条的API是这里: https://hacker-news.firebaseio.com/v0/topstories.

举例说明: https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty

当前最大ID

获取当前最大ID的接口地址是 https://hacker-news.firebaseio.com/v0/maxitem.

举例说明: https://hacker-news.firebaseio.com/v0/maxitem.json?print=pretty

获取条目和用户的变更信息

接口地址是这里: https://hacker-news.firebaseio.com/v0/updates.

例如:https://hacker-news.firebaseio.com/v0/updates.json?print=pretty

Hacker News API的更多相关文章

  1. python中的API学习

    URL: url是统一资源定位符,对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示,是互联网上标准资源的地址.互联网上的每个文件都有一个唯一的URL,它包含的信息指出文件的位置以及浏览器应该 ...

  2. 书籍推荐Python编程:从入门到实践(高清完整pdf)

    这本书我看了电子版的,感觉还不错,全书共有20章,书中的简介如下: 本书旨在让你尽快学会 Python ,以便能够编写能正确运行的程序 -- 游戏.数据可视化和 Web 应用程序,同时掌握让你终身受益 ...

  3. 月薪3万的python程序员都看了这本书

    想必大家都看过吧 Python编程从入门到实践 全书共有20章,书中的简介如下: 本书旨在让你尽快学会 Python ,以便能够编写能正确运行的程序 —— 游戏.数据可视化和 Web 应用程序,同时掌 ...

  4. The Road to learn React书籍学习笔记(第四章)

    高级React组件 本章将重点介绍高级 React 组件的实现.我们将了解什么是高阶组件以及如何实现它们.此外,我们还将深入探讨 React 中更高级的主题,并用它实现复杂的交互功能. 引用 DOM ...

  5. The Road to learn React书籍学习笔记(第三章)

    The Road to learn React书籍学习笔记(第三章) 代码详情 声明周期方法 通过之前的学习,可以了解到ES6 类组件中的生命周期方法 constructor() 和 render() ...

  6. Python 频繁请求问题: [Errno 104] Connection reset by peer

    Table of Contents 1. 记遇到的一个问题:[Errno 104] Connection reset by peer 记遇到的一个问题:[Errno 104] Connection r ...

  7. 用React & Webpack构建前端新闻网页

    这是一篇给初学者的教程, 在这篇教程中我们将通过构建一个 Hacker News 的前端页面来学习 React 与 Webpack. 它不会覆盖所有的技术细节, 因此它不会使一个初学者变成大师, 但希 ...

  8. Checking Types Against the Real World in TypeScript

    转自:https://www.olioapps.com/blog/checking-types-real-world-typescript/ This is a follow-up to Type-D ...

  9. Python编程:从入门到项目实践高清版附PDF百度网盘免费下载|Python入门编程免费领取

    百度网盘:Python编程:从入门到项目实践高清版附PDF免费下载 提取码:oh2g   第一部分 基础知识第1章 起步 21.1 搭建编程环境 21.1.1 Python 2和Python 3 21 ...

随机推荐

  1. 002. Asp.Net Routing与MVC 之(基础知识):HttpModule 与 HttpHandler

    本文By 杨工. 一. Http.sys http.sys 从Win2003和WinXP SP2开始,就成为windows操作系统内核驱动程序,能够让任何应用程序通过它提供的接口,以http协议进行信 ...

  2. eclipse svn 忽略 target目录

    这个build失败的解决方案就是不要把你项目的 target目录放在src repository 里面,还有 .project 和 .classpath最好也别放到src repository 里. ...

  3. ACM学习<3>

    排序算法:      基本:冒泡,快速,选择,堆,插入,shell      多路并归: 1.冒泡排序:      思想:交换排序,通过相邻的交换来达到排序的目的.      流程:         ...

  4. Percona 数据库

    1. Percona介绍 Percona Server由领先的MySQL咨询公司Percona发布. Percona Server是一款独立的数据库产品,其可以完全与MySQL兼容,可以在不更改代码的 ...

  5. 前端通信:ajax设计方案(十)--- 完善Promise A+规范,增加mock数据功能

    半年不迭代,迭代搞半年,说的就是我,这里有点尴尬了,直接进入主题吧 我记得在这篇博客的时候集成了Promise的,不过那个时候就简简单单的写了一点最基础,在一些特殊的case上,还是有点问题的,所以才 ...

  6. maven package,clean,install,compile命令

    1.Ideal中显示 2.各个阶段干嘛的? compile,编译命令,会在项目路径下生成一个target目录,在该目录中包含一个classes文件夹,里面全是生成的class文件及字节码文件 pack ...

  7. vue 周期函数

    先简单说说vue中周期函数 beforeCreate(创建前) created(创建后) beforeMount(载入前) mounted(载入后) beforeUpdate(更新前) updated ...

  8. mybatis教程之原理剖析

    MyBatis是目前非常流行的ORM框架,功能很强大,然而其实现却比较简单.优雅.本文通过代理的方式来看下其实现 方式一:传统API方式 @Test public void add() throws ...

  9. js中的模块化

    前阵子一直忙着找实习,发现已经有一段时间没写博客了,面试很多时候会被问到模块化,今天就让我们一起来总结下把 一.什么是模块化 在js出现的时候,js一般只是用来实现一些简单的交互,后来js开始得到重视 ...

  10. openssl x509(签署和自签署)

    openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 主要用于输出证书信息,也能够签署证书请求文件.自签署.转换证书格式等. op ...