I am trying to update stream info like below but it fails
tags and title set but description and thumbnail is not
the messages i got as below
2024-06-26 10:55:38,843 - INFO - Twitch token is valid
2024-06-26 10:55:38,843 - INFO - Attempting to stream video from: C:\inetpub\ftproot\stream\downloads\a2yGs8bEeQg.webm
2024-06-26 10:55:39,578 - INFO - Updated stream info - Title: SORA Video To Video Is Literally Mind Blowing - 12 HD Demos - Changes Industry Forever For Real, Category: Science & Technology, Tags: ['technology', 'learning', 'software', 'education', 'howto', 'tech', 'programming', 'development', 'science', 'lecture']
2024-06-26 10:55:39,703 - ERROR - Failed to update stream info: 400 Client Error: Bad Request for url: https://api.twitch.tv/helix/channels?broadcaster_id=906233081
2024-06-26 10:55:39,703 - ERROR - Response content: No response
2024-06-26 10:55:39,859 - INFO - Attempting to stream to: rtmp://mia05.contribute.live-video.net/app/REMOVEDBYMODERATOR
2024-06-26 10:55:39,859 - DEBUG - < :8roe!8roe@8roe.tmi.twitch.tv JOIN #secourses
async def update_stream_info(self, title, description, thumbnail_url):
headers = {
'Client-ID': self.client_id,
'Authorization': f'Bearer {self.token_data["access_token"]}',
}
title = title[:140] # Ensure title is not too long
tags = get_tags(title, description)
science_tech_id = "509670"
data = {
'broadcaster_id': self.user_id,
'title': title,
'game_id': science_tech_id,
'broadcaster_language': 'en',
'tags': tags
}
try:
response = requests.patch(f'https://api.twitch.tv/helix/channels?broadcaster_id={self.user_id}',
headers=headers,
json=data)
response.raise_for_status()
logging.info(f"Updated stream info - Title: {title}, Category: Science & Technology, Tags: {tags}")
if thumbnail_url:
thumbnail_data = {
'thumbnail_url': thumbnail_url
}
thumbnail_response = requests.patch(f'https://api.twitch.tv/helix/channels?broadcaster_id={self.user_id}',
headers=headers,
json=thumbnail_data)
thumbnail_response.raise_for_status()
logging.info(f"Updated stream thumbnail: {thumbnail_url}")
except requests.RequestException as e:
logging.error(f"Failed to update stream info: {e}")
logging.error(f"Response content: {e.response.content if e.response else 'No response'}")
then i try to update description and thumbnail after stream ended but still fails
i need help
async def update_post_stream_info(self, metadata):
logging.info("Stream ended. Waiting for Twitch to update...")
await asyncio.sleep(60) # Wait for 1 minute
headers = {
'Client-ID': self.client_id,
'Authorization': f'Bearer {self.token_data["access_token"]}',
}
# Update description
description_data = {
'broadcaster_id': self.user_id,
'description': metadata['description'][:5000]
}
try:
description_response = requests.patch(f'https://api.twitch.tv/helix/channel_information', headers=headers, json=description_data)
description_response.raise_for_status()
logging.info("Updated post-stream description")
except requests.RequestException as e:
logging.error(f"Failed to update post-stream description: {e}")
logging.error(f"Response content: {e.response.content if e.response else 'No response'}")
I could update my app with example python methods as well