ilsa15 commited on
Commit
1861402
·
verified ·
1 Parent(s): 722b5c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
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
- return [(v['id']['videoId'], v['snippet']['title']) for v in videos if v['id']['kind'] == 'youtube#video']
 
 
 
 
 
 
 
 
 
 
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):