0% found this document useful (0 votes)
7 views4 pages

Module 1

This document outlines the steps to create a Google Cloud project and utilize the YouTube Data API v3. It includes instructions for selecting a YouTube channel, understanding the search endpoint, writing a Python script for API requests, implementing pagination, extracting required video fields, converting data to a DataFrame, performing basic data validation, and saving the dataset as a CSV file. Each step is detailed to ensure proper execution and data handling.

Uploaded by

renjushakr4
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Module 1

This document outlines the steps to create a Google Cloud project and utilize the YouTube Data API v3. It includes instructions for selecting a YouTube channel, understanding the search endpoint, writing a Python script for API requests, implementing pagination, extracting required video fields, converting data to a DataFrame, performing basic data validation, and saving the dataset as a CSV file. Each step is detailed to ensure proper execution and data handling.

Uploaded by

renjushakr4
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Step 1: Create Google Cloud Project

1.​ Go to Google Cloud​

2.​ Create a new project​

3.​ Enable the API:​

○​ YouTube Data API v3​

4.​ Generate an API Key​

5.​ Store the API key securely (.env file or variable)​

Step 2: Select a YouTube Channel


1.​ Choose one YouTube channel​

2.​ Ensure:​

○​ 100–350 videos​

○​ Diverse content​

○​ Not repetitive (avoid stock updates, daily news summaries, etc.)​

Step 3: Understand the Search Endpoint


Study the endpoint:

[Link]

Understand these parameters:

●​ channelId​

●​ part → snippet, id​


●​ maxResults → up to 50​

●​ order → date​

●​ pageToken → for pagination​

Step 4: Write Basic API Request Script


Write a Python script to:

1.​ Send API request​

2.​ Pass required parameters​

3.​ Retrieve JSON response​

4.​ Print sample output​

Step 5: Implement Pagination Logic


Since maxResults = 50:

Interns must:

1.​ Use nextPageToken​

2.​ Loop until no pages remain​

3.​ Collect videos from all pages​

4.​ Avoid duplicate entries​

Step 6: Extract Required Fields


From each video extract only:

●​ video_id​
●​ title​

●​ published_date​

Create a clean structured list/dictionary.

Step 7: Convert Data to DataFrame


Using Pandas or Polars:

1.​ Convert extracted data into DataFrame​

2.​ Name columns clearly:​

○​ video_id​

○​ title​

○​ publish_date​

Step 8: Basic Data Validation


Interns must:

1.​ Check total number of rows​

2.​ Check duplicate video IDs​

3.​ Verify no null values​

4.​ Print dataset shape​

Step 9: Save Dataset


Save dataset as:

●​ CSV (mandatory)​

●​ Optional: Parquet​
Example:

raw_metadata.csv

You might also like