Git Product home page Git Product logo

youtube-api-analysis's Introduction

Youtube-API-analysis

Analysing the youtube channel Andrew Huberman to extract keywords from developing high performing content.

Expolatory- data analysis

Overview

Data APIs are a great source of data for data analytics projects. In this readme, I'm walking you step by step through the process of retrieving video data and channel data using Youtube Data API.

And also the techniques to Visualize the obtained data.

Obtaining Youtube developer key

We start this project by first creating an YouTube API Key which will be our credential to access youtube data. go to google developer console and sign through your google account then create a new project, enable api & create a new api key, copy this api key and paste it into you code as a variable.

Obtaining Channel Id from source code

Go to the below link and look through the youtube api documentation for code snippet to obtain channel id. https://developers.google.com/youtube/v3/docs/channels/list?apix=true

For obtaining channel id of a specific channel, go to youtube and follow steps below.

Screenshot (53) Click ctrl+u to open a new tab with source code

Next click ctrl+f to find itemprop="channelId"
copy the value stored in content variable with key equal to itemprop="channelId" then store it in a variable

Screenshot (54)

Install required python pakages

install "google-api-python-client" (which is the google python package required to access youtube api data), we will also install pandas, seaborn & Matplotlib.

Data Scraping from Youtube Data API

Youtube data api stores all data in json form as shown in below pictorial representation.

Screenshot (59)

Extracting playlist id from channel details

We extract channel details from youtube. I.e. we extract details such as youtube channel name and playlistId. Below is the image of code snippet of function for extracting channel details.

Screenshot (66)

We will be loading this data into a pandas dataframe and then store the obtained playlistId in a variable named playlist_id.

Extract video ids from playlist id using youtube api documentation

Below is the image of code snippet of function for extracting videoIds.

Screenshot (61)

We shall build a logic to extract video Ids from playlistId for a particular channel. Below is the image of code snippet of function for extracting videoIds.

Screenshot (62)

We shall extract details such as video title, video description, total views each video has got, total number of likes, each video has got. Then load these details into pandas dataframe.

Screenshot (58)

Data Pre-processing

check for null or empty values in pandas dataframe storing video details.

Screenshot (63)

check for data type of different columns of video_df pandas data frame

Screenshot (65)

to use this data for visualization we need to convert likes and view count into numeric form

converting likeCount and viewCount into numeric data type

Screenshot (64)

Exploratory data Analysis

The main purpose of EDA is to help look at data before making any assumptions. It can help identify obvious errors, as well as better understand patterns within the data, detect outliers or anomalous events, find interesting relations among the variables.

Best performing videos

Screenshot (55)

Worst performing videos

Screenshot (56)

Likes vs Views

Using scatter plot to visualize the relation between view count and like count Screenshot (57)

youtube-api-analysis's People

Contributors

vagdevi-gandhala avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.