Skip to content

Commit 658ae5b

Browse files
Add files via upload
1 parent afb481b commit 658ae5b

File tree

1 file changed

+65
-0
lines changed
  • Youtube_video_finder_using_geminillm

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"This is a Open source project initiated by me -you can fork, edit, and make a pull request"
2+
3+
````markdown
4+
# YouTube Relevance Finder with Gemini AI
5+
6+
This Python script searches YouTube for recent videos based on a user query and ranks them by relevance using Google's Gemini AI model. It filters results by duration and recency, scores video titles for relevance, and returns the top-ranked videos.
7+
8+
## 🔍 Features
9+
10+
- Searches YouTube for videos from the past 14 days
11+
- Filters videos by duration (4–20 minutes)
12+
- Uses Gemini AI to score title relevance to a query
13+
- Prints the top relevant video links with scores and metadata
14+
15+
## 🛠️ Setup
16+
17+
1. **Clone the repository**:
18+
```bash
19+
git clone https://github.com/yourusername/your-repo-name.git
20+
cd your-repo-name
21+
````
22+
23+
2. **Install dependencies**:
24+
25+
```bash
26+
pip install google-api-python-client google-generativeai
27+
```
28+
29+
3. **Set up environment variables**:
30+
Create a `.env` file or export in terminal:
31+
32+
```bash
33+
export YT_API_KEY=your_youtube_api_key
34+
export GEMINI_API_KEY=your_gemini_api_key
35+
```
36+
37+
## 🚀 Usage
38+
39+
Run the script:
40+
41+
```bash
42+
python your_script_name.py
43+
```
44+
45+
You'll be prompted to enter a search query. The script will then display a list of the top relevant YouTube videos based on that query.
46+
47+
## 📄 Example Output
48+
49+
```
50+
1.
51+
• Title: Learn Python in 10 Minutes
52+
• URL: https://youtu.be/xyz123
53+
• Score: 9.2
54+
• Duration: 10m30s
55+
• Published: 2025-05-01T12:34:56Z
56+
```
57+
58+
## 📌 Notes
59+
60+
* Make sure you have valid API keys for both YouTube Data API v3 and Google Gemini.
61+
* The script currently uses the `gemini-1.5-flash-latest` model.
62+
63+
## 📃 License
64+
65+
Open source – feel free to use and modify

0 commit comments

Comments
 (0)