Feb-16-2020, 05:34 AM
(Apr-10-2018, 05:18 PM)snippsat Wrote: Then can write code.
import requests from pprint import pprint id_of_video = 'CUNq2_VjRn4' your_api_key = 'xxxxxxxxxxxxxx' url = f'https://www.googleapis.com/youtube/v3/videos?id={id_of_video}&key={your_api_key}&part=status' url_get = requests.get(url) pprint(url_get.json())
I tried the above code (after entering in 'id_of_video' and 'your_api_key' and got an error ..
Quote:url = f'https://www.googleapis.com/youtube/v3/videos?id={id_of_video}&key={your_api_key}&part=status'
^
SyntaxError: invalid syntax
Then noticed the f, removed it an whilst the script ran okay, this is what was displayed
Quote:{'error': {'code': 400,
'errors': [{'domain': 'usageLimits',
'message': 'Bad Request',
'reason': 'keyInvalid'}],
'message': 'Bad Request'}}