Python Forum
Help connecting to Google API
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help connecting to Google API
#3
I have removed your API key in url,as pointed out bye @killerrex.
Your url don't work,so it return what posted bye @killerrex.

Here a test you can do,look also at string formatting(f-string) then can add stuff to url string.
import requests
from pprint import pprint

video_id = 'CUNq2_VjRn4'
your_api_key = 'your_api_key'
url = f'https://www.googleapis.com/youtube/v3/videos?id={video_id}&key={your_api_key}&part=status'
url_get = requests.get(url)
pprint(url_get.json())
print('-----------')
# Is Video public viewable
print(url_get.json()['items'][0]['status']['publicStatsViewable'])
Output:
{'etag': '"95M1zlW0txkV42I4OG1Zscxrg5A/XBA-sYAccdJQD803PbrNziArt-U"', 'items': [{'etag': '"95M1zlW0txkV42I4OG1Zscxrg5A/i4VlXNZUnKWY8OIv_qh-vAbzstI"', 'id': 'CUNq2_VjRn4', 'kind': 'youtube#video', 'status': {'embeddable': True, 'license': 'youtube', 'privacyStatus': 'public', 'publicStatsViewable': True, 'uploadStatus': 'processed'}}], 'kind': 'youtube#videoListResponse', 'pageInfo': {'resultsPerPage': 1, 'totalResults': 1}} ----------- True
Reply


Messages In This Thread
Help connecting to Google API - by csj - May-05-2018, 08:07 AM
RE: Help connecting to Google API - by killerrex - May-05-2018, 12:28 PM
RE: Help connecting to Google API - by snippsat - May-05-2018, 02:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to import files in Google Collab wihout downloading them to PC and to Google Disk sveto4ka 9 3,985 Jun-03-2020, 12:40 PM
Last Post: sveto4ka

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020