YouTube search
search + reply moved to cb-worker; v1's googleapiclient call had no timeout at all
/youtube- v1 scenarios
- 1
- Ported
- 1
- Green
- 1
- Failing
- —
search + reply moved to cb-worker; v1's googleapiclient call had no timeout at all
SocialContent.py:172-189What it does
/youtube <search terms> searches YouTube and replies with a link to one
of the top 10 matching videos, picked at random, along with its
description. Typing /youtube with nothing after it just explains how to
use the command instead of searching.
Behaviour that must not change
The search text, the "no results" reply and the "type something" reply are all byte-identical to v1's own strings. A group with utility features turned off gets the same "utility functions are off" message instead of a search, same as every other utility command.
One thing changed on purpose: v1 called the YouTube API directly from the same step that answers Telegram, with no timeout at all — a slow or hung response could stall that indefinitely. v2 hands the search to a background worker with a real time limit, so the reply now arrives a moment later rather than instantly, but a broken search can never hold up anything else.
How to verify it
qa/features/util_youtube.feature — run with python scripts/cb.py test.
By hand in the sandbox: send /youtube baked potato in a group and confirm
a video link with a description shows up.