2 ms·
. /*```````````youtube search html```````````*/ "\"originalUrl\":\"https://www.youtube.com/results?search_query" youtube_itag=0; "ideoRendere
by 1vuio0pswjnm7 3y ago
.
/*```````````youtube search html```````````*/
"\"originalUrl\":\"https://www.youtube.com/results?search_query" youtube_itag=0;
"ideoRenderer\":{\"videoId\":\""[^\"]+ {
z=0;
CDp8iULPuCinsert(20);
fwrite("https://www.youtube.com/watch?v=",1,32,yyout);
for(x=27;x<yyleng;x++)putc(yytext[x],yyout);
fwrite("','",1,3,yyout);
}
"\"title\":{\"runs\":[{\"text\":\""[^\"]+ {
y=0;for(x=26;x<yyleng;x++)if(y<255){desc[y]=yytext[x];y++;};desclen=y;
}
"webCommandMetadata\":{\"url\":\"/@"[^\"]+ {
y=0;for(x=29;x<yyleng;x++)if(y<255){url[y]=yytext[x];y++;};urllen=y;
}
\"browseId\":\"[^\"]+ if(!z){
z++;
for(x=12;x<yyleng;x++)putc(yytext[x],yyout);
putc(32,yyout);
fwrite(url,1,urllen,yyout);
putc(32,yyout);
for(x=0;x<desclen;x++){if(desc[x]==39)putc(39,yyout);putc(desc[x],yyout);};
fwrite("');\n",1,4,yyout);
}
/*```````````youtube search json```````````*/
[ ]{20,30}\"headline\":[ ]\{\n[ ]{20,30}\"runs\":[ ]\[\n[ ]{20,30}\{\n[ ]{20,30}\"text\":[ ]\"[^\"]+ {
z=0;
y=0;for(x=127;x<yyleng;x++)if(y<255){desc[y]=yytext[x];y++;};desclen=y;
}
[ ]{20,30}\"browseEndpoint\":[ ]\{\n[ ]{20,30}\"browseId\":[ ]\"[^\"]+ {
y=0;for(x=91;x<yyleng;x++){if(yytext[x])yytext[y]=yytext[x];
if(yytext[yyleng])yytext[yyleng]=0;y++;};z=y;
setenv("cid",yytext,1);
}
[ ]{29}\"canonicalBaseUrl\":[ ]\"[^\"]+ {
y=0;for(x=50;x<yyleng;x++){if(yytext[x])yytext[y]=yytext[x];
if(yytext[yyleng])yytext[yyleng]=0;y++;};w=y;
setenv("cburl",yytext,1);
}
[ ]{20,30}\"watchEndpoint\":[ ]\{\n[ ]{20,30}\"videoId\":[ ]\"[^\"]+ {
CDp8iULPuCinsert(20);
fwrite("https://www.youtube.com/watch?v=",1,32,yyout);
for(x=78;x<yyleng;x++)putc(yytext[x],yyout);
fwrite("','",1,3,yyout);
fwrite(getenv("cid"),1,z,yyout);
putc(32,yyout);
fwrite(getenv("cburl"),1,w,yyout);
putc(32,yyout);
for(x=0;x<desclen;x++){if(desc[x]==39)putc(39,yyout);putc(desc[x],yyout);};
fwrite("');\n",1,4,yyout);
}
To test:
#!/bin/sh
#set -x;
search_json() {
echo '{"context":{"client":{"hl":"en-US","gl":"US","clientName":"MWEB","clientVersion":"2.20210916.06.01"}},"continuation":"'$1'"}'
}
GET() {
curl -si04A "" "$@"
}
POST() {
curl -si04A "" --json @/dev/stdin "$@"
}
export yt_public_url1=https://www.youtube.com/results?
export yt_public_url2=https://www.youtube.com/youtubei/v1/
export yt_public_key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8
# mac os: ftp -4o'|tr , \\n|grep AIza' https://www.youtube.com
read x;
if test ${#x} -gt 0;then
echo TWVGHkppk6Q6cODqP7Kqquery:\""$x"\"
echo TWVGHkppk6Q6cODqP7Kqdate:\"$(epoch)\"
else exec echo "usage: echo this is a test|${0##*/} [depth] > file"
fi
x=$(echo "$x"|sed 's/ /+/g;s/++/+/g');
GET ${yt_public_url1}search_query="$x" > 020.htm
cat 020.htm
if test $# -eq 0;then exec rm 020.htm;fi
test $1||exit
n=1;while true;do
test $n -le ${1-0}||break
if test $n -eq 1 ;then x=020.htm; fi
if test $n -gt 1 ;then x=020.json.$((n-1)); fi
ct=$(tr , '\12' < $x|sed -n '/.*\"token\":\"/{s///;s/\"$//p;}');
search_json $ct|POST ${yt_public_url2}search?key=$yt_public_key >020.json.$n
n=$((n+1))
done
cat 020.json.? 020.json.??
exec rm 020.htm 020.json.? 020.json.??
echo this is a test.|020.sh > 1.htmljson
yy084 < 1.htmljson|sqlite3 test.db
Using custom UNIX utilities
#!/bin/sh
read x;
echo TWVGHkppk6Q6cODqP7Kqquery:\""$x"\"
echo TWVGHkppk6Q6cODqP7Kqdate:\"$(epoch)\"
x=$(echo "$x"|yy046);
HOST=www.youtube.com;
PATHQ="results?search_query=$x";
export httpVersion=1.0;
export Connection=close;
echo "https://$HOST/$PATHQ"|yy025
echo "https://$HOST/$PATHQ"|yy025 \
|tcpclient -vvRHDl0 127.0.0.7 80 sh -c "sed >&6;yy045<&7" > 020.htm
cat 020.htm
if test $# -eq 0;then cat 020.htm;exec rm 020.htm;fi
test $1||exit
exec 2>/dev/null;
n=1;while true;do
test $n -le ${1-0}||break
if test $n -eq 1 ;then x=020.htm; fi
if test $n -gt 1 ;then x=020.json.$((n-1)); fi
yy082 t < $x|yy076|nc -vvn 127.7 80|yy045 > 020.json.$n
n=$((n+1))
done
cat 020.json.? 020.json.??
exec rm 020.htm 020.json.? 020.json.??
echo this is a test.|020.sh > 1.htmljson
yy084 < 1.htmljson|sqlite3 test.db
- 1vuio0pswjnm7 3y agoCorrection: s/then cat.htm;/then /