- InnerTube layer via pinned youtubei.js 18.1.0 (no quota, no key): search with merged continuations (unlimited pages), watch-next related with LockupView mapping, caption-track discovery - 3-layer dispatcher (YT_SEARCH_MODE, default innertube-first): innertube -> yt-dlp scrape -> official API, graceful errors.yt - Robust yt-dlp binary resolution (YT_DLP_PATH > PATH > bundled) with systematic API fallback (fixes spawn ENOENT in UI) - Transcript: InnerTube caption discovery (YT_TRANSCRIPT_SOURCE), reusing pickTrack/orderedTracks/parseTrackText; yt-dlp fallback kept - Watch: sidebar uses real watch-next related[] (/api/details), title-search fallback for other providers - Cache: memory LRU + SQLite (youtube_search_cache, youtube_metrics), never persist empty pages; /healthz observability; /api/trending - Includes pending Step 15/16 leftovers in same files (suggest, test scripts); unrelated provider adapters left uncommitted
19 lines
634 B
SQL
19 lines
634 B
SQL
-- Step 17 : cache persistant recherche YouTube (scrape + API) + métriques quota journalières.
|
|
CREATE TABLE IF NOT EXISTS youtube_search_cache (
|
|
q_hash TEXT PRIMARY KEY,
|
|
q TEXT NOT NULL,
|
|
payload_json TEXT NOT NULL,
|
|
source TEXT NOT NULL DEFAULT 'scrape',
|
|
created_at INTEGER NOT NULL,
|
|
expires_at INTEGER NOT NULL
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_yt_cache_exp ON youtube_search_cache(expires_at);
|
|
|
|
CREATE TABLE IF NOT EXISTS youtube_metrics (
|
|
day TEXT PRIMARY KEY,
|
|
scrape_calls INTEGER NOT NULL DEFAULT 0,
|
|
api_calls INTEGER NOT NULL DEFAULT 0,
|
|
quota_units INTEGER NOT NULL DEFAULT 0,
|
|
updated_at TEXT NOT NULL
|
|
);
|