是否有可能在Github中获得开发人员的国家名称
Is it possible to get country name of the developers in Github?
我需要查询来自不同国家的开发人员进行研究,但我无法获得开发人员的国家名称,如下所示:
"location": "xxx, China"
我在哪里可以得到所有的国家名称在Github?
根据@Tim Biegeleisen的建议,我向Github发出GET请求:
var theUrl = "https://api.github.com/search/users?q=location:china";
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
var reponseJson = xmlHttp.responseText;
obj = JSON.parse(reponseJson);
// Print obj
根据GitHub API, /users
返回的响应不同于单个/user
请求。这样做可能是为了节省带宽,但也考虑到在显示多个值的页面中可能不需要位置信息和其他属性。
根据文档/users
请求中可用的属性如下:
{
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
如果您需要几个用户的位置数据,但数量很少,似乎最好的方法是逐页查询/users
,并通过单独请求每个用户来映射到完整的用户数据。
来源:
- GitHub Users API
我在哪里可以得到所有的国家名称在Github?
来自文档:
location
根据用户配置文件中显示的位置对用户进行筛选。
GitHub用户配置文件中的位置字段是可选的,并且是自由的。尽管我住在加拿大,但我现在可以把我的设置为"中国"。或者将其设置为"或"参宿四"。
根据你所做的研究类型,你可能不想依赖GitHub提供的位置数据。
相关文章:
- Chrome开发工具(如何知道我在调用哪个javascript对象)
- 谷歌放置API:按国家或餐馆名称搜索餐馆
- Webpack开发服务器和React服务器端渲染
- 表达式引擎扩展开发-向呈现的条目添加自定义javascript
- 州和城市选择框类似于国家细分页面
- 显示每个国家的传单地图
- JavaScript滚动脚本-在测试中激发,而不是在开发站点上
- Possibile使用Manifest v2下的HTML5地理位置API将lat/long转换为国家/地区
- Html/Javascript-如何屏蔽除英国以外的所有欧盟国家,并允许所有非欧盟国家
- webpack开发模式和生产构建模式之间有什么区别
- 开发第三方小部件-Angular vs jQuery vs普通的旧JS
- index.html使用webpack开发服务器未重新加载
- Chrome开发工具中使用了哪些框架和库
- 如何在Chrome中找到JSON后将其放入我的应用程序's开发人员工具
- 为第一次尝试Javascript的经验丰富的开发人员提供建议
- mozilla插件的开发
- `当使用箭头函数时,“开发工具”中未定义“this”
- json格式的国家数据到层次数据
- 谷歌将广告超链接映射到国家标记
- 是否有可能在Github中获得开发人员的国家名称