"I get 5-10 results for any given query before Youtube gives up and just offers me recommendations rather than search results."
I search from the command line using a short shell script.^1 Perhaps it depends on the query, but I consistently get more than 5-10 results. For example, I might get 26 reults with the initial query. By continuing the query repeatedly I can usually get over 1000 results total. YouTube search results are delivered as JSON so I wrote some simple, quick and dirty utilities in C to reformat the JSON to TSV with only the details I want. The workflow and example script below use those utilities, i.e., yy059, yy062 and yy064.
# YouTube search workflow:
# initial query
1.sh query > results-file
yy064 < results-file|yy062 > results.tsv
# continuation
1.sh < results-file >> results-file
yy064 < results-file|yy062 >> results.tsv
1. Example 14-line script using curl
#!/bin/sh
HOST=www.youtube.com;
case $# in :)
;;0)
KEY=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8;
MIN=\{\"context\":{\"client\":{\"hl\":\"en-US\",\"gl\":\"US\",\"clientName\":\"MWEB\",\"clientVersion\":\"2.20210916.06.01\"}},\"continuation\":;
TOKEN=$(yy059|sed -n "s/$/}/;s/\"token\":/$MIN/p"|tail -1);
URL=https://$HOST/youtubei/v1/search?key=$KEY
curl --http1.1 -A "" -H "Content-Type: application/json" -d "$TOKEN" "$URL"
;;*)
S=$(echo "$@"|sed 's/ /+/g');
URL=https://$HOST/results?search_query=$S;
curl --http1.1 -A "" "$URL"
esac;
I also have a short script that retrieves all video details for a given YouTube channel. These results are also delivered as JSON. I use search to discover interesting channels, then retrieve the full lists of videos for those channels.
Absolutely agree that YouTube search got neutered.