diff --git a/backend/services/discovery.py b/backend/services/discovery.py index 5ac37c1..40f4a0f 100644 --- a/backend/services/discovery.py +++ b/backend/services/discovery.py @@ -106,7 +106,7 @@ def _search_and_store( discovered: dict[str, dict] = {} for query in queries: try: - results = ytdlp.search_youtube(query, max_results=20) + results = ytdlp.search_youtube(query, max_results=40) for video in results: ch = video.get("channel", {}) yt_id = ch.get("youtube_channel_id") @@ -176,7 +176,7 @@ def _search_and_store( db.commit() - for channel_id in needs_indexing[:5]: + for channel_id in needs_indexing[:10]: channel = db.query(Channel).filter_by(id=channel_id).first() if channel: _fetch_and_index_channel(db, channel) @@ -251,16 +251,16 @@ def crawl_by_search(db: Session, user_id: int): ).mappings().all() # Build query pool: top tags + random channel names + categories - top_tags = [t for t, _ in sorted(tag_counts.items(), key=lambda x: -x[1])[:6]] + top_tags = [t for t, _ in sorted(tag_counts.items(), key=lambda x: -x[1])[:12]] top_cats = [r["category"] for r in cat_rows] # Random sample of followed channel names — diversifies discovery each run sampled_names: list[str] = [] if followed_names: - sampled_names = random.sample(followed_names, min(8, len(followed_names))) + sampled_names = random.sample(followed_names, min(15, len(followed_names))) # Combine: tags (most signal) + channel names (broad reach) + categories (fallback) - queries = list(dict.fromkeys(top_tags + sampled_names + top_cats))[:15] + queries = list(dict.fromkeys(top_tags + sampled_names + top_cats))[:25] if not queries: return @@ -380,7 +380,7 @@ def update_liked_signal(db: Session, user_id: int): {"user_id": user_id}, ).scalars().all()) - top_tags = [t for t, _ in sorted(tag_counts.items(), key=lambda x: -x[1])[:6]] + top_tags = [t for t, _ in sorted(tag_counts.items(), key=lambda x: -x[1])[:10]] neg_tags = frozenset( r["tag"] for r in db.execute( text("SELECT tag FROM user_tag_affinity WHERE user_id = :user_id AND score < -2"), @@ -440,7 +440,7 @@ def update_watch_signal(db: Session, user_id: int): {"user_id": user_id}, ).scalars().all()) - top_tags = [t for t, _ in sorted(qualified.items(), key=lambda x: -x[1])[:6]] + top_tags = [t for t, _ in sorted(qualified.items(), key=lambda x: -x[1])[:10]] neg_tags = frozenset( r["tag"] for r in db.execute( text("SELECT tag FROM user_tag_affinity WHERE user_id = :user_id AND score < -2"), @@ -571,7 +571,7 @@ def update_trending_signal(db: Session, user_id: int, regions: list[str]): db.commit() - for channel_id in needs_indexing[:5]: + for channel_id in needs_indexing[:10]: channel = db.query(Channel).filter_by(id=channel_id).first() if channel: _fetch_and_index_channel(db, channel) diff --git a/frontend/src/components/Layout.jsx b/frontend/src/components/Layout.jsx index 771cc72..97d6ed2 100644 --- a/frontend/src/components/Layout.jsx +++ b/frontend/src/components/Layout.jsx @@ -1,4 +1,4 @@ -import { Outlet, NavLink, useNavigate, Link, useLocation } from "react-router-dom"; +import { Outlet, NavLink, Link, useLocation } from "react-router-dom"; import { useQuery } from "@tanstack/react-query"; import { useAuth } from "../hooks/useAuth"; import SearchBar from "./SearchBar"; @@ -203,7 +203,6 @@ function useNewVideosCount() { export default function Layout() { const { user, logout } = useAuth(); - const navigate = useNavigate(); const newCount = useNewVideosCount(); return ( @@ -211,14 +210,6 @@ export default function Layout() { {/* Header */}
- {/* Logo */} - - {/* Search — min-w-0 prevents it from overflowing on narrow screens */}