これは何?
Qiita APIを触っていて,フォロワー数の値とAPIで取得される値が異なることに気がついたので取り急ぎ,
バグの報告用の記事を書きました。
追記: こちら問い合わせたところバグではなかったです。
現在、ユーザーページに表示されるフォロワー数は、アカウント認証がされていないユーザーを含めないものとなっております。
Qiita APIのフォロワー数ではその対応がまだできておらず、アカウント認証がされていないユーザーを含むフォロワー数となっており、それによりフォロワー数が異なる状態になっております。
1
起きている減少
APIで取得したJSONではフォロワー数は「160」になっている。
{
description: "開発環境のエンハンス、CI/CD、コンテナ、リファクタリング/コード設計が好き。\r\n" +
"本業はセキュリティエンジニアで診断やSI開発などやってます。\r\n" +
"↓過去に伸びた記事まとめ\r\n" +
"https://qiita.com/sigma_devsecops/items/59af6d7f45397217ddd2",
facebook_id: "",
followees_count: 96,
followers_count: 160,
github_login_name: "RyosukeDTomita",
id: "sigma_devsecops",
items_count: 99,
linkedin_id: "",
location: "kanto",
name: "",
organization: "※各記事の内容は個人の見解であり、所属する組織の公式見解ではありません。",
permanent_id: 3718390,
profile_image_url: "https://s3-ap-northeast-1.amazonaws.com/qiita-image-store/0/3718390/dc6fe93293c8816dcb22fba791d008fe21461465/x_large.png?1740751349",
team_only: false,
twitter_screen_name: "sigma5736394841",
website_url: "https://qiita.com/sigma_devsecops/items/59af6d7f45397217ddd2"
}
何人か確認したが,同様の現象が発生していそう。
APIで取得したフォロワー数は「8076」
deno run --allow-all test.ts
{
description: "株式会社ソニックガーデンのRubyプログラマ。「プロを目指す人のためのRuby入門」の著者、および「Everyday Rails - RSpecによるRailsテスト入門」の翻訳者。 プログラミングスクール「フィヨルドブートキャンプ」のメンターでもある。",
facebook_id: "junichiitosbooks",
followees_count: 62,
followers_count: 8076,
github_login_name: "JunichiIto",
id: "jnchito",
items_count: 388,
linkedin_id: "",
location: "Hyogo, Japan",
name: "Junichi Ito",
organization: "SonicGarden Inc.",
permanent_id: 7465,
profile_image_url: "https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/7465/profile-images/1697069340",
team_only: false,
twitter_screen_name: "jnchito",
website_url: "https://blog.jnito.com/"
}
APIで取得したフォロワー数は「9915」
{
description: "たった3ヶ月であなたの「やりたい」を実現するプログラミングスキルが身につく | メガベンチャーで働く現役エンジニア | 技術記事サイトで年間表彰1位 | プログラミング経験なしの私が科学的根拠のあるアウトプットで年収700万円のオファー4件獲得 | 現役エンジニア専門のプログラミングスクールJISOUを運営",
facebook_id: "",
followees_count: 3,
followers_count: 9915,
github_login_name: "jinwatanabe",
id: "Sicut_study",
items_count: 635,
linkedin_id: "",
location: "Saitama",
name: "渡邉 臣 | JISOU",
organization: "Uzabase, Inc.",
permanent_id: 810513,
profile_image_url: "https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/810513/profile-images/1714917423",
team_only: false,
twitter_screen_name: "Sicut_study",
website_url: "https://projisou.jp"
}
何倍になっているか確認したが,概ね同じくらいの割合ではあるものの,単純に1.2倍されているとかではなさそう。
160/130 = 1.2307 ...
8076/6712 = 1.2032 ...
9915/8300 = 1.194 ...
検証に使用したコード
const username = "sigma_devsecops"
const apiKey = "aaaaaaaaaaaaaaaaaaaaaaaaaaa"
const url = `https://qiita.com/api/v2/users/${username}`;
const headers = new Headers();
headers.append("Authorization", `Bearer ${apiKey}`);
try {
const response = await fetch(url, { headers });
if (!response.ok) {
throw new Error(`Failed to fetch user information: ${response.status}`);
}
const userData = await response.json();
console.log(userData);
} catch (error) {
console.error(`Error fetching user followers: ${error}`);
}
気がついた経緯
Qiitaのフォロワー数を取得するスクリプトを書いていて,あれ?俺こんなにフォロワーいないぞと思い,きがついた