youtubeへの投稿効率化ツール(エクセルVBAマクロ)

副業

FIRE実現のために、youtubeへの動画投稿にて副業を実践しているものの、手間がかかって思うように捗らないという方、多いのではないかと思います。

そこで、エクセルマクロ(VBA)でyoutubeへの投稿・更新作業を自動化・効率化するツールを作成しましたので、シェアします。

新規登録した動画のIDを取得する機能や、タイトル・説明文・タグを更新する機能など、色々な機能を実装しました。

参考になれば幸いです。

エクセルブックの紹介

エクセルにて、以下のような管理台帳シートを作って、当該シートを用いて、動画投稿や更新を管理します。

実際のマクロ入りブックは以下です。

本マクロブックのサポートやカスタマイズについては、条件によって、有償にて対応受付しております。

以下、クラウドワークスのアカウントよりご依頼いただければ幸いです。

FIRE太郎さん(その他)に依頼・外注する | 簡単ネット発注なら【クラウドワークス】
日本最大級のクラウドソーシング「クラウドワークス」にご登録いただいているFIRE太郎さんのプロフィールです。その他のスキルを持つプロフェッショナルに1時間から仕事を気軽に発注!発注者は手数料無料。

youtubeへの投稿効率化ツール(VBAマクロ)の紹介

マクロの初期設定

まず、初期設定が必要です。

まず、以下記事を参考に、Seleniumの設定をします。

基本機能

新規投稿した動画IDを取得する機能

まず、手動にて、動画を非公開状態で投稿します。この際の投稿内容は仮状態でよいです。

その後、本項のマクロを動かすと、上記した新規投稿IDを「動画」と「ライブ配信」からすべて取得し、エクセルのシートにレコード行を追加します。

Public driver As New ChromeDriver

Public ks As New Keys

Public Const tweet_text As String = "/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div/div/div[3]/div/div[1]/div/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/label/div[1]/div/div/div/div/div/div/div/div/div"

Public Const tweet_post As String = "/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div/div/div[3]/div/div[1]/div/div/div/div/div[2]/div[3]/div/div/div[2]/div[4]/div/span/span"

Sub youtube新規ID取得(PROFILE_PATH As String)

If Workbooks("動画管理.xlsm").Sheets("リスト").FilterMode = True Then

    Workbooks("動画管理.xlsm").Sheets("リスト").ShowAllData
Else
    Workbooks("動画管理.xlsm").Sheets("リスト").Rows(2).AutoFilter

End If

driver.AddArgument ("user-data-dir=" & PROFILE_PATH)

driver.Get "https://studio.youtube.com/channel/UCobhns-lavAf4RvRj-ujhCA/videos/upload?filter=%5B%5D&sort=%7B%22columnType%22%3A%22date%22%2C%22sortOrder%22%3A%22DESCENDING%22%7D"

On Error Resume Next

driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[3]/ytcp-content-section/ytcp-video-section/ytcp-video-section-content/div/ytcp-video-row[1]/div/div[2]/ytcp-video-list-cell-video/div[1]/a/div/ytcp-thumbnail/div/ytcp-img-with-fallback/div/img").Click
driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[3]/ytcp-content-section/ytcp-video-section/ytcp-video-section-content/div/ytcp-video-row[1]/div/div[2]/ytcp-video-list-cell-video/div[1]/a/div/div").Click

On Error GoTo 0

n = 1

Do Until WorksheetFunction.CountIf(Workbooks("動画管理.xlsm").Sheets("リスト").Columns(31), Mid(driver.Url, 34, 11)) = 1


    If WorksheetFunction.CountIf(Workbooks("動画管理.xlsm").Sheets("リスト").Columns(31), Mid(driver.Url, 34, 11)) < 1 Then

        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row + 1, 1) = 1
        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row + 1, 31) = Mid(driver.Url, 34, 11)
        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row, 5) = driver.FindElementByCss("#textbox").Text
    
    End If
    
    n = n + 1

    driver.Get "https://studio.youtube.com/channel/UCobhns-lavAf4RvRj-ujhCA/videos/upload?filter=%5B%5D&sort=%7B%22columnType%22%3A%22date%22%2C%22sortOrder%22%3A%22DESCENDING%22%7D"
    
    driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[3]/ytcp-content-section/ytcp-video-section/ytcp-video-section-content/div/ytcp-video-row[" & n & "]/div/div[2]/ytcp-video-list-cell-video/div[1]/a/div/ytcp-thumbnail/div/ytcp-img-with-fallback/div/img").Click

Loop

driver.Get "https://studio.youtube.com/channel/UCobhns-lavAf4RvRj-ujhCA/videos/live?filter=%5B%5D&sort=%7B%22columnType%22%3A%22date%22%2C%22sortOrder%22%3A%22DESCENDING%22%7D"
driver.FindElementByXPath("//*[@id='video-list-live-tab']/div/ytcp-ve/span").Click
driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[3]/ytcp-content-section/ytcp-video-section/ytcp-video-section-content/div/ytcp-video-row[1]/div/div[2]/ytcp-video-list-cell-video/div[1]/a/div/ytcp-thumbnail/div/ytcp-img-with-fallback/div/img").Click


n = 1

Do Until WorksheetFunction.CountIf(Workbooks("動画管理.xlsm").Sheets("リスト").Columns(31), Mid(driver.Url, 34, 11)) = 1


    If WorksheetFunction.CountIf(Workbooks("動画管理.xlsm").Sheets("リスト").Columns(31), Mid(driver.Url, 34, 11)) < 1 Then

        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row + 1, 1) = 1
        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row + 1, 31) = Mid(driver.Url, 34, 11)
        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row, 5) = driver.FindElementByCss("#textbox").Text
    End If
    
    n = n + 1
    
    driver.Get "https://studio.youtube.com/channel/UCobhns-lavAf4RvRj-ujhCA/videos/live?filter=%5B%5D&sort=%7B%22columnType%22%3A%22date%22%2C%22sortOrder%22%3A%22DESCENDING%22%7D"
    driver.FindElementByXPath("//*[@id='video-list-live-tab']/div/ytcp-ve/span").Click
    
    driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[3]/ytcp-content-section/ytcp-video-section/ytcp-video-section-content/div/ytcp-video-row[" & n & "]/div/div[2]/ytcp-video-list-cell-video/div[1]/a/div/ytcp-thumbnail/div/ytcp-img-with-fallback/div/img").Click

Loop


Set driver = Nothing

End Sub

動画を編集・公開し、Twitterで宣伝し、宣伝botを登録する機能

エクセルの管理台帳上で、動画のタイトル・説明文・タグ・英文タイトル・英文説明文・ジャンルなどを編集します。

動画の説明文はエクセルのシート上、パーツごとに列で分割したものを、最後に結合しています。パーツとは、共有パーツ、アフィリエイトリンク用パーツ、次の動画パーツ、再生リストパーツなどです。

マクロを動かすことで、編集した内容をyoutubeへ反映し、ブログで宣伝している動画であれば、ブログの編集画面を開き、Twitterで宣伝し、宣伝botを登録します。

check列に1を入れた行を対象に動きます。

youtubeの動画詳細を更新します。

英語字幕を更新します。

エクセルのブログURLに値が入っていたら、ブログを開きます。公開した動画のURLをクリップボードにセットします。手動にて、対象のブログに公開した動画URLを貼り付けします。

Twitterで宣伝します。ハッシュタグはyoutubeのタグやハッシュタグ用に設定した値を流用します。

BOTフラグがONになっていたら、BOTに新規登録します。

一行上に動画データがあれば、当該動画データのyoutube詳細を更新しに行きます。(次の動画URLのテキスト情報が今回の新規投稿により取得できるようになったため、当該テキスト情報を更新します)


Sub youtube編集and公開(tweet_text As String, tweet_post As String, PROFILE_PATH As String, USER_ID_1 As String, USER_PAS1 As String, URL1 As String, USER_ID_2 As String, USER_PAS2 As String)


Dim CB As New DataObject

driver.AddArgument ("user-data-dir=" & PROFILE_PATH)

For i = 3 To Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row

    If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 1) <> "" Then

        driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/edit"
        
        driver.FindElementByCss("#textbox").Clear
        driver.FindElementByCss("#textbox").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 5)


        driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div[1]/div[2]/div/ytcp-mention-input/div").Clear
        driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div[1]/div[2]/div/ytcp-mention-input/div").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 39)

        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 36) <> "" Then
            driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[4]/div[3]/div[1]/ytcp-video-metadata-playlists/ytcp-text-dropdown-trigger/ytcp-dropdown-trigger/div/div[2]").Click

            Application.Wait Now + TimeSerial(0, 0, 1)

            driver.FindElementByCss("#checkbox-label-" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 36) & " > span").Click
            driver.FindElementByCss("#dialog > div.action-buttons.style-scope.ytcp-playlist-dialog > ytcp-button.done-button.action-button.style-scope.ytcp-playlist-dialog > div").Click
            
        End If


        driver.FindElementByXPath("//*[@id='toggle-button']/div").Click

        driver.FindElementByXPath("//*[@id='text-input']").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 45)

        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 10) = "ゲーム" Then
            driver.FindElementByXPath("//*[@id='category']").Click
            Application.Wait Now + TimeSerial(0, 0, 1)
            driver.FindElementByCss("#text-item-1 > ytcp-ve > div").Click
    
            driver.FindElementByCss("#category-container > ytcp-form-gaming > ytcp-form-autocomplete > ytcp-dropdown-trigger > div > div.left-container.style-scope.ytcp-dropdown-trigger > input").Clear
            driver.FindElementByCss("#category-container > ytcp-form-gaming > ytcp-form-autocomplete > ytcp-dropdown-trigger > div > div.left-container.style-scope.ytcp-dropdown-trigger > input").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 42)
            
'            Application.Wait Now + TimeSerial(0, 0, 1)
            
            driver.FindElementByCss("#text-item-2 > ytcp-ve > div > div > yt-formatted-string > span:nth-child(1)").Click
        End If

        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 10) = "動物" Then
            driver.FindElementByXPath("//*[@id='category']").Click
            Application.Wait Now + TimeSerial(0, 0, 1)
            driver.FindElementByCss("#text-item-7 > ytcp-ve > div").Click
        End If


        driver.FindElementByCss("#save > div").Click
        
        Application.Wait Now + TimeSerial(0, 0, 4)

        
        
'        driver.ExecuteScript "window.scrollBy(0, 0);"

        driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/edit"

        driver.FindElementByCss("#content").Click
        Application.Wait Now + TimeSerial(0, 0, 2)
        driver.FindElementByXPath("/html/body/ytcp-video-visibility-edit-popup/tp-yt-paper-dialog/ytcp-video-visibility-select/div[1]/tp-yt-paper-radio-group/tp-yt-paper-radio-button[3]").Click
        Application.Wait Now + TimeSerial(0, 0, 2)
        driver.FindElementByCss("#save-button > div").Click
        Application.Wait Now + TimeSerial(0, 0, 2)

        
        driver.FindElementByCss("#save > div").Click
        
        Application.Wait Now + TimeSerial(0, 0, 4)
        
        '英語字幕追加
        
        driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/translations"

        driver.FindElementByCss("#add-translations-button > div").Click

        driver.FindElementByCss("#text-item-188 > ytcp-ve > div").Click
        
        driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[12]/ytgn-video-translations-section/div[1]/ytgn-video-translations-list/div/ytgn-video-translation-row[2]/div/div[3]/ytgn-video-translation-cell-metadata/ytcp-button/div").Click

        driver.FindElementByCss("#translated-title > div > textarea").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 6)

        driver.FindElementByCss("#translated-description > div > textarea").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 41)
        
        driver.Window.Maximize
        driver.FindElementByCss("#publish-button > div").Click


        'ブログ
        
        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 55) <> "" Then

            driver.Get URL1
            
            driver.FindElementByXPath("//*[@id='user_login']").Clear
            
            
            driver.FindElementByXPath("//*[@id='user_login']").SendKeys USER_ID_2
            
            Application.Wait Now + TimeSerial(0, 0, 1)
            
            
            driver.FindElementByXPath("//*[@id='user_pass']").SendKeys USER_PAS2
            
            driver.FindElementByXPath("//*[@id='wp-submit']").SendKeys ks.Enter
    
            driver.Get Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 55)
    
            
            With CB
                .SetText "https://youtu.be/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31)        ''変数のデータをDataObjectに格納する
                .PutInClipboard     ''DataObjectのデータをクリップボードに格納する
            End With
            
            Stop
        
        End If

        'Twitter
        driver.Get "https://twitter.com/compose/tweet"
        
        
        driver.FindElementByXPath(tweet_text).SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 53)
        
        Stop
        
        driver.FindElementByXPath(tweet_post).Click

        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 56) = 1 Then
        
            driver.Get "https://metabirds.net/admin/login.php?lh=bot_top&language=ja&service_type=meta&lid=&emsg="
                
            driver.FindElementByCss("#default_login_form > form > div:nth-child(1) > label > input").SendKeys USER_ID_1
            driver.FindElementByCss("#default_login_form > form > div:nth-child(2) > label > input").SendKeys USER_PAS1
            driver.FindElementByCss("#default_login_form > form > div:nth-child(3) > input.button").Click
    
            driver.Get "https://metabirds.net/admin/bot_random.php"
            driver.FindElementByCss("#message_new").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 53)
            driver.FindElementByCss("#app > div > article > section:nth-child(6) > div.form_wrap > form > div:nth-child(6) > div > button").Click
        End If
        
        '前回動画更新
        
        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i - 1, 31) <> "" And Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i - 1, 1) = "" Then
        
            i = i - 1

    
            driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/edit"
    
            Application.Wait Now + TimeSerial(0, 0, 2)
            
            driver.FindElementByCss("#textbox").Clear
            driver.FindElementByCss("#textbox").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 5)
    
    
            driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div[1]/div[2]/div/ytcp-mention-input/div").Clear
            driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div[1]/div[2]/div/ytcp-mention-input/div").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 39)
    
            driver.FindElementByXPath("//*[@id='toggle-button']/div").Click
    
            driver.FindElementByXPath("//*[@id='clear-button']/tp-yt-iron-icon").Click
    
            driver.FindElementByXPath("//*[@id='text-input']").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 45)
    
            If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 10) = "ゲーム" Then
                driver.FindElementByXPath("//*[@id='category']").Click
                Application.Wait Now + TimeSerial(0, 0, 1)
                driver.FindElementByCss("#text-item-1 > ytcp-ve > div").Click
        
                driver.FindElementByCss("#category-container > ytcp-form-gaming > ytcp-form-autocomplete > ytcp-dropdown-trigger > div > div.left-container.style-scope.ytcp-dropdown-trigger > input").Clear
                driver.FindElementByCss("#category-container > ytcp-form-gaming > ytcp-form-autocomplete > ytcp-dropdown-trigger > div > div.left-container.style-scope.ytcp-dropdown-trigger > input").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 42)
                
                
                driver.FindElementByCss("#text-item-2 > ytcp-ve > div > div > yt-formatted-string > span:nth-child(1)").Click
            End If
    
            If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 10) = "動物" Then
                driver.FindElementByXPath("//*[@id='category']").Click
                Application.Wait Now + TimeSerial(0, 0, 1)
                driver.FindElementByCss("#text-item-7 > ytcp-ve > div").Click
            End If
    
    
            driver.FindElementByCss("#save > div").Click
            
            Application.Wait Now + TimeSerial(0, 0, 6)
            
            
            driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/translations"
           
            driver.FindElementByXPath("//*[@id='row-container']/div[3]/ytgn-video-translation-cell-metadata/div/button/span/span").Click
            
            Application.Wait Now + TimeSerial(0, 0, 2)
            
            driver.FindElementByCss("#translated-title > div > textarea").Clear
            driver.FindElementByCss("#translated-title > div > textarea").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 6)
    
            driver.FindElementByCss("#translated-description > div > textarea").Clear
            driver.FindElementByCss("#translated-description > div > textarea").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 41)
            
            driver.Window.Maximize
            driver.FindElementByCss("#publish-button > div").Click
            
            
            Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 1) = ""
    
            
        End If
        
        i = i + 1

    End If

Next i

Set driver = Nothing

End Sub

コードの中の、「tweet_text, tweet_post」にセットする値は以下記事を参照ください。

youtubeのテキスト情報を更新し、英語字幕も更新する機能

youtubeのテキスト情報を更新し、英語字幕も更新します。

check列に1を入れた行を対象に動きます。


Sub youtube更新and字幕更新(PROFILE_PATH As String)

driver.AddArgument ("user-data-dir=" & PROFILE_PATH)

For i = 3 To Workbooks("動画管理.xlsm").Sheets("リスト").Cells(Rows.Count, 31).End(xlUp).Row

    If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 1) <> "" Then

        driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/edit"

        Application.Wait Now + TimeSerial(0, 0, 2)
        
        driver.FindElementByCss("#textbox").Clear
        driver.FindElementByCss("#textbox").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 5)


        driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div[1]/div[2]/div/ytcp-mention-input/div").Clear
        driver.FindElementByXPath("/html/body/ytcp-app/ytcp-entity-page/div/div/main/div/ytcp-animatable[9]/ytcp-video-details-section/ytcp-video-metadata-editor/div/ytcp-video-metadata-editor-basics/div[2]/ytcp-social-suggestions-textbox/ytcp-form-input-container/div[1]/div[2]/div/ytcp-mention-input/div").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 39)

        driver.FindElementByXPath("//*[@id='toggle-button']/div").Click

        driver.FindElementByXPath("//*[@id='clear-button']/tp-yt-iron-icon").Click

        driver.FindElementByXPath("//*[@id='text-input']").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 45)

        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 10) = "ゲーム" Then
            driver.FindElementByXPath("//*[@id='category']").Click
            Application.Wait Now + TimeSerial(0, 0, 1)
            driver.FindElementByCss("#text-item-1 > ytcp-ve > div").Click
    
            driver.FindElementByCss("#category-container > ytcp-form-gaming > ytcp-form-autocomplete > ytcp-dropdown-trigger > div > div.left-container.style-scope.ytcp-dropdown-trigger > input").Clear
            driver.FindElementByCss("#category-container > ytcp-form-gaming > ytcp-form-autocomplete > ytcp-dropdown-trigger > div > div.left-container.style-scope.ytcp-dropdown-trigger > input").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 42)
            
            
            driver.FindElementByCss("#text-item-2 > ytcp-ve > div > div > yt-formatted-string > span:nth-child(1)").Click
        End If

        If Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 10) = "動物" Then
            driver.FindElementByXPath("//*[@id='category']").Click
            Application.Wait Now + TimeSerial(0, 0, 1)
            driver.FindElementByCss("#text-item-7 > ytcp-ve > div").Click
        End If


        driver.FindElementByCss("#save > div").Click
        
        Application.Wait Now + TimeSerial(0, 0, 6)
        
        
        driver.Get "https://studio.youtube.com/video/" & Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 31) & "/translations"
       
        driver.FindElementByXPath("//*[@id='row-container']/div[3]/ytgn-video-translation-cell-metadata/div/button/span/span").Click
        
        Application.Wait Now + TimeSerial(0, 0, 2)
        
        driver.FindElementByCss("#translated-title > div > textarea").Clear
        driver.FindElementByCss("#translated-title > div > textarea").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 6)

        driver.FindElementByCss("#translated-description > div > textarea").Clear
        driver.FindElementByCss("#translated-description > div > textarea").SendKeys Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 41)
        
        driver.Window.Maximize
        driver.FindElementByCss("#publish-button > div").Click
        
        
        Workbooks("動画管理.xlsm").Sheets("リスト").Cells(i, 1) = ""
        
    End If

Next i

Set driver = Nothing

End Sub

ニコニコ動画への同時投稿機能

タイトル・説明文などを流用し、ニコニコ動画へ投稿するマクロ機能も設けています。

以下記事を参照ください。

まとめ

いかがでしたでしょうか?

参考になれば幸いです。

本マクロブックのサポートやカスタマイズについては、条件によって、有償にて対応受付しております。

以下、クラウドワークスないしココナラのアカウントよりご依頼いただければ幸いです。

FIRE太郎さん(その他)に依頼・外注する | 簡単ネット発注なら【クラウドワークス】
日本最大級のクラウドソーシング「クラウドワークス」にご登録いただいているFIRE太郎さんのプロフィールです。その他のスキルを持つプロフェッショナルに1時間から仕事を気軽に発注!発注者は手数料無料。
FIRE太郎さん(会社員)のプロフィール | ココナラ
Excelマクロ(VBA)による自動化ツールの作成が得意です。|ブログ「FIRE(早期リタイア)研究所」運営中

コメント

タイトルとURLをコピーしました