Source of the Stargazers

Hi, I’m asmsuechan, one of maintainers of Boostnote. Today, I’m going to tell you about the stargazers of Boostnote.

Boostnote (a note-taking application for programmers) is published on GitHub as an OSS. And I made graphs according to the stargazers.

Graph the location of the stargazers

Let’s get right down to business, here’s a plot of the location of the stargazers (Beginning — Now)

And bar graph is below:

The biggest one is China, second is the US, third is Japan. They occupy almost 50% of them. At any rate, China and the US are bigger than I expected.

Fetch and analyze the stargazers

I kicked GitHubAPI to fetch the stargazers by using a script as follows.

Actually, there’s no reason that I write it by Python, it depends on my mood :P
I put the code which I used here.

from github import Github
from dotenv import load_dotenv, find_dotenv
import os
import csv
load_dotenv(find_dotenv())
GITHUB_ACCESS_TOKEN = os.environ.get("GITHUB_ACCESS_TOKEN")
g = Github(login_or_token=GITHUB_ACCESS_TOKEN, per_page=100)
# Get stargazers of the repository
repository = g.get_repo('BoostIO/Boostnote')
stargazers = repository.get_stargazers()
for page_number in 50:
for stargazer in stargazers.get_page(page_number):
f = open('stargazers.csv', 'a')
writer = csv.writer(f, lineterminator='\n')
csvlist = []
csvlist.append(stargazer.login)
csvlist.append(stargazer.location)
writer.writerow(csvlist)
f.close()
print(stargazer.location)

Here, I got a stargazer’s id and location in stargazers.csv.

But sadly, there was a problem. The location wasn’t always a perspicuous style such as ‘Japan’, ‘China’, or ‘America’. The majority of the people set it more detailed like ‘Tokyo’ or ‘Akihabara’.

Then I used Google Maps Geocoding API in order to translate the locations into a country’s name properly.

GeocodingAPI allows us to get geographical information by kicking this and point:https://maps.googleapis.com/maps/api/geocode/json?address=Washinomiya+Kuki-shi&key=YOUR_API_KEY.

For instance, you can curl with a parameter address as address=Washinomiya+Kuki-shi then it returns a json as follows.

{
"results" : [
{
"address_components" : [
{
"long_name" : "Washinomiya",
"short_name" : "Washinomiya",
"types" : [ "political", "sublocality", "sublocality_level_1" ]
},
{
"long_name" : "Kuki",
"short_name" : "Kuki",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Saitama Prefecture",
"short_name" : "Saitama Prefecture",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Japan",
"short_name" : "JP",
"types" : [ "country", "political" ]
},
{
"long_name" : "340-0217",
"short_name" : "340-0217",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Washinomiya, Kuki, Saitama Prefecture 340-0217, Japan",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 36.107551,
"lng" : 139.6791901
},
"southwest" : {
"lat" : 36.0785273,
"lng" : 139.6443736
}
},
"location" : {
"lat" : 36.1003427,
"lng" : 139.6614365
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 36.107551,
"lng" : 139.6791901
},
"southwest" : {
"lat" : 36.0785273,
"lng" : 139.6443736
}
}
},
"place_id" : "ChIJfcsG4zjKGGARBnLnJiLVPM0",
"types" : [ "political", "sublocality", "sublocality_level_1" ]
}
],
"status" : "OK"
}

I used an attribute named formatted_address to get the country’s name of the incomplete location (we can see the attribute as "formatted_address" : "Washinomiya, Kuki, Saitama Prefecture 340-0217, Japan", it contains a country’s name, Japan).

Finally I got arrays as follows. And they were plotted on Google Chart above. (array[0] is a country’s name and array[1] is the number)

[["China", 366], ["USA", 365], ["Japan", 199], ["Germany", 103], ["France", 74], ["Brazil", 69], ["India", 67], ["UK", 59], ["South Korea", 58], ["Canada", 56], ["Russia", 45], ["Australia", 32], ["Turkey", 32], ["Spain", 32], ["Taiwan", 28], ["United States", 24], ["504-42 Yunam-dong", 22], ["Mexico", 21], ["Netherlands", 20], ["Poland", 20], ["Portugal", 18], ["Italy", 18], ["Switzerland", 17], ["Indonesia", 17], ["United Kingdom", 15], ["Vietnam", 15], ["Thailand", 14], ["Ukraine", 14], ["Austria", 11], ["Hong Kong", 11], ["Singapore", 10], ["Sweden", 10], ["Belgium", 10], ["Argentina", 10], ["Denmark", 10], ["Colombia", 9], ["Greece", 9]]

I joined duplicated ones such as “UK” and “United Kingdam” by hand.

Chinese power

In these days, I feel that the stars from China is increasing obviously. In my opinion, the half of them are from China. Let’s dig it now.

First of all, I need to fetch the stargazers who starred in these three months

However, GitHubAPI doesn’t return the date-time of starred, so I devise.

I checked the number of stars by http://www.timqian.com/star-history/#BoostIO/Boostnote on early April (3 months ago), and subtract it from the current number of stars. The value is the number of stars BoostIO/Boostnote got in these three months.

Having extracted from the overall stargazers I got before, it’s done. They amount to1600.

Let’s plot it again.

Although this is a part of them, China accounts for 27%. Very huge.

As a matter of fact, I have something that the reason why the increase of Chinese power. That’s because of spreads of a post of weibo.

Thanks to this post, Boostnote trended on GitHub.

Impression

Chinese power is amazing. In my opinion, I’d like to advance into China.