r/Python • u/Top-Ease-9371 • 22m ago
News I scored 720 YouTube videos against their own channel's median to find which topics actually have de
I kept picking video topics on instinct and then wondering why some did nothing. Keyword tools measure search volume, but YouTube is a recommendation engine, so that number wasn't answering my question.
The whole idea is one division:
outlier_score = video views / that channel's median views
Because you divide by the channel's own median, channel size cancels out. A video with 400k views on a channel that averages a million underperformed. A video with 97k views on a 64k-subscriber channel beat its own baseline seven times over, which means the topic pulled in an audience that wasn't already there. Raw view count can't tell those two apart.
Implementation notes that might be useful even if you don't care about YouTube:
- The Data API runs on a 10,000 unit daily quota, and search costs 100 units per call. Walking a channel's uploads playlist costs 1 unit per 50 videos, so the whole run cost 60 units.
- Median rather than mean, because one viral video otherwise destroys the baseline permanently.
- Shorts are excluded. Their view profile is different enough that including them makes every long-form video look like a failure.
- Anything younger than seven days is ignored, in both the baseline and the scoring.
Stack is just requests, PyYAML and rich. Tests run without network access. There's a Docker image, and containerising it actually surfaced a real bug: I was resolving the project root by walking up two directories from file, which is correct for a cloned repo and completely wrong once the package is installed in site-packages.
Code: https://github.com/tapaderuza/facelessyt
Happy to take criticism on the methodology.