GitHub API REST Client(称为 v3)使用起来非常简单
GET https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking
将为您提供您可以在该存储库中查询的所有内容,您将看到这是一个 contents 路径,因此请尝试使用该路径:
GET https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks
然后您可以遍历返回数组并获取每个文件,但是如果您确实需要获取特定文件的原始内容,那么假设对于这个示例,我们需要/hacks/Character/customName.js
GET https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks/Character/customName.js
{
"name": "customName.js",
"path": "hacks/Character/customName.js",
"sha": "77b86151fbc3930d5f11e785333f82adbcc33ebf",
"size": 118,
"url": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks/Character/customName.js?ref=master",
"html_url": "https://github.com/Prodigy-Hacking/ProdigyMathGameHacking/blob/master/hacks/Character/customName.js",
"git_url": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/git/blobs/77b86151fbc3930d5f11e785333f82adbcc33ebf",
"download_url": "https://raw.githubusercontent.com/Prodigy-Hacking/ProdigyMathGameHacking/master/hacks/Character/customName.js",
"type": "file",
"content": "Ly8gQ3VzdG9tIG5hbWUgKENsaWVudCBzaWRlIG9ubHkpLiAoUHV0IHRleHQg\naW4gdGV4dCBoZXJlLikKaGFjay5pbnN0YW5jZS5wcm9kaWd5LnBsYXllci5n\nZXROYW1lID0gKCkgPT4gIlRFWFQgSEVSRSI7Cg==\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/contents/hacks/Character/customName.js?ref=master",
"git": "https://api.github.com/repos/Prodigy-Hacking/ProdigyMathGameHacking/git/blobs/77b86151fbc3930d5f11e785333f82adbcc33ebf",
"html": "https://github.com/Prodigy-Hacking/ProdigyMathGameHacking/blob/master/hacks/Character/customName.js"
}
}
点击download_url会给你
// Custom name (Client side only). (Put text in text here.)
hack.instance.prodigy.player.getName = () => "TEXT HERE";
GitHub Documentation中解释得很好
您现在可以像...一样轻松地循环遍历数据...记住您应该authenticate your calls,否则您将达到 GitHub 限制。