eaglelandsonce commited on
Commit
0566c23
1 Parent(s): cca39e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -25,7 +25,10 @@ if api_key:
25
 
26
  channels = []
27
  for search_result in search_response.get("items", []):
28
- channels.append((search_result["snippet"]["title"], search_result["id"]["channelId"]))
 
 
 
29
  return channels
30
 
31
  def get_videos_from_channel(channel_id):
@@ -65,7 +68,7 @@ if api_key:
65
  try:
66
  channels = youtube_search(query)
67
  if channels:
68
- channel_options = {name: id for name, id in channels}
69
  channel_name = st.selectbox('Select a channel:', list(channel_options.keys()))
70
  channel_id = channel_options[channel_name]
71
  videos = get_videos_from_channel(channel_id)
 
25
 
26
  channels = []
27
  for search_result in search_response.get("items", []):
28
+ channel_title = search_result["snippet"]["title"]
29
+ channel_id = search_result["id"]["channelId"]
30
+ channel_url = f"https://www.youtube.com/channel/{channel_id}"
31
+ channels.append((channel_title, channel_id, channel_url))
32
  return channels
33
 
34
  def get_videos_from_channel(channel_id):
 
68
  try:
69
  channels = youtube_search(query)
70
  if channels:
71
+ channel_options = {f"[{name}]({url})": id for name, id, url in channels}
72
  channel_name = st.selectbox('Select a channel:', list(channel_options.keys()))
73
  channel_id = channel_options[channel_name]
74
  videos = get_videos_from_channel(channel_id)