概要
ついにGoogle Cloudを個人用アカウントで持つことにしました
無料枠あるからとりあえずやってみるか精神です
といっても課金されるのは嫌すぎるのでそこら辺の設定も改めて確認しながら、作業記録を残していければと思います
最終的には何かしらのAPIを使用してデータを取得できるところまでを確認したいと思います
本題
アカウントの作成
まずはアカウントの作成です
「Google Cloud」で調べると公式のサイトは出てくるはずです
だいたいこんな感じですね
無料で開始をクリックしてアカウントを作成します
画面の手順通り必要な項目を入力していきます
ステップ2/2で請求情報の登録がありますが、ここで引き下がらずにクレカ情報を入力しましょう
$300分のクレジットが初めからついていること(3ヶ月で期限は切れます)とフルアカウントを有効にしない限り、課金は開始されないとのことなので、安心してアカウントを作成しましょう
それでも気になる場合
心配性の方もいると思います、自分もそのうちの一人です
そんな方は予算アラートを作成しましょう(チュートリアルもあります)
これを作成しておくことで急な料金上昇が発生しても、気づけるようになります
自分は毎月の費用が$0になるようにアラートを設定しました
1ヶ月経過して設定した費用よりも超過している、閾値よりも超過しているなどあればメールが来るようになります
ひとまずはここまででコストに関する心配事の予防策でした
APIを使ってみる
Youtube APIが前から面白そうだなと思っていたのでそちらを実行してみたいと思います
こちらの記事を参考に設定を行いました、ありがとうございます
課金自体は発生しないのですが、各Google Cloudプロジェクトで1日10,000"単位"のクォータが割り当てられており、YouTube Data APIの様々な操作で毎日のクォータを使い果たすと、その日は使えなくなるという形式のようです
実際の結果
APIキーを発行し終えたら、最終目標のAPIを実行してみます
今回使用したのはCommentThread APIを使用しました
ひとまずcurlリクエストができるとこまでを確認済みです
curl 'https://www.googleapis.com/youtube/v3/commentThreads?key=<YOUR_API_KEY>&videoId=<VIDEO_ID>&part=snippet&maxResults=10'
YOUR_API_KEYには先ほど取得したAPIキーを、VIDEO_IDには対象とする動画のv=以降の文字列を設定してください
必要な情報が埋まり次第実行します
{
"kind": "youtube#commentThreadListResponse",
"etag": "V_7sFJA1_xtJWzKWgx4nOagjGvA",
"nextPageToken": "Z2V0X25ld2VzdF9maXJzdC0tQ2dnSWdBUVZGN2ZST0JJRkNJY2dHQUFTQlFpSklCZ0FFZ1VJblNBWUFSSUZDSWdnR0FBU0JRaW9JQmdBSWc0S0RBaTE4N2JFQmhDZ2diV19BZw==",
"pageInfo": {
"totalResults": 10,
"resultsPerPage": 10
},
"items": [
{
"kind": "youtube#commentThread",
"etag": "7fQKLMAqrtagHDWb_O5lmVNrVG0",
"id": "UgwJXvFgVdJdkhWqls54AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "ZFyWjgkHod9ODNqW2MMR4L62aMk",
"id": "UgwJXvFgVdJdkhWqls54AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "やっぱシマチョウ最強だよな!!!\u003cbr\u003e焼肉行ったら必ず頼む",
"textOriginal": "やっぱシマチョウ最強だよな!!!\n焼肉行ったら必ず頼む",
"authorDisplayName": "@chemical_acid",
"authorProfileImageUrl": "https://yt3.ggpht.com/7enp3S0bDayK1S1bndTcEQzUu-CIusLuN_JuHsuAbog_iUKbXnXNAuB13b0I_JWF-T9ZauV1=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@chemical_acid",
"authorChannelId": {
"value": "UCNJ-q8Pth63qCYpZk0ryqgQ"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T08:03:32Z",
"updatedAt": "2025-08-02T08:03:32Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "YU993wOkfUb8PoDEDiokz8giGks",
"id": "Ugwgh59jJLSecGtc33l4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "11r4Rm0k5ZrD3eCYcfbzLZIf44Q",
"id": "Ugwgh59jJLSecGtc33l4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "サブちゃんっぽいゆるい感じいいね!\u003cbr\u003e1日も経たずに安定の100万再生越えは改めてすごい!",
"textOriginal": "サブちゃんっぽいゆるい感じいいね!\n1日も経たずに安定の100万再生越えは改めてすごい!",
"authorDisplayName": "@ほっとけーき桑ちゃん",
"authorProfileImageUrl": "https://yt3.ggpht.com/Lj5-U5vIZr_bjCYJrJRqwDU3wG6loSi_T5_HFt3rhYyODgLUuv0wyu5zV2ZGh4VXKkxc1WLrsME=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@%E3%81%BB%E3%81%A3%E3%81%A8%E3%81%91%E3%83%BC%E3%81%8D%E6%A1%91%E3%81%A1%E3%82%83%E3%82%93",
"authorChannelId": {
"value": "UCewRsA3NU3_VA0QbXdqlbjA"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:56:06Z",
"updatedAt": "2025-08-02T07:56:06Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "lFEMoR18-cRzO34oI9TdBE84s04",
"id": "Ugww8TAf8GroE37ALip4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "jtuqWunNM62gNcAKDPdXXxVTz8Y",
"id": "Ugww8TAf8GroE37ALip4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "やすこのTシャツ着て、フワ(肺)食うのおもろww",
"textOriginal": "やすこのTシャツ着て、フワ(肺)食うのおもろww",
"authorDisplayName": "@kkkkkkk-b1f",
"authorProfileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_m_zB3b-vEw3IFY_-gIa9fgx7WTtPt4jOAhtU6LRkmzQUxN7UR9wCwxMs9an8Z7sCRZHQ=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@kkkkkkk-b1f",
"authorChannelId": {
"value": "UCkTPlBHPKSTjUsjerqdvq2Q"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:54:00Z",
"updatedAt": "2025-08-02T07:54:00Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "mUzxEMCS-DtsKQ7l6z1xZlx1oVM",
"id": "UgycJ_ysOn-Rl5XgBqp4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "kCyi6ncuXFLyb849x-tKql_Cqq0",
"id": "UgycJ_ysOn-Rl5XgBqp4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "シマチョウうまいよね〜あまいよね〜",
"textOriginal": "シマチョウうまいよね〜あまいよね〜",
"authorDisplayName": "@ぴぴ-d1r8w",
"authorProfileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_mu1MKHEKyNS_BTU89wbS6M7nnRK6lkLy2ZYKH5eFCy3zw=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@%E3%81%B4%E3%81%B4-d1r8w",
"authorChannelId": {
"value": "UCpYkzi-1sEo5BoFuj-DBt5Q"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:46:30Z",
"updatedAt": "2025-08-02T07:46:30Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "k8MRmk20KKp4CBcqPnrH-wHa08s",
"id": "UgzFDCZ9P3pb934KT9l4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "U7fILSq0ie-oRT9lJm8UHhlWRmk",
"id": "UgzFDCZ9P3pb934KT9l4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "EDが戻ってる?",
"textOriginal": "EDが戻ってる?",
"authorDisplayName": "@ns-gn7di",
"authorProfileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_nypZZ-ZMix7zdGnngwwtUeSQZag_sEFXngG0iC4Ec=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@ns-gn7di",
"authorChannelId": {
"value": "UCtKIT0FrvuteOcgs8_Ft2mQ"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:40:58Z",
"updatedAt": "2025-08-02T07:40:58Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "ECCCnHPEYOZlJMO7lELgE13Lzq0",
"id": "Ugx_zVUmBf6VK-axft14AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "f3tL8zGMbcbtYPwXqP7bS5JcZMk",
"id": "Ugx_zVUmBf6VK-axft14AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "シマチョウだけ味ついてるからじゃなくて?",
"textOriginal": "シマチョウだけ味ついてるからじゃなくて?",
"authorDisplayName": "@6-de-0",
"authorProfileImageUrl": "https://yt3.ggpht.com/QoyDxUmd1C72neeh2Y5ymYnmSCy-G8zSfZAAQLK-cRMlv4BqmNI1DgAdzcyQmut5glpKB7RO=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@6-de-0",
"authorChannelId": {
"value": "UCfUmBA6F_aBPVTV64h9NFXQ"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:38:22Z",
"updatedAt": "2025-08-02T07:38:22Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "RgROv26VSw17ApTtDNaeRVqAdCk",
"id": "UgxukaLrLxwvcTmfC6B4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "bDiohKzdTnZyxr0jxVmE0ngqDb0",
"id": "UgxukaLrLxwvcTmfC6B4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "\u003ca href=\"https://www.youtube.com/watch?v=P5DOklHc1Zw&t=76\"\u003e1:16\u003c/a\u003e 虫エルデンリングが2年前!?\u003cbr\u003e?????",
"textOriginal": "1:16 虫エルデンリングが2年前!?\n?????",
"authorDisplayName": "@user-user1208shionchsuki",
"authorProfileImageUrl": "https://yt3.ggpht.com/BJJkBoP-y8X_m6LCmkBoj1o7t0Qpo7E3hK7OSsStigMVsNBpA00xAeqNm_UKfA_h8PhOXVrScLU=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@user-user1208shionchsuki",
"authorChannelId": {
"value": "UCgrMYuZZJ9PKEtXPUjYfPFA"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:27:35Z",
"updatedAt": "2025-08-02T07:27:35Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "4B_zwrq0nws6WNVg6otMVzEMXns",
"id": "Ugx9n5zSZsIcDZrs7FV4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "JbUhG3wM5hZs_l096JugFTkA5Zo",
"id": "Ugx9n5zSZsIcDZrs7FV4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "としみつってマジでこれから食べるよってタイミングで喋るよね",
"textOriginal": "としみつってマジでこれから食べるよってタイミングで喋るよね",
"authorDisplayName": "@lithiumu3868",
"authorProfileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_mEy9lZtW1KOYPBJaWslqO4TZUer9gJEIYdEadStuIBcg=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@lithiumu3868",
"authorChannelId": {
"value": "UCaPg2VVl8OVU3nYLxhAQqZA"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:18:44Z",
"updatedAt": "2025-08-02T07:18:44Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "LvSWoFPykGhT_IhRhySGgouCJPs",
"id": "Ugzvc6IWEwkrdZOhaLV4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "zRdOmr0Sh0ENVdScJt2GiaqoJX8",
"id": "Ugzvc6IWEwkrdZOhaLV4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "ついに来たか…3対3に分かれてナイトレインやってどちらが早くボス倒せるかやってくれw",
"textOriginal": "ついに来たか…3対3に分かれてナイトレインやってどちらが早くボス倒せるかやってくれw",
"authorDisplayName": "@Siba-l4k",
"authorProfileImageUrl": "https://yt3.ggpht.com/YHYnWiQLXvmIP5dtjqC7Q9EIgILbhJrIwEJY0jDlNWNqSgVmoW8uC5F8R-t-5ffsCXM_F-YCYw=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@Siba-l4k",
"authorChannelId": {
"value": "UC0z1bqeylOnS8SafRZJF8fg"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:10:41Z",
"updatedAt": "2025-08-02T07:10:41Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
},
{
"kind": "youtube#commentThread",
"etag": "emUpqlGKDRRMmXuO6gvxC6_26Qk",
"id": "Ugzsp-gH8ravVNfsUkx4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "KhFcKVgeIRtTGrHWtVwsFi_qtLc",
"id": "Ugzsp-gH8ravVNfsUkx4AaABAg",
"snippet": {
"channelId": "UCutJqz56653xV2wwSvut_hQ",
"videoId": "P5DOklHc1Zw",
"textDisplay": "待って\u003cbr\u003eストレッチャーズ諦めてたから\u003cbr\u003eめちゃくちゃ嬉しい",
"textOriginal": "待って\nストレッチャーズ諦めてたから\nめちゃくちゃ嬉しい",
"authorDisplayName": "@サーナイバーラン",
"authorProfileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_ngQezA7YU9o1YMbEGpHMTLgcx1n__XxzR43UVSa67on_Vl1VO62TjxcD_U2MDFPZBPu0TO=s48-c-k-c0x00ffffff-no-rj",
"authorChannelUrl": "http://www.youtube.com/@%E3%82%B5%E3%83%BC%E3%83%8A%E3%82%A4%E3%83%90%E3%83%BC%E3%83%A9%E3%83%B3",
"authorChannelId": {
"value": "UCNu0iDZVQAJ1RdhuEZyVepg"
},
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2025-08-02T07:09:42Z",
"updatedAt": "2025-08-02T07:09:42Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
}
]
}
上記のようにレスポンスが返ってきます
あとは自分が得たい情報だけを切り取ったり加工したりという感じですね
終わりに
ということで、ついにGoogle Cloudデビューを果たしました
といってもまだまだApp EngineやBig Queryを使うなどには踏み出せていないですが、大きく一歩は踏み出せたかなと思います
APIの利用だったり気になる機能などが見つかれば試して、記事にしてを繰り返していきたいと思います

