A python package that utilizes the YouTube Data V3 API to get all transcripts from a given channel/playlist.
Project description
YouTube-Data-and-Transcript-API
Overview
This project provides a Python-based tool that interacts with the YouTube Data API to retrieve video data and transcripts. The goal is to enable easy access to video metadata and subtitles for analysis, research, or other applications.
Features
- Retrieve video metadata such as title, description, view count, like count, and more.
- Fetch video transcripts (subtitles) when available.
- Easy-to-use command-line interface.
Requirements
- Python 3.6 or higher
requestslibrarygoogle-authlibrary (for authenticated API access)youtube-transcript-apilibrary
Installation
-
Clone the repository:
git clone https://github.com/DevanshL/YouTube-Data-and-Transcript-API.git cd YouTube-Data-and-Transcript-API
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
-
Install the required Python packages:
pip install -r requirements.txt
-
Create a Google Cloud project and enable the YouTube Data API v3:
- Visit the Google Cloud Console.
- Create a new project (or use an existing one).
- Enable the YouTube Data API v3 for your project.
- Create API credentials and obtain your API key.
-
Setting Up the config.json File:
- Create a config.json file in the testing folder of the project.
- The config.json file should contain your API key. Here’s an example structure:
{ "api_key": "YOUR_YOUTUBE_API_KEY" }
- Replace YOUR_YOUTUBE_API_KEY with your actual API key.
Usage
- Create a testing,.py file and use below code
from working.data import fetch_video_info
from working.transcript import fetch_transcript
import json
def load_api_key_from_json(file_path):
with open(file_path, 'r') as file:
data = json.load(file)
return data['youtube_api_key']
api_key = load_api_key_from_json('filepath')
video_id = '' # example H9dCIPzRf
details = fetch_video_info(video_id, api_key)
transcript = fetch_transcript(video_id)
# print(details)
# print(transcript) check for yourself
Contributing
If you would like to contribute to this project, feel free to open an issue or submit a pull request. Please ensure that your contributions align with the coding style and standards used in this project.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ytube_data_and_transcript-0.1.0.tar.gz.
File metadata
- Download URL: ytube_data_and_transcript-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
def4497faa1bc04a2b6d061454a3e2b1db24a4663f9bc8fba7c67d0606d39f42
|
|
| MD5 |
f2f89a577d347565c99ce25e911af6f4
|
|
| BLAKE2b-256 |
d2bfd5bb5d5f1a996a380a6d10493cfcdd4e8582e974bee31ddfca36488a80c8
|
File details
Details for the file ytube_data_and_transcript-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ytube_data_and_transcript-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7852de03367e45eff0a77d1d070d4548e49e839d5480239077e49562ab711cbf
|
|
| MD5 |
f0c16075527f5186f73688bda37ab984
|
|
| BLAKE2b-256 |
4411f246a5093b52079445df9071f4cd809f73e8feedfde8dcc238b038c5abcf
|