import sys
sys.stdout.reconfigure(encoding='utf-8')
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials

creds = Credentials.from_authorized_user_file('token.json')
yt = build('youtube', 'v3', credentials=creds)

reply_2_id = "Ugyz-aSultn1g8LbCZ54AaABAg.AbfH46A7T9TAbfKTHGpEtv"
new_text_2 = (
    "Dứt luôn bác ơi! ⚔️ Trọn bộ 8 tập tư liệu 4K tái hiện toàn bộ chiến dịch Thủy chiến Rạch Gầm - Xoài Mút 1785 đã sẵn sàng trên kênh. "
    "Bác ghé Playlist này cày liền mạch nhé: https://www.youtube.com/playlist?list=PLZBnH5iYlu-w 🔥 "
    "Tối nay 19:00 có Tập 4 công chiếu, chúc bác xem phim thật đã!"
)

try:
    res = yt.comments().update(
        part="snippet",
        body={
            "id": reply_2_id,
            "snippet": {
                "textOriginal": new_text_2
            }
        }
    ).execute()
    print("Success updating reply 2:", res["snippet"]["textOriginal"])
except Exception as e:
    print("Error updating reply 2:", e)
