You want to get the number of viewers for a streamer video. However, it does not work with the following error message.
{‘error’: ‘Unauthorized’, ‘status’: 401, ‘message’: ‘OAuth token is missing’}
I’m using Python, and I already got the OAuth token with “analytics:read:extensions”.
The code is as follows
Hope you can help.
import requests
import json
import pandas as pd
import csv
client_id = "MY-Client-ID"
token = "MY-TOKEN"
video_id = "xxxx"
url = 'https://api.twitch.tv/helix/' + \
"videos?id=" + video_id
headers = {'Client-ID': client_id,
"Authorization": "Bearer" + token}
r = requests.get(url, headers=headers)
row_data = r.json()
I am using a translation from Japan. I hope it will be understood.