How to retrieve the list of all GitHub repositories of a person?

后端 未结 15 1264
一个人的身影
一个人的身影 2020-12-02 05:43

We are working on a project where we need to display all the projects of a person in his repository on GitHub account.

Can anyone suggest, how can I display the na

15条回答
  •  悲哀的现实
    2020-12-02 06:06

    Paging JSON

    The JS code below is meant to be used in a console.

    username = "mathieucaroff";
    
    w = window;
    Promise.all(Array.from(Array(Math.ceil(1+184/30)).keys()).map(p =>
        fetch(`//api.github.com/users/{username}/repos?page=${p}`).then(r => r.json())
    )).then(all => {
        w.jo = [].concat(...all);
        // w.jo.sort();
        // w.jof = w.jo.map(x => x.forks);
        // w.jow = w.jo.map(x => x.watchers)
    })
    

提交回复
热议问题