Github API文檔給出filter repositories by topics的說明。 有沒有辦法使用API從特定的回購中獲取主題?Github API:獲取Github存儲庫的主題
3
A
回答
3
我不知道有一種方法可以獲取存儲庫的主題,但是如果您執行get for a repository,則返回的存儲庫json對象將具有topic屬性,該屬性是該存儲庫主題的數組。
在文檔的該頁面的頂部,你會發現,爲了有返回的主題,你需要在你的GET
請求添加特定的標題:"Accept":"application/vnd.github.mercy-preview+json"
希望這有助於!
3
查詢做到這一點:
{
repository(owner: "twbs", name: "bootstrap") {
repositoryTopics(first: 10) {
edges {
node {
topic {
name
}
}
}
}
}
}
這將返回第10個主題和名稱各如下圖所示。
響應:
{
"data": {
"repository": {
"repositoryTopics": {
"edges": [
{
"node": {
"topic": {
"name": "css"
}
}
},
{
"node": {
"topic": {
"name": "bootstrap"
}
}
},
{
"node": {
"topic": {
"name": "javascript"
}
}
},
{
"node": {
"topic": {
"name": "html"
}
}
}
]
}
}
}
}
1
我面臨着類似的問題,所以我由節點模塊僅需要一行代碼做是
var github_topics = require('github-topics');
var topics = github_topics.gettopics('url_of_repo');
例如
var topics = github_topics.gettopics('https://github.com/Aniket965/blog');
它會retu該github存儲庫的主題數組,該節點模塊的鏈接是NPM
相關問題
- 1. 如何獲取Github存儲庫問題?
- 2. Github API存儲庫權限
- 3. Github存儲庫
- 4. 無法通過github API獲取所有存儲庫API
- 5. 獲取GitHub存儲庫的存儲庫默認分支
- 6. 通過github API獲取存儲庫的所有者
- 7. GitHub Api:如何獲取存儲庫的根目錄:tree_sha?
- 8. GitHub,創建新的存儲庫(Github API令牌)
- 9. github api獲取主人的SHA
- 10. github合併起源和主存儲庫
- 11. 使用GitHub存儲庫的Hudson問題
- 12. 從API創建Github存儲庫
- 13. Github API列表來源儲存庫
- 14. 如何通過github API在github中創建存儲庫?
- 15. UseStatusCodePagesWithReExecute的GitHub存儲庫?
- 16. github上的git存儲庫
- 17. github:存儲庫與存儲庫
- 18. 如何使用GitHub API獲取GitHub倉庫的分叉數量?
- 19. 如何通過github api獲取趨勢github庫的列表?
- 20. 克隆GitHub存儲庫時SourceTree問題
- 21. GitHub GraphQL讀取存儲庫內容
- 22. 允許Github組織讀取存儲庫
- 23. 恢復github存儲庫
- 24. Sparkjava框架github存儲庫
- 25. 推送到github存儲庫
- 26. 初始github存儲庫
- 27. 克隆存儲庫到GitHub
- 28. Github:找不到存儲庫
- 29. 如何將github存儲庫的內容添加到另一個github存儲庫?
- 30. 獲取庫的Github上
將微依賴性帶到一個全新的水平! ;) –