-
Notifications
You must be signed in to change notification settings - Fork 1k
built youtube trend ananalysis agent #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Entelligence AI Vulnerability ScannerStatus: No security vulnerabilities found Your code passed our comprehensive security analysis. Analyzed 2 files in total |
Review Summaryπ·οΈ Draft Comments (6)
|
WalkthroughThis PR introduces a new YouTube Trend Analysis Agent feature that enables content creators to analyze their channel performance and discover trending topics. The implementation includes a Streamlit-based web application that integrates multiple services: yt-dlp for scraping YouTube channel data, Memori v3 for semantic search and storage of video metadata, OpenAI for LLM-powered reasoning, and Exa AI for fetching web trend context. The agent allows users to ingest their YouTube content, chat with an AI advisor, and receive data-driven video content recommendations based on their existing videos and current market trends. The feature is packaged as a standalone module with comprehensive documentation and configuration. Changes
Sequence DiagramThis diagram shows the interactions between components: sequenceDiagram
actor User
participant Streamlit as Streamlit App
participant Core as Core Functions
participant YouTube as YouTube (yt-dlp)
participant Memori as Memori Service
participant Exa as Exa API
participant Agent as Agno Agent
participant OpenAI as OpenAI
Note over User,OpenAI: Channel Ingestion Flow
User->>Streamlit: Enter API keys & channel URL
User->>Streamlit: Click "Ingest channel into Memori"
Streamlit->>Core: ingest_channel_into_memori(channel_url)
Core->>YouTube: Scrape channel videos (yt-dlp)
YouTube-->>Core: Video metadata (titles, views, descriptions)
Core->>Memori: Store video data
Memori-->>Core: Confirmation
Core-->>Streamlit: Return video count
Streamlit-->>User: Display success message
Note over User,OpenAI: Chat/Analysis Flow
User->>Streamlit: Ask question about trends
Streamlit->>Streamlit: Append to messages
alt Memori available
Streamlit->>Memori: search(prompt, limit=5)
Memori-->>Streamlit: Relevant video snippets
end
Streamlit->>Streamlit: Build video summaries from session
alt Exa API configured
alt Exa trends not cached
Streamlit->>Core: fetch_exa_trends(channel_name, videos)
Core->>Exa: Search web trends for niche
Exa-->>Core: External trend data
Core-->>Streamlit: Formatted trends
Streamlit->>Streamlit: Cache trends in session
else Exa trends cached
Streamlit->>Streamlit: Reuse cached trends
end
end
Streamlit->>Streamlit: Build full_prompt with context
Note over Streamlit: Combines: user question, Memori results,<br/>video summaries, Exa trends
Streamlit->>Agent: Create Agent with OpenAIChat model
Streamlit->>Agent: run(full_prompt)
Agent->>OpenAI: Generate response
OpenAI-->>Agent: AI-generated analysis
Agent-->>Streamlit: result.content
Streamlit->>Streamlit: Append to messages
Streamlit-->>User: Display response
π Cross-Repository Impact AnalysisEnable automatic detection of breaking changes across your dependent repositories. β Set up now Learn more about Cross-Repository AnalysisWhat It Does
How to Enable
Benefits
Note for WindsurfPlease change the default marketplace provider to the following in the windsurf settings:Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items Entelligence.ai can learn from your feedback. Simply add π / π emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
Also you can trigger various commands with the bot by doing The current supported commands are
More commands to be added soon. |
| else: | ||
| with st.spinner( | ||
| "π₯ Scraping channel and ingesting videos into Memoriβ¦" | ||
| ): | ||
| count = ingest_channel_into_memori(channel_url_input.strip()) | ||
| st.success(f"β Ingested {count} video(s) into Memori.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
security: User-supplied channel_url_input is passed directly to ingest_channel_into_memori without validation, allowing SSRF or command injection if the downstream function is vulnerable, leading to potential remote code execution or data exfiltration.
π€ AI Agent Prompt for Cursor/Windsurf
π Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In memory_agents/youtube_trend_agent/app.py, lines 112-117, the user-supplied channel_url_input is passed directly to ingest_channel_into_memori without validation, which could allow SSRF or command injection if the downstream function is vulnerable. Add a check to ensure the URL starts with 'https://www.youtube.com/' or 'https://youtube.com/' before calling the ingestion function, and show a warning if the URL is invalid.
π Committable Code Suggestion
βΌοΈ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| else: | |
| with st.spinner( | |
| "π₯ Scraping channel and ingesting videos into Memoriβ¦" | |
| ): | |
| count = ingest_channel_into_memori(channel_url_input.strip()) | |
| st.success(f"β Ingested {count} video(s) into Memori.") | |
| else: | |
| url = channel_url_input.strip() | |
| if not (url.startswith("https://www.youtube.com/") or url.startswith("https://youtube.com/")): | |
| st.warning("Invalid YouTube channel or playlist URL.") | |
| else: | |
| with st.spinner( | |
| "π₯ Scraping channel and ingesting videos into Memoriβ¦" | |
| ): | |
| count = ingest_channel_into_memori(url) | |
| st.success(f"β Ingested {count} video(s) into Memori.") |
π Linked Issue
Closes #
β Type of Change
π Summary
π README Checklist
README.mdfile for my project.README.mdfollows the official.github/README_TEMPLATE.md.README.md.assetsfolder and included it in myREADME.md.βοΈ Contributor Checklist
advance_ai_agents,rag_apps).requirements.txtorpyproject.tomlfor dependencies..env.examplefile if environment variables are needed and ensured no secrets are committed.π¬ Additional Comments
EntelligenceAI PR Summary
This PR adds a new YouTube Trend Analysis Agent feature that combines yt-dlp, Memori v3, OpenAI, and Exa AI to help content creators analyze channel performance and discover trending topics.