bako96 commited on
Commit
da8cbf2
·
verified ·
1 Parent(s): e00059f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -18,15 +18,22 @@ def get_youtube_channel_info(channel_name: str) -> str:
18
  # Use DuckDuckGoSearchTool to search for the YouTube channel
19
  search_tool = DuckDuckGoSearchTool()
20
  query = f"{channel_name} YouTube channel information"
 
21
  search_results = search_tool.search(query)
22
 
 
 
 
23
  # Extract and return the top result
24
  if search_results and len(search_results) > 0:
25
  top_result = search_results[0] # Get the first result
 
26
  return f"Top search result for '{channel_name}': {top_result}"
27
  else:
 
28
  return f"No information found for YouTube channel '{channel_name}'."
29
  except Exception as e:
 
30
  return f"Error fetching YouTube channel information: {str(e)}"
31
 
32
  @tool
 
18
  # Use DuckDuckGoSearchTool to search for the YouTube channel
19
  search_tool = DuckDuckGoSearchTool()
20
  query = f"{channel_name} YouTube channel information"
21
+ print(f"Searching for: {query}") # Debug print statement
22
  search_results = search_tool.search(query)
23
 
24
+ # Print all search results for debugging
25
+ print(f"Search results for '{channel_name}': {search_results}")
26
+
27
  # Extract and return the top result
28
  if search_results and len(search_results) > 0:
29
  top_result = search_results[0] # Get the first result
30
+ print(f"Top search result: {top_result}") # Debug print statement
31
  return f"Top search result for '{channel_name}': {top_result}"
32
  else:
33
+ print(f"No results found for '{channel_name}'.") # Debug print statement
34
  return f"No information found for YouTube channel '{channel_name}'."
35
  except Exception as e:
36
+ print(f"Error occurred while searching for '{channel_name}': {str(e)}") # Debug print statement
37
  return f"Error fetching YouTube channel information: {str(e)}"
38
 
39
  @tool