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:
2026-05-26 21:55:52 +02:00
parent 52279752e4
commit 62c2c73906
2 changed files with 9 additions and 18 deletions

View File

@@ -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)