Journal · 2026-11-22 · 2 min
What "trending" means on this site
The exact refresh, the quota math, and why playlists do not move unless you edit a file.
Trending, here, is not a person staying up to watch the charts. It is a cached question to YouTube, asked again on a timer.
The question
For each shelf the server calls YouTube Data API v3 search.list, type video, embeddable only, ordered by view count, with a publishedAfter date so the result cannot be "the most famous video of 2014" unless that video is still inside the window. Anime looks back about two and a half months. Shorts look back two weeks and ask for short videos, then prefer anything under three minutes. Rain looks back about eighteen months, because the mixes people sleep to are old on purpose, and asks for long videos. The kids shelf uses a strict safety filter and official-sounding kids queries.
A second call, videos.list, fills in duration and view counts for those IDs. Search is expensive in quota units. The details call is cheap. We do not search again for every related video on a watch page. Related videos are the shelf you already fetched.
The timer
Responses are cached for about six hours. The next visitor after that gets a refresh, and everyone else in that window shares it. A daily job, configured in vercel.json, wakes the four default shelves even if the site was quiet, so a morning does not depend on who showed up at 3 a.m. Hitting refresh in your browser does not cost another search if the cache is warm. A bot trying a thousand different search boxes can still spend quota, which is why search terms are length-limited and cached per phrase. The budget this is designed around is the default 10,000 units a day. Four shelves, a few times a day, stays far under that. Sub-filters (AMVs, thunder, songs) cost a search only when someone opens them, and then they are cached too.
If the key is missing, or YouTube errors, the page shows the demo catalog and says so. The demo is a fixed list of real public videos. It is not a fake live ranking. Rankings resume on their own when the key works again. You do not clear a cache by hand.
What does not auto-update
Playlists and journal posts are files in this repository. They change when you commit a file and the site deploys. The sitemap and the RSS feed read those folders. There is no CMS account to forget the password to.
We do not sell a slot on a shelf. A view count is not an endorsement. A trailer with a million views is a successful ad. The show can still be bad. Read the season note for that argument, and the shelf for the clicks.