[英]How to get github users from city using Github REST API?
I am working on an app and I need to get all the projects of all github users that live in a given city using the GitHub Rest API v3: https://developer.github.com/v3/ 我正在开发一个应用程序,我需要使用GitHub Rest API v3获取生活在给定城市中的所有github用户的所有项目: https : //developer.github.com/v3/
Now I know I can get all the users with the following url: https://api.github.com/users 现在,我知道可以使用以下网址获取所有用户: https : //api.github.com/users
And once I have a user, I can get all his repos and info from there. 一旦有了用户,我就可以从那里获取他的所有回购信息。
The problem is that I don't know how to filter those users by city! 问题是我不知道如何按城市过滤那些用户! I have tried adding a paramter
location=London
but it always returns the same, probably because this is not the real parameter... 我尝试添加一个参数
location=London
但它总是返回相同的结果,可能是因为这不是真正的参数...
Another option would be to get all the github users from the world, and then filter them by city .... which would be totally insane. 另一个选择是从世界上吸引所有github用户,然后按城市筛选他们。
The best option I found so far was to use this link: 到目前为止,我发现的最佳选择是使用此链接:
https://github.com/search?q=language:javascript+location:Barcelona&type=Users https://github.com/search?q=language:javascript+location:Barcelona&type=Users
However, this link is the web version, which does not use the REST API. 但是,此链接是Web版本,不使用REST API。
How do I get all the users from a given city using the Github REST API? 如何使用Github REST API吸引来自指定城市的所有用户?
You are using the /users
endpoint. 您正在使用
/users
端点。 You need to use the /search/users
endpoint: 您需要使用
/search/users
端点:
https://api.github.com/search/users?q=location%3Aiceland
Will search for users located in Iceland 将搜索位于冰岛的用户
Using that gets me a response with a bunch of users and after cross checking the first 3, they all have their location set to "Iceland" in their profiles. 使用该功能,我得到了很多用户的答复,在对前三个用户进行交叉检查后,他们的个人资料都将位置设置为“冰岛”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.