56 lines
2.7 KiB
Bash
Executable File
56 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# SPDX-FileCopyrightText: 2023 Hugo Peixoto <hugo.peixoto@gmail.com>
|
|
|
|
TYPE="$1"
|
|
TERM="$2"
|
|
PAGE="$3"
|
|
TOKEN="$4"
|
|
|
|
case "$TYPE" in
|
|
search)
|
|
curl -s \
|
|
"https://videos.sapo.pt/ajax/search?q=$TERM&type=videos&token=$TOKEN&nocache=9638&page=$PAGE&order=rel" \
|
|
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \
|
|
-H 'Accept: text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1' \
|
|
-H 'Accept-Language: en-US' \
|
|
-H 'Accept-Encoding: gzip, deflate, br' \
|
|
-H 'X-Requested-With: XMLHttpRequest' \
|
|
-H "Cookie: language=pt; sso_tld=POR; bsu-v3-api=1689792348549; sv_token=$TOKEN"
|
|
;;
|
|
|
|
category)
|
|
curl -s \
|
|
"https://videos.sapo.pt/ajax/category/$TERM?token=$TOKEN&nocache=9544&page=$PAGE&order=releve" \
|
|
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \
|
|
-H 'Accept: text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1' \
|
|
-H 'Accept-Language: en-US' \
|
|
-H 'Accept-Encoding: gzip, deflate, br' \
|
|
-H 'X-Requested-With: XMLHttpRequest' \
|
|
-H "Cookie: language=pt; sso_tld=POR; bsu-v3-api=1689792348549; sv_token=$TOKEN"
|
|
;;
|
|
|
|
username)
|
|
curl -s \
|
|
"https://videos.sapo.pt/ajax/video?username=$TERM&token=$TOKEN&page=$PAGE" \
|
|
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \
|
|
-H 'Accept: text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1' \
|
|
-H 'Accept-Language: en-US' \
|
|
-H 'Accept-Encoding: gzip, deflate, br' \
|
|
-H 'X-Requested-With: XMLHttpRequest' \
|
|
-H "Cookie: language=pt; sso_tld=POR; bsu-v3-api=1689792348549; sv_token=$TOKEN"
|
|
;;
|
|
tag)
|
|
curl -s \
|
|
"https://videos.sapo.pt/ajax/searchbytag?q=$TERM&type=videos&token=$TOKEN&page=$PAGE&order=releve&limit=20" \
|
|
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0' \
|
|
-H 'Accept: text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1' \
|
|
-H 'Accept-Language: en-US' \
|
|
-H 'Accept-Encoding: gzip, deflate, br' \
|
|
-H 'X-Requested-With: XMLHttpRequest' \
|
|
-H "Cookie: language=pt; sso_tld=POR; bsu-v3-api=1689792348549; sv_token=$TOKEN"
|
|
;;
|
|
*)
|
|
exit 1;
|
|
esac
|