我想使用八盒从github获得所有的回复。
所以我使用throttling、paginateRest和restEndpointMethods插件。
但是,不管我的搜索查询是什么,返回1020的结果最多。
我怎么能得到所有的结果?
const searchQuery = "stars:>1+language:JavaScript";
import { Octokit } from "@octokit/core";
import { throttling } from "@octokit/plugin-throttling";
import { paginateRest } from "@octokit/plugin-paginate-rest";
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
(async () => {
const MyOctokit = Octokit.plugin(
throttling,
paginateRest,
restEndpointMethods
);
const octokit = new MyOctokit({
auth: '..',
headers: {
Accept: "application/vnd.github.preview",
},
throttle: {
onRateLimit: (retryAfter, options, octokit) => {
octokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
);
if (options.request.retryCount === 0) {
// only retries once
octokit.log.info(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onAbuseLimit: (retryAfter, options, octokit) => {
// does not retry, only logs a warning
octokit.log.warn(
`Abuse detected for request ${options.method} ${options.url}`
);
},
},
});
const results = await octokit.paginate(octokit.rest.search.repos, {
q: searchQuery,
});
console.log({ len: results.length }); // --> output 1020. should be much more.
})();发布于 2021-04-20 13:35:12
我不知道如何得到1020,但是医生们声明“GitHub搜索API为每个搜索提供多达1,000个结果”。
这似乎是吉特布设定的一个硬性限制。
https://stackoverflow.com/questions/67179764
复制相似问题