llama-index readers youtube-metadata integration
Project description
LlamaIndex Readers Integration: Youtube-Metadata
pip install llama_index.readers.youtube_metadata
This loader fetches the metadata of Youtube videos using the Google APIs. (https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&id={videos_string}&key={api_key}). You must have a Google API key to use.
Transcripts of the text transcript of Youtube videos is fetched using the youtube_transcript_api
Python package.
Usage
Simply pass an array of YouTube Video_ID into load_data
.
from llama_index.readers.youtube_metadata import YoutubeMetaData
api_key = "Axxxxx" # youtube API Key
video_ids = ["S_0hBL4ILAg", "a2skIq6hFiY"]
youtube_meta = YoutubeMetaData(api_key)
details = youtube_meta.load_data(video_ids)
This can be combined with the YoutubeTranscriptReader to provide more information for RAG AI inquiries.
from llama_index.readers.youtube_transcript import YoutubeTranscriptReader
from llama_index.readers.youtube_metadata import YoutubeMetaData
video_ids = ["S_0hBL4ILAg", "a2skIq6hFiY"] # Example video IDs
yt_metadata = YouTubeMetaData(api_key=api_key)
print("Testing YouTubeMetaData...")
print(yt_metadata.load_data(video_ids))
yt_meta_transcript = YouTubeMetaDataAndTranscript(api_key=api_key)
print("Testing YouTubeMetaDataAndTranscript...")
print(yt_meta_transcript.load_data(video_ids))
The Video_id for youtube videos is right in the URL. In this URL: https://www.youtube.com/watch?v=a2skIq6hFiY&t=60s
The video_Id is 'a2skIq6hFiY&t'.
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
Hashes for llama_index_readers_youtube_metadata-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7337516e994cdfd24ded813f4449b98bee0c6a427c616e111aaaca68987b2b8f |
|
MD5 | 5a4fa0df4d7eec0eee218af1d44a67ca |
|
BLAKE2b-256 | a7e2d63c901b39692f29fcd7c5bdb2f6d2927cf58b67f8d0c6ea05a912436247 |
Hashes for llama_index_readers_youtube_metadata-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20a419317a138ce687d24e8167bf30a41c2ecc5ac844b32ea21c55e0eda8fecc |
|
MD5 | 278a234647a4496d16c2e625349abf61 |
|
BLAKE2b-256 | 6e4ad1534dc47726a56f4838534ff488daff9ab2262e3a3bd1fdf938fd296a26 |