惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
MyScale Blog
MyScale Blog
Y
Y Combinator Blog
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
N
News and Events Feed by Topic
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 【当耐特】
N
Netflix TechBlog - Medium
博客园 - 叶小钗
B
Blog
Vercel News
Vercel News
T
Tenable Blog
T
The Exploit Database - CXSecurity.com
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Microsoft Security Blog
Microsoft Security Blog
S
Securelist
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
DataBreaches.Net
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler
G
GRAHAM CLULEY
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Check Point Blog
A
About on SuperTechFans
W
WeLiveSecurity
The GitHub Blog
The GitHub Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How I built a YouTube performance classifier that adjusts tomorrow's video script bias
MORINAGA · 2026-06-26 · via DEV Community

I've been running an automated YouTube channel alongside three programmatic directory sites since April. The video side uses a two-host VTuber pipeline that generates daily scripts and renders them overnight. What I didn't have until last week was any feedback mechanism — the script generator just produced content in a vacuum, with no idea which videos were actually landing.

The fix is scripts/yt-analytics/run.py, a 330-line Python script that runs daily, reads the last 30 videos via the YouTube Data API v3, classifies them as high or low performers, and writes bias hints back to docs/yt-knowhow-bank-en.md — the same file the script generator reads before each session.

This is a closed loop, not magic. But closing the loop is the entire point.

Fetching the Channel Without a Stable Channel ID

The first problem was channel resolution. YouTube's v3 API takes a channel ID in most endpoints, but I didn't want to hardcode an ID that might break if the channel was ever recreated. The script tries four strategies in order:

  1. forHandle with the value of a YT_CHANNEL_HANDLE environment variable
  2. forHandle=claudeautomate
  3. forHandle=claude_automate
  4. forHandle=claude-automate
  5. If all fail: a search API call for "claude automate" with a loop over returned channel IDs
for handle in handles:
    body = http_get(
        f"...channels?part=contentDetails,statistics,snippet&forHandle={handle}&key={api_key}"
    )
    items = body.get("items") or []
    if items:
        return items[0]

The search fallback is slower and burns more quota but fires only when every direct handle attempt fails. In practice, claudeautomate matches on the first try.

Once the channel resolves, relatedPlaylists.uploads gives the uploads playlist ID. From there, playlistItems returns up to 30 recent videos with their IDs, which feeds a second videos.list request for statistics.

Classifying Videos as High or Low

The classifier is deliberately simple: median-based thresholds, no machine learning.

views = [int(v["statistics"].get("viewCount", 0)) for v in videos]
median = statistics.median(views)

for v, view in zip(videos, views):
    published = datetime.fromisoformat(v["snippet"]["publishedAt"].replace("Z", "+00:00"))
    age_h = (now - published).total_seconds() / 3600

    if view >= median * 1.5:
        high.append(v)
    elif view <= median * 0.6 and age_h >= 72:
        low.append(v)

Videos above 1.5× median views are HIGH. Videos below 0.6× median — but only if they're more than 72 hours old — are LOW. The 72-hour grace period matters: a video posted yesterday with 40% of median views might just be young. Flagging it as a dud immediately would be noise.

Everything between 0.6× and 1.5× is neither — not actionable signal, so I ignore it.

The choice of median over mean is deliberate. If one video goes viral, the mean view count distorts every other video's classification. Median is resistant to outliers. This is a lesson I learned from the three-tier content quality approach on the directory side: simple bucketing beats trying to optimize a single number.

Matching Archetypes via Title Overlap

The script generator assigns each produced video an archetype label — "tutorial", "recap", "comparison", "technical" — and saves it in the uploaded queue under content/yt-queue/uploaded/. But YouTube's analytics API doesn't expose those labels. I need to reconnect the archetype to the performance stats.

The reconnection happens via title overlap:

def title_overlap(a: str, b: str) -> int:
    aw = {w.lower().strip(",.!?:;\"'") for w in a.split() if len(w) > 2}
    bw = {w.lower().strip(",.!?:;\"'") for w in b.split() if len(w) > 2}
    return len(aw & bw)

For each video in the API response, I compare its title against every uploaded queue file and take the best match — but only if word overlap is ≥4. Titles with fewer than 4 matching significant words get labeled "unknown."

This is imperfect. Titles drift during publishing. But a ≥4-word match is strict enough that false positives are rare. In testing on a 25-video set, 21 matched correctly, 4 came back as "unknown." Not great, not unusable — good enough for aggregate pattern analysis.

Inferring Hook Patterns from the First Word

Beyond archetype, I wanted to know whether certain opening patterns in video scripts correlated with performance. The hook pattern inference is a single-function lookup on the first word of the script's opening line:

def hook_pattern(text: str) -> str:
    first_word = text.strip().lower().split()[0]
    if first_word in {"why", "how", "what", "when", "who"}:
        return "question"
    if first_word in {"three", "four", "five"} or any(c.isdigit() for c in first_word):
        return "numeric"
    if first_word in {"i", "i'm", "i've"}:
        return "first-person"
    if first_word in {"stop", "never", "don't", "do"}:
        return "imperative-contrarian"
    return "other"

It's a blunt heuristic. "How" and "Why" as first words don't automatically make a video good. But at scale — 30 videos classified per run — the distribution across HIGH and LOW buckets produces meaningful signal. If "question" hooks consistently cluster in LOW and "numeric" hooks cluster in HIGH, that's worth feeding back into the script generator's prompt context.

This is also the part I'd replace first if I were scaling this beyond 50 videos. First-word classification misses everything after the opener. A title starting with "I" could be "I ditched X after 3 months and here's why" or a boring "I made another video today." I'll eventually pass the full opening sentence through a small LLM call for categorization.

Writing Bias Hints Back to the Knowledge Bank

The output of the classifier isn't a dashboard — it's a section in docs/yt-knowhow-bank-en.md that the script generator reads at the start of each session. The update_kb function finds the ## Routine Auto-Tuner Notes header and replaces everything up to the next ##:

marker = "## Routine Auto-Tuner Notes"
idx = text.find(marker)
if idx == -1:
    new = text.rstrip() + "\n\n" + kb_section + "\n"
else:
    next_h2 = text.find("\n## ", idx + len(marker))
    if next_h2 == -1:
        new = text[:idx] + kb_section + "\n"
    else:
        new = text[:idx] + kb_section + "\n" + text[next_h2 + 1:]

The written section includes what's working (high performer archetypes and hook patterns), what's not (low performer patterns), and a "Tomorrow's bias" paragraph naming the preferred archetype and hook style for the next day. The script generator reads this in its system prompt context before writing each video.

It doesn't blindly follow the bias — it uses the information to make a more informed choice. This is analogous to what prompt caching buys at the content ETL level: inject the right context at session start rather than regenerating decisions from scratch each time.

GitHub Actions Integration

The whole thing runs as a daily cron job inside the single CI workflow that also drives the two YouTube channels and three directory sites. Required env vars are YT_API_KEY (YouTube Data API v3 key — the free tier provides 10,000 units/day, more than enough) and an optional DISCORD_WEBHOOK_URL for a daily summary push.

The script handles a missing API key gracefully: if YT_API_KEY isn't set, it prints a warning and exits 0. The CI job doesn't fail. This is the same pattern I used for the Bluesky post queue and for generating YouTube thumbnails inside CI: tools that are optional shouldn't break the build when their credentials aren't present in an environment that hasn't configured them.

What I'd Do Differently

Watch time over view count. Raw views are a noisy proxy for engagement. A video with 200 views and 90% average view duration is better than one with 500 views and 20% retention. The YouTube Analytics API (separate from the Data API, requires OAuth) exposes averageViewDuration. I didn't wire that up because OAuth from GitHub Actions is annoying — storing refresh tokens as secrets and handling rotation adds meaningful maintenance surface. But it's the right metric.

LLM hook categorization. The first-word heuristic is too coarse. Passing each title through a single Claude Haiku call to categorize the hook type and topic would cost a few cents per month and produce substantially better signal.

Bayesian smoothing for low video counts. With fewer than 20 videos, the median threshold is unstable. A prior from a reference population would give more reliable signal early on.

The current version closes a feedback loop that didn't exist before. I know exactly where to improve it — and I'll do so when the channel has enough data to make the refinements worth the work.

FAQ

Does this require a paid YouTube API quota?

No. The YouTube Data API v3 free tier provides 10,000 units/day. Each playlistItems request costs 1 unit; each videos.list call costs 1 unit per batch of 50. The entire daily run costs roughly 3–5 units.

What happens when a video doesn't match any uploaded queue file?

It gets labeled "unknown" archetype. The pattern analysis still runs; unknowns are counted separately. Over time, a high unknown rate signals that title-overlap matching needs recalibration — perhaps the ≥4-word threshold is too strict.

Why not use the YouTube Analytics API for richer metrics?

The Analytics API requires OAuth 2.0, not a simple API key. OAuth from GitHub Actions means storing refresh tokens as secrets and handling rotation. View counts from the Data API are sufficient at this stage.

Will this ever auto-modify the script generator's prompts?

Not automatically. The knowledge bank is read as context, but the decision to change archetype remains in the script generator's judgment, not in this classifier.

Does the 72-hour grace period affect HIGH classification too?

No — only LOW uses the age gate. A video that goes viral in its first 24 hours should be HIGH immediately. The grace period only protects young videos from false LOW classification.


Part of an ongoing 6-month experiment running three AI-curated directory sites. The technical claims here are real; this article was AI-assisted.