Skip to content

Instantly share code, notes, and snippets.

@ksdkamesh99
Created September 28, 2021 16:28
Show Gist options
  • Save ksdkamesh99/d431e533c4ce7c001c710db49259fea1 to your computer and use it in GitHub Desktop.
Save ksdkamesh99/d431e533c4ce7c001c710db49259fea1 to your computer and use it in GitHub Desktop.
api_key=input("Enter the API Key")
!pip install google-api-python-client
from googleapiclient.discovery import build
import datetime
def Video_Summary(api_key,video_id):
service=build('youtube','v3',developerKey=api_key)
videos_list=service.videos().list(part='contentDetails,statistics,snippet',id=video_id).execute()
print("The Title of the Video is ",videos_list['items'][0]['snippet']['title'])
print("The Name of the Channel where the video is published is ",videos_list['items'][0]['snippet']['channelTitle'])
print("The Video is published on ",datetime.datetime.fromisoformat(videos_list['items'][0]['snippet']['publishedAt'][:-1]).strftime('%A %d %B %Y'))
print("The Number of likes for the video is ",videos_list['items'][0]['statistics']['likeCount'])
print("The Number of dislikes for the video is ",videos_list['items'][0]['statistics']['dislikeCount'])
print("The Number of views for the video is ",videos_list['items'][0]['statistics']['viewCount'])
print("The Number of comments for the video is ",videos_list['items'][0]['statistics']['commentCount'])
Video_Summary(api_key,"f_Rr9i1EScY")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment