import streamlit as st import requests import os from bs4 import BeautifulSoup # Configure DeepSeek DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY") DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions" def scrape_website(url, max_pages=3): """Scrapes content from the given website URL.""" if not url.startswith("http"): url = f"https://{url}" try: response = requests.get(url, timeout=10) response.raise_for_status() soup = BeautifulSoup(response.content, "html.parser") # Extract meaningful content content = [] # Get meta description meta_description = soup.find("meta", {"name": "description"}) if meta_description and meta_description.get("content"): content.append(meta_description["content"]) # Get main content for tag in ['h1', 'h2', 'p']: elements = soup.find_all(tag) content.extend([elem.get_text(strip=True) for elem in elements if elem.get_text(strip=True)]) return " ".join(content[:1500]) except Exception as e: st.error(f"Error scraping website: {str(e)}") return None def generate_marketing_plan(business_info): """Generate comprehensive video marketing plan using DeepSeek""" prompt = f"""As a video marketing strategist specializing in conversion optimization, create a comprehensive video funnel strategy based on this business information: {business_info} Develop a sophisticated 12-month video marketing strategy that includes: 1. CORE STRATEGY - First, summarize the overall strategy you recommend and how you expect it to deliver results for the business. - Identify 3 unique angles or approaches that would differentiate this business's video content, ensuring that these are approaches that make the business stand out from their competitors - Suggest innovative ways to showcase the business's unique value proposition - Recommend specific storytelling techniques that would resonate with their target audience 2. FUNNEL ARCHITECTURE For each stage below, provide specific video content ideas that move prospects forward: - Awareness: Pattern interruption content that stops the scroll and helps the viewer meet the busines for the first time - Considertion: Trust-building content that demonstrates expertise - Conversion: Conversion content that overcomes objections - Post-Purchase: Retention content that drives referrals 3. CONTENT BLUEPRINTS For the 3 most important videos identified: - Detailed content outline - Key messaging points - Specific hooks to grab attention - Call-to-action strategy - Ideal length and format - Platform-specific optimizations 4. PRODUCTION GUIDELINES - Visual style recommendations - Music and sound design suggestions - Text overlay strategies - Thumbnail design principles - Specific examples of successful videos to model 5. DISTRIBUTION STRATEGY - Primary platform strategy with posting frequency - Cross-platform repurposing guide - Hashtag and keyword recommendations - Best times to post - Community engagement tactics 6. MEASUREMENT FRAMEWORK - Primary KPIs for each funnel stage - Engagement metrics to track - Conversion tracking setup - A/B testing recommendations - Monthly review process Format the response with clear markdown headers and bullet points. Focus on providing unique, specific recommendations rather than generic advice. Include actual examples and detailed tactics whenever possible. For each recommendation, explain the strategic reasoning behind it so the business understands not just what to do, but why it matters for their specific situation.""" headers = { "Authorization": f"Bearer {DEEPSEEK_API_KEY}", "Content-Type": "application/json" } data = { "model": "deepseek-chat", "messages": [ { "role": "system", "content": """You are a leading video marketing strategist who combines the philosophical approaches of: - Gary Vaynerchuk's pattern interruption and documenting-over-creating methodology - Alex Hormozi's high-ticket offer presentation framework - Mr Beast's viral engineering techniques and thumbnail psychology - Alyssa Ago's short-form storytelling frameworks - Owen Video's Video 10x Strategy - Think Media's platform-specific optimization tactics You've spent 15 years helping businesses build video marketing funnels that convert. Your approach is influenced by: - Russell Brunson's Value Ladder concept - Donald Miller's StoryBrand Framework - Seth Godin's Permission Marketing - Joe Pulizzi's Content Inc. Methodology Your specific expertise includes: - Behavioral psychology in video engagement (attention triggers, pattern interrupts, hooks) - Platform-specific algorithms (YouTube, TikTok, Instagram, LinkedIn) - Video SEO and discoverability optimization - Short-form vs long-form content strategy - Retention curve analysis and optimization - Multi-platform content distribution - Thumb-stopping content creation - Video conversion rate optimization - Analytics and performance tracking For each business, you create custom strategies that: 1. Focus on their unique market position 2. Leverage their specific competitive advantages 3. Address their target audience's scroll patterns 4. Account for their resource constraints 5. Build toward their business objectives Your recommendations are always specific, actionable, and based on proven case studies from your work with similar businesses.""" }, {"role": "user", "content": prompt} ], "temperature": 0.7, "max_tokens": 4000 } try: response = requests.post(DEEPSEEK_ENDPOINT, json=data, headers=headers) response.raise_for_status() return response.json()["choices"][0]["message"]["content"] except Exception as e: st.error(f"API Error: {str(e)}") return None # Streamlit UI st.set_page_config(page_title="Video Funnel Generator", layout="wide") st.title("🎥 AI Video Marketing Strategist") st.markdown("### Generate a comprehensive video marketing funnel for your business") # Input method selection input_method = st.radio( "Choose input method:", ["Enter business details manually", "Use website URL"] ) if input_method == "Enter business details manually": business_name = st.text_input("Business Name*") business_description = st.text_area( "What does your company do?*", help="Describe your products/services and what makes you unique" ) ideal_client = st.text_area( "Describe your ideal client. Include more details for a better funnel plan.*", help="Include demographics, challenges they face, and why they need your solution" ) current_marketing = st.text_area( "Current marketing efforts (optional)", help="What marketing strategies are you currently using? What's working/not working?" ) if st.button("Generate Marketing Plan"): if not all([business_name, business_description, ideal_client]): st.error("Please fill in all required fields marked with *") else: with st.spinner("Creating your custom video marketing strategy..."): business_info = f""" Business Name: {business_name} Business Description: {business_description} Ideal Client Profile: {ideal_client} Current Marketing: {current_marketing if current_marketing else 'Not provided'} """ plan = generate_marketing_plan(business_info) if plan: st.markdown(plan) else: website_url = st.text_input( "Enter your website URL*", placeholder="e.g., www.example.com" ) if st.button("Generate Marketing Plan"): if not website_url: st.error("Please enter your website URL") else: with st.spinner("Analyzing your website and creating your marketing strategy..."): website_content = scrape_website(website_url) if website_content: plan = generate_marketing_plan(website_content) if plan: st.markdown(plan)