はじめに
最近、過去の Qiita の投稿を見ていることがあるのですが、3 年ぐらい前だと 1 日あたりの投稿数が現在よりも結構多い気がしていました。
そこで、Qiitaの1月ごとの投稿数の推移をグラフにしてみました。
情報取得
Qiita の API を見てみたのですが、指定範囲の記事の件数が取得できなそうだったので、記事検索画面をこっそりスクレイピングしてみました。
ソース
かなりアドホックな感じですが。
import requests
import re
import time
from datetime import date, timedelta
from dateutil.relativedelta import relativedelta
start = date(2011, 9, 1)
today = date.today()
end = date(today.year, today.month, 1)
target = start
while target < end:
next_month = target + relativedelta(months=1)
url = f"https://qiita.com/search?sort=created&q=created%3A%3C{next_month}+created%3A%3E%3D{target}"
res = requests.get(url)
matcher = re.search('<span class="style-ro5zzw">(<!-- -->([0-9]+)<!-- -->)</span>', res.text)
print("{},{}".format(target, matcher.group(1)))
target = next_month
time.sleep(5)
取得結果(CSV)
2011-09-01,64
2011-10-01,165
2011-11-01,143
2011-12-01,156
2012-01-01,222
2012-02-01,486
2012-03-01,327
2012-04-01,761
2012-05-01,478
2012-06-01,564
2012-07-01,508
2012-08-01,556
2012-09-01,537
2012-10-01,551
2012-11-01,567
2012-12-01,965
2013-01-01,827
2013-02-01,938
2013-03-01,1066
2013-04-01,889
2013-05-01,1082
2013-06-01,1116
2013-07-01,1138
2013-08-01,1138
2013-09-01,1171
2013-10-01,1308
2013-11-01,1510
2013-12-01,2674
2014-01-01,1863
2014-02-01,2286
2014-03-01,2541
2014-04-01,2862
2014-05-01,2986
2014-06-01,3233
2014-07-01,3378
2014-08-01,3128
2014-09-01,3245
2014-10-01,3284
2014-11-01,3250
2014-12-01,5447
2015-01-01,3767
2015-02-01,3877
2015-03-01,3907
2015-04-01,3753
2015-05-01,4066
2015-06-01,4069
2015-07-01,4430
2015-08-01,4146
2015-09-01,4113
2015-10-01,4288
2015-11-01,4612
2015-12-01,8713
2016-01-01,5021
2016-02-01,5244
2016-03-01,5498
2016-04-01,4889
2016-05-01,4898
2016-06-01,4927
2016-07-01,4995
2016-08-01,4760
2016-09-01,5125
2016-10-01,5064
2016-11-01,5220
2016-12-01,10792
2017-01-01,5267
2017-02-01,5088
2017-03-01,5423
2017-04-01,5357
2017-05-01,5194
2017-06-01,5035
2017-07-01,4787
2017-08-01,4899
2017-09-01,5090
2017-10-01,5631
2017-11-01,6244
2017-12-01,11877
2018-01-01,6430
2018-02-01,6127
2018-03-01,7256
2018-04-01,7371
2018-05-01,7462
2018-06-01,7339
2018-07-01,7188
2018-08-01,7292
2018-09-01,7379
2018-10-01,8565
2018-11-01,8448
2018-12-01,14602
2019-01-01,8241
2019-02-01,8364
2019-03-01,9394
2019-04-01,9612
2019-05-01,9902
2019-06-01,9879
2019-07-01,9771
2019-08-01,9548
2019-09-01,9801
2019-10-01,10364
2019-11-01,10598
2019-12-01,18816
2020-01-01,10896
2020-02-01,10562
2020-03-01,12143
2020-04-01,11656
2020-05-01,13629
2020-06-01,11034
2020-07-01,11170
2020-08-01,10721
2020-09-01,10282
2020-10-01,9877
2020-11-01,10877
2020-12-01,17439
2021-01-01,10424
2021-02-01,9438
2021-03-01,10381
2021-04-01,9139
2021-05-01,9631
2021-06-01,9018
2021-07-01,8285
2021-08-01,8402
2021-09-01,8218
2021-10-01,7546
2021-11-01,7817
2021-12-01,13649
2022-01-01,8003
2022-02-01,7663
2022-03-01,8236
2022-04-01,7639
2022-05-01,8183
2022-06-01,7762
2022-07-01,7815
2022-08-01,7465
2022-09-01,7043
2022-10-01,7157
2022-11-01,8361
2022-12-01,15922
2023-01-01,8205
2023-02-01,7502
グラフ化
それを、グラフにしてみました。
ソース
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('qiita_month.csv', encoding = 'UTF8', header=None)
data_x = [x[0:7] for x in data[data.columns[0]]]
data_y = data[data.columns[1]]
fig, ax = plt.subplots()
ax.plot(data_x, data_y, linestyle='solid')
ticks = 12
offset = 3
ax.set_xticks(range(offset, len(data_x), ticks), data_x[offset::ticks], rotation=20)
ax.grid(which="major", axis="x", color="black", alpha=0.8, linestyle="dotted", linewidth=1)
plt.plot()
plt.savefig('qiita_month.png')
縦の点線は、毎年 12 月です。
12 月だけ、ぴょこんと飛び出ているのは、やっぱり Advent Calendar が強いんでしょうね。
アーカイブを見ると 2011 年からやっていたみたいですが、盛り上がっていったのは 2013 年以降なんですかね。
12 月を除けば、一昨年の中頃から今年の一日あたりの投稿数は 250~300 件程度のようですね。
また、3 年前ぐらいは、一番投稿数が多い時期だったみたい。今の 3~6 割増しという感じでしょうか。
zenn が始まったのは、2020 年 9 月かな?
やはり、影響は大きいのかな。