[英]Using GitHub API to retrieve files with specific extension
我想從給定的git倉庫中獲取文件列表。 例如,我想從給定的git存儲庫中獲取所有* .js文件。 如何使用GitHub API滿足上述要求? 還是有什么方法可以從git存儲庫中獲取* .js文件列表?
在這里,我做了什么以找出我自己的存儲庫中的所有.js文件。
curl -i "https://api.github.com/search/code?q=extension:js+repo:vnation/NewsAggregator"
來源: https : //developer.github.com/v3/search/#search-code
編輯
這是我在回購的master分支中查找“ .classpath”文件的路徑所要做的。
curl -i "https://api.github.com/repos/vnation/NewsAggregator/contents/.classpath"
消息來源: https : //developer.github.com/v3/repos/contents/#get-contents
但是 ,git以上的API響應具有base64編碼的內容。 因此,要獲取原始數據,應使用以下一項。
curl -i "https://raw.githubusercontent.com/vnation/NewsAggregator/master/.classpath"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.