获取github存储库中的所有子文件路径 [英] get all the sub file paths in a github repository

查看:117
本文介绍了获取github存储库中的所有子文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在使用github api(V3).我想在当前提交的主仓库中获取所有文件和子文件的列表.

I've been playing around with the github api (V3) recently. I would like to get a list of all files and sub files in the primary repo of the current commit.

我可以跑步

https://api.github.com/repos/elasticsearch/elasticsearch/contents /

并发送更多请求以对目录进行爬网.但是文档提到我可以使用

and send many more requests to crawl the directories. However the documentation mentions that I could use the tree api to get all the results. But

https://api.github.com/repos/elasticsearch /elasticsearch/contents/?recursive = 1

返回相同的内容.我可以在一个请求中获得所有文件路径吗?

returns the same contents. Can I get all the file paths in a single request?

推荐答案

您需要向此端点发出请求:

You need to make a request to this endpoint:

https://developer.github.com/v3 /git/trees/#get-a-tree-recursively

因此,尝试一下:

https://api.github.com/repos/elasticsearch/elasticsearch/git/trees/master?recursive = 1

这篇关于获取github存储库中的所有子文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆