mattintosh note

どこかのエンジニアモドキの備忘録

2024-06-05: 現在ホビー関連の記事を hobby.mattintosh-note.jp に移行しています。
現在掲載されている一部の画像と今後掲載される画像は特定の環境から閲覧できなくなります。

にじさんじメンバーとかのYouTubeチャンネルIDを取得するだけのスクリプト

暇つぶしでやってる VTuber のランキングサイトに ID を追加するのに5分くらいで適当に書いたもの。YouTube API の仕様変わっちゃったんでどうしようかな〜と思ってるんだけど現時点で登録数 350 超えてるし基本放置プレイなのでどうでもよいのだけどね。

にじさんじ

#!/bin/bash
 set -e
 set -u
 set -x

set -- $(
    curl 'https://nijisanji.ichikara.co.jp/member/' \
    | ruby -e '
        require "nokogiri"
        Nokogiri::HTML.parse(STDIN.read).xpath(%!//div[@class="insideline"]/a!).each do |n|
            puts n.attr("href")
        end
    '
)
ids=()
for f
do
    id=$(
        curl "${f}" \
        | ruby -e '
            require "nokogiri"
            require "uri"
            Nokogiri::HTML.parse(STDIN.read).xpath(%!//a[contains(@class, "elementor-social-icon-youtube")]!).each do |n|
                puts URI.parse(n.attr("href")).path.split("/")[-1]
            end
        '
    )
    echo ${id}
    ids+=(${id})
done
printf '%s\n' ------------------------
printf '%s\n' "${ids[@]}"
UCD-miitqNY3nyukJ4Fnf4_A
UC0g1AE0DOjBYnLhkgoRWN1w
UC6oDys1BGgBsIC3WhG1BovQ
UCsg-YqdqQ-KFF0LNk23BY4A
UC_4tXjqecqox5Uc05ncxpxg
UCoztvTULBYd3WmStqYeoHcA
UCwokZsOK_uEre70XayaFnzA
UCCVwhI5trmaSxfcze_Ovzfw
UCZ1xuCK1kNmn5RzPYIZop3w
UCt5-0i4AVHXaWJrL8Wql3mw
UCTi_rzf5QIkXjhJjkbcAdTg
UCwQ9Uv-m8xkE5PzRc7Bqx3Q
UCSFCh5NL4qXrAy9u-u2lX3g
UCHVXbQzkl3rDfsXWo8xi2qw
UCPvGypSgfDkVe7JG2KygK7A
UC1zFJrfEKvCixhsjNSb1toQ
UCspv01oxUFf_MTSipURRhkA
U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1D9ZDmuTsjw
UCHBhnG2G-qN0JrrWmMO2FTA
UCXU7YYxy_iQd3ulXyO-zC2w
UC9V3Y3_uzU5e-usObb6IE1w
UCpnvhOIJ6BN-vPkYU9ls-Eg
UCLpYMk5h1bq8_GAFVBgXhPQ
UCg63a3lk6PNeWhVvMRM_mrQ
UC2OacIzd2UxGHRGhdHl1Rhw
UCkIimWZ9gBJRamKF0rmPU8w
UCtnO2N4kPTXmyvedjGWdx3Q
UCryOPk2GZ1meIDt53tL30Tw
UCBiqkFJljoxAj10SoP2w2Cg
UCHX7YpFG8rVwhsHCx34xt7w
UCeK9HFcRZoTrvqcUCtccMoQ
UCRV9d6YCYIMUszK-83TwxVA
UCUzJ90o1EjqUbk2pBAy0_aw
UCpNH2Zk2gw3JBjWAKSyZcQQ
UCIG9rDtgR45VCZmYnd-4DUw
UCuz0vzQgC8LRdS6lVV0UkUg
UCwrjITPwG4q71HzihV2C7Nw
UC6TfqY40Xt1Y0J-N18c85qQ
UCl1oLKcAq93p-pwKfDGhiYQ
UCvzVB-EYuHFXHZrObB8a_Og
UCHK5wkevfaGrPr7j3g56Jmw
UCiSRx1a2k-0tOg-fs6gAolQ
UCqQV8xEBWd5SVZBLlYrS_5Q
UCllKI7VjyANuS1RXatizfLQ
UCb6ObE-XGCctO3WrjRZC-cw
UCerkculBD7YLc_vOGrF7tKg
UCufQu4q65z63IgE4cfKs1BQ
UCtAvQ5U0aXyKwm2i4GqFgJg
UCoM_XmK45j504hfUWvN06Qg

upd8

ワンライナーでOK。

curl 'https://upd8.jp/virtual_talent/' | ruby -e 'require "nokogiri"; require "uri"; Nokogiri::HTML.parse(STDIN.read).xpath(%!//div[@class="link_youtube"]/a[starts-with(@href, "https://www.youtube.com/channel/")]!).each do |n| puts URI.parse(n.attr("href")).path.split("/")[-1] end'
UC4YaOt1yT-ZeyB0OmxHgolA
UCGcD5iUDG8xiywZeeDxye-A
UCNjTjd2-PMC8Oo_-dCEss7A
UCHTnX0CSX_KObo5I9Wu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ww
UC0QzO6nK1cEDZvJSt2769Zw
UCyZZMKRn-mUEkPzaqa9b6bg
UCJzg5k2prEhTPMoK0kcBQPg

ホロライブ

ワンライナーでOK。

curl 'https://www.hololive.tv/member' | ruby -e 'require "nokogiri"; require "uri"; Nokogiri::HTML.parse(STDIN.read).xpath(%!//a[starts-with(@href, "https://www.youtube.com/channel/")]!).each do |n| puts URI.parse(n.attr("href")).path.split("/")[-1] end'
UCp6993wxpyDPHUpavwDFqgg
UCDqI2jOz0weumE8s7paEk6g
UC-hM6YJuNYVAmUWxeIr9FeA
UCD8HOxPs4Xvsm8H0ZxXGiBw
UCFTLzh12_nrtzqBPsTCqenA
UC1CfXB_kRs3C-zaeTG3oGyg
UCdn5BQ06XqgXoAxIhbqw5Rg
UCQ0UDLQCjY0rmuxCDE38FGg
UC1opHUrw8rvnsadT-iGp7Cg
UCXTpFs_3PqI41qX2d9tL2Rw
UC7fk0CB07ly8oSl0aqKkqFg
UC1suqwovbL1kzsoaZgFZLKg
UCvzGlP9oQwU--Y0r9id_jnA
UCp-5t9SrOQwXMU7iIjQfARg
UCdn5BQ06XqgXoAxIhbqw5Rg
UCvaTdHTWBGv3MKj3KVqJVCw
UChAnqc_AY5_I3Px5dig3X1Q
UC1DCedRgGHBdm81E1llLhOQ
UCl_gCybOJRIgOXw6Qb4qJzQ
UCvInZx9h3jC2JzsIzoOebWg
UCdyqAaZDKHXg4Ahi7VENThQ
UCCzUftO8KOVkV4wQG1vkUvg
UC0TXe_LYZ4scaW2XMyi5_kw
UC5CwaMl1eIgY8h02uZw7u8A

vtubers.ga