Skip to content

prajwaliyer/youtube-timestamp-search

Repository files navigation

YouTube Timestamp Search

Introduction

YouTube Timestamp Search allows you to search for short segments in videos all over YouTube. After inputting a query, the user is returned with 5 relevant segments that may come from various videos. Clicking on any of these will take you directly to the timestamped portion of the video in which the segment exists. A short summary generated by ChatGPT describing the segment is also displayed, so that users can make educated choices.

Developer Setup

  1. Install libraries with pip install -r requirements.txt
  2. Obtain youtube-api-credentials.json
  3. Create .env (environment file) with OpenAI API key and organization key, as well as YouTube Data API key
  4. Run the app: flask run

How it works

  1. User Query: The user enters a search query, which is then used to obtain relevant videos and their transcripts through the YouTube API.
  2. Transcript Segmentation: The transcripts are divided into 3-minute sections to improve the granularity of search results.
  3. Embeddings Generation: Using OpenAI's API, specifically the ada model, embeddings are generated for both the segmented transcripts and the user's search query.
  4. Cosine Similarity Calculation: The cosine similarity between the embeddings of the query and the segmented transcripts is calculated to determine the relevance of each transcript section to the user's search query.
  5. Ranking: The application returns the top 5 video segments based on the cosine similarity scores, ensuring that the most relevant content is displayed to the user.
  6. Summarization: For each of the top results, a one-line summary of the 3-minute transcript section is generated using ChatGPT via OpenAI's API. This summary provides users with a brief overview of the content before clicking on the video.
  7. Direct Access: The user can click on the video thumbnail to be taken directly to the video and timestamp that the segment exists in.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published