Loading repository data…
Loading repository data…
RockManRK / repository
This project presents a straightforward and simple approach to collecting, processing and storing data from YouTube channels using the YouTube Data API and storing it in an SQL database, all implemented in a Jupyter Notebook
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This repository contains a Jupyter Notebook (youtube_data_download.ipynb) that demonstrates how to download data from YouTube using the YouTube Data API.
This Python script performs the following tasks:
The primary goal of this project is to serve as a portfolio piece and a learning exercise in working with APIs, data processing, and database management.
Before you begin, ensure you have met the following requirements:
For those who want to get up and running quickly:
git clone https://github.com/RockManRK/YouTubeDataCollectorpip install -r requirements.txtschema.sql file and replace {DATABASE_NAME} with your desired database name.mysql -u your_username -p < schema.sql.env file with your database credentials and YouTube API keyjupyter notebook youtube_data_download.ipynbFor more detailed instructions, see the full installation and usage sections below.
YouTubeDataCollector/
│
├── .env.example # Example environment variable file
├── .gitignore # Git ignore rules
├── LICENSE # License file (MIT)
├── requirements.txt # Python dependencies
├── schema.sql # SQL script to set up the initial database
├── youtube_data_download.ipynb # Main Jupyter notebook with the code
└── README.md # This file
git clone https://github.com/RockManRK/YouTubeDataCollector
cd YouTubeDataCollector
pip install -r requirements.txt
In the project directory, you'll find a file named .env.example. This file contains template environment variables.
Create a copy of this file and name it .env. You can do this in several ways:
cp .env.example .env
copy .env.example .env
.env and copy the contents of .env.example into it using any text editor.Open the newly created .env file in a text editor.
Update the values in the .env file with your specific details:
YOUR_YOUTUBE_API_KEY with the API key you obtained from the Google Developers Console.Save the .env file.
This configuration file will be used by the script to access your YouTube API key and connect to your database.
If you haven't obtained a YouTube API key yet, follow these steps:
.env file as described above.For detailed instructions, refer to the YouTube Data API documentation.
This project requires a MySQL database. Follow these steps to set up the required database structure:
Open the schema.sql file in a text editor.
Replace all occurrences of {DATABASE_NAME} with your desired database name.
Run the SQL script in your MySQL environment. You can do this in several ways:
a. Via command line:
mysql -u your_username -p < schema.sql
Replace your_username with your MySQL username. You'll be prompted to enter your password.
b. Or, if you prefer to enter your password directly in the command:
mysql -u your_username -pyour_password < schema.sql
Replace your_username and your_password with your MySQL credentials. Note that there is no space between -p and your password.
c. Alternatively, you can use a MySQL client like MySQL Workbench:
schema.sql fileThis will create the necessary database and tables for the YouTubeDataCollector to function.
Note: Ensure that your MySQL server is running before executing these commands. If you encounter any permission issues, you may need to use sudo (on Unix-like systems) or run your command prompt as an administrator (on Windows).
jupyter notebook youtube_data_download.ipynb
When you run the notebook, you can expect the following:
Note: The process may take some time depending on the number of channels and videos being processed.
While not part of this repository, the collected data is visualized using Power BI. You can view the dashboard here: YouTube Channel Analytics Dashboard
This project is licensed under the MIT License - see the LICENSE file for details.
Davi Prata
If you have any questions, please open an issue or contact Me.
requirements.txt: This file contains a list of Python packages required to run the project. Ensure you install these packages using the command provided in the Installation section..env.example: This file serves as a template for your environment variables. Copy this file to .env and update it with your specific configuration details.