Expand discovery pool and remove header logo
Double search results per query (20→40), increase query budget (15→25), use more tags per signal (6→10-12), index more new channels per refresh (5→10). Remove the YT logo from the header. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 */}
|
||||
<header className="shrink-0 z-40 bg-zinc-950/90 backdrop-blur border-b border-zinc-800">
|
||||
<div className="max-w-screen-xl mx-auto px-3 h-12 sm:h-14 flex items-center gap-2 sm:gap-4">
|
||||
{/* Logo */}
|
||||
<button
|
||||
onClick={() => navigate("/")}
|
||||
className="font-display font-bold text-base sm:text-lg text-zinc-100 shrink-0 tracking-tight"
|
||||
>
|
||||
YT
|
||||
</button>
|
||||
|
||||
{/* Search — min-w-0 prevents it from overflowing on narrow screens */}
|
||||
<div className="flex-1 min-w-0">
|
||||
<SearchBar />
|
||||
|
||||
Reference in New Issue
Block a user