from googleapiclient.discovery import build from googleapiclient.http import MediaFileUpload import time # API anahtarınızı burada belirtin API_KEY = 'AIzaSyDrI2HNa7N6xgy2mTS5fJ8VT_0osmC6VlQ' VIDEO_FILE_PATH = 'path_to_your_video_file.mp4' VIDEO_TITLE = 'Your Video Title' VIDEO_DESCRIPTION = 'Description of your video' VIDEO_CATEGORY_ID = '22' # Örneğin, 22 = People & Blogs VIDEO_PRIVACY_STATUS = 'public' # 'public', 'private', or 'unlisted' def get_authenticated_service(): return build('youtube', 'v3', developerKey=API_KEY) def upload_video(youtube, file_path, title, description, category_id, privacy_status): request_body = { 'snippet': { 'title': title, 'description': description, 'categoryId': category_id }, 'status': { 'privacyStatus': privacy_status } } media_file = MediaFileUpload(file_path, chunksize=-1, resumable=True) request = youtube.videos().insert( part='snippet,status', body=request_body, media_body=media_file ) response = None while response is None: status, response = request.next_chunk() if status: print(f'Uploaded {int(status.progress() * 100)}%') print(f'Video uploaded successfully: {response["id"]}') def main(): youtube = get_authenticated_service() while True: upload_video(youtube, VIDEO_FILE_PATH, VIDEO_TITLE, VIDEO_DESCRIPTION, VIDEO_CATEGORY_ID, VIDEO_PRIVACY_STATUS) print('Waiting for 25 seconds before next upload...') time.sleep(25) if __name__ == '__main__': main()