Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Ground Controller Lvl 1
Message 1 of 4

API is very confusing by listing Stars count for Watchers count on all repos

Solved! Go to Solution.
https://api.github.com/search/repositories?q=vscode
stargazers_count: 70274,
forks_count: 9362,
forks: 9362
watchers_count: 70274, <--(LISTED)
watchers: 70274,

https://github.com/Microsoft/vscode
Stars 70,274
Forks 9,362
Watchers 2,667 <--- (REAL)
3 Replies
Highlighted
Solution
Moderator
Message 2 of 4

Re: API is very confusing by listing Stars count for Watchers count on all repos

Sorry for the confusion here - this part of the API changed when we moved "watching" to mean "starring" and is explained in this post from the API blog:

 

http://developer.github.com/changes/2012-9-5-watcher-api/

 

`watchers` corresponds to the number of users that have starred a repository, while `subscribers_count` corresponds to the number of watchers. For example, looking at the Atom repository:

 

https://api.github.com/repos/atom/atom

 

Right now it has:

 

"subscribers_count": 2468
"stargazers_count": 48009

 

This is because there are 2468 watchers (= subscribers) and 48009 stargazers.

 

I hope that clears things up but if you have more questions, please let us know!

Highlighted
Ground Controller Lvl 2
Message 3 of 4

Re: API is very confusing by listing Stars count for Watchers count on all repos

repo_list = []
for (var j = 0; j < Pages.length; j++) {
if (!Pages[j]['fork']) {//排除fork别人的库
repo_list.push({
name: Pages[j]['name'],
stargazers_count: Pages[j]['stargazers_count'],
forks_count: Pages[j]['forks_count'],
html_url: Pages[j]['html_url'],
open_issues_count: Pages[j]['open_issues_count'],
subscribers_count: Pages[j]['subscribers_count'],
language: Pages[j]['language']

 

});
}
}
 
why i use this,but show like the photo as follows:
WechatIMG504.png
Highlighted
Moderator
Message 4 of 4

Re: API is very confusing by listing Stars count for Watchers count on all repos

Hmm, not sure what the issue just from the code screenshot but are you able to reproduce the problem with `subscribers_count` with a `curl` request?  For example, I see https://github.com/AgoraIO/Electron-SDK in your list of repositories but if I get that repository [1] with `curl`:

 

$ curl https://api.github.com/repos/AgoraIO/Electron-SDK | grep subscribers_count

  "subscribers_count": 34

We see `subscribers_count` in the response.  If you can't reproduce with `curl`, my guess is that there's an issue with the code.

 

1: https://developer.github.com/v3/repos/#get