Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -200,7 +200,17 @@ def get_latest_video_ids(channel_id, max_results=5):
|
|
| 200 |
url = f"https://www.googleapis.com/youtube/v3/search?key={YOUTUBE_API_KEY}&channelId={channel_id}&part=snippet,id&order=date&maxResults={max_results}"
|
| 201 |
response = requests.get(url)
|
| 202 |
videos = response.json().get('items', [])
|
| 203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
# --- Get video transcripts ---
|
| 206 |
def get_video_transcripts(video_info):
|
|
|
|
| 200 |
url = f"https://www.googleapis.com/youtube/v3/search?key={YOUTUBE_API_KEY}&channelId={channel_id}&part=snippet,id&order=date&maxResults={max_results}"
|
| 201 |
response = requests.get(url)
|
| 202 |
videos = response.json().get('items', [])
|
| 203 |
+
|
| 204 |
+
valid_videos = []
|
| 205 |
+
for v in videos:
|
| 206 |
+
if v['id']['kind'] == 'youtube#video':
|
| 207 |
+
title = v['snippet']['title']
|
| 208 |
+
channel_title = v['snippet']['channelTitle']
|
| 209 |
+
video_id = v['id']['videoId']
|
| 210 |
+
if "icodeguru" in channel_title.lower(): # ✅ Extra validation
|
| 211 |
+
valid_videos.append((video_id, title))
|
| 212 |
+
return valid_videos
|
| 213 |
+
|
| 214 |
|
| 215 |
# --- Get video transcripts ---
|
| 216 |
def get_video_transcripts(video_info):
|