我只能得到前100位用户:
lsoave@ubuntu:~$ curl -i https://api.github.com/users|grep -c login
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 104k 100 104k 0 0 92808 0 0:00:01 0:00:01 --:--:-- 100k
100
lsoave@ubuntu:~$
但我需要完整列表和/ users?page =(其中n从0变为∞)获得相同的100个用户列表:
lsoave@ubuntu:~$ curl -i https://api.github.com/users?page=0 | grep login | tail -10
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 104k 100 104k 0 0 90797 0 0:00:01 0:00:01 --:--:-- 101k
"login": "danielharan",
"login": "kvnsmth",
"login": "collectiveidea",
"login": "canadaduane",
"login": "nate",
"login": "dstrelau",
"login": "sunny",
"login": "dkubb",
"login": "jnicklas",
"login": "richcollins",
lsoave@ubuntu:~$ curl -i https://api.github.com/users?page=1 | grep login | tail -10
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 104k 100 104k 0 0 99k 0 0:00:01 0:00:01 --:--:-- 110k
"login": "danielharan",
"login": "kvnsmth",
"login": "collectiveidea",
"login": "canadaduane",
"login": "nate",
"login": "dstrelau",
"login": "sunny",
"login": "dkubb",
"login": "jnicklas",
"login": "richcollins",
lsoave@ubuntu:~$ curl -i https://api.github.com/users?page=2 | grep login | tail -10
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 104k 100 104k 0 0 95960 0 0:00:01 0:00:01 --:--:-- 104k
"login": "danielharan",
"login": "kvnsmth",
"login": "collectiveidea",
"login": "canadaduane",
"login": "nate",
"login": "dstrelau",
"login": "sunny",
"login": "dkubb",
"login": "jnicklas",
"login": "richcollins",
lsoave@ubuntu:~$ curl -i https://api.github.com/users?page=3 | grep login | tail -10
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 104k 100 104k 0 0 99k 0 0:00:01 0:00:01 --:--:-- 110k
"login": "danielharan",
"login": "kvnsmth",
"login": "collectiveidea",
"login": "canadaduane",
"login": "nate",
"login": "dstrelau",
"login": "sunny",
"login": "dkubb",
"login": "jnicklas",
"login": "richcollins",
答案 0 :(得分:2)
您需要使用since
参数而不是页面
理想情况下,您会获得列表中最后一个用户的id
(在这种情况下,它是 135 )并且您使用该ID进行下一次调用,新响应将包含超过该用户标识的用户
https://api.github.com/users?since=135