mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 10:18:12 +01:00
ver 1.1 :3
This commit is contained in:
parent
69bcba20b1
commit
257b81b88c
1 changed files with 9 additions and 7 deletions
16
poke-cli.sh
16
poke-cli.sh
|
@ -24,7 +24,7 @@ function display_help {
|
||||||
}
|
}
|
||||||
|
|
||||||
function display_version {
|
function display_version {
|
||||||
echo "poke-cli version 1.0
|
echo "poke-cli version 1.1
|
||||||
|
|
||||||
Play videos from your terminal!
|
Play videos from your terminal!
|
||||||
https://codeberg.org/ashley/poke
|
https://codeberg.org/ashley/poke
|
||||||
|
@ -60,7 +60,6 @@ function display_license {
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for command-line options
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--help)
|
--help)
|
||||||
display_help
|
display_help
|
||||||
|
@ -81,20 +80,21 @@ if [ $# -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# config
|
||||||
|
poke_instance="https://poketube.fun"
|
||||||
|
invid_api_url="https://invid-api.poketube.fun"
|
||||||
|
|
||||||
search_query=$1
|
search_query=$1
|
||||||
|
|
||||||
player="mpv"
|
player="mpv"
|
||||||
|
|
||||||
if ! command -v $player &> /dev/null; then
|
|
||||||
player="vlc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v jq &> /dev/null && ! command -v gojq &> /dev/null; then
|
if ! command -v jq &> /dev/null && ! command -v gojq &> /dev/null; then
|
||||||
echo "Error: jq or gojq not found. Please install them to run the script."
|
echo "Error: jq or gojq not found. Please install them to run the script."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
json_data=$(curl -s "https://invid-api.poketube.fun/api/v1/search?q=${search_query// /+}")
|
json_data=$(curl -s "$invid_api_url/api/v1/search?q=${search_query// /+}")
|
||||||
|
|
||||||
video_count=$(echo "$json_data" | jq -r '. | length')
|
video_count=$(echo "$json_data" | jq -r '. | length')
|
||||||
if [ $video_count -eq 0 ]; then
|
if [ $video_count -eq 0 ]; then
|
||||||
|
@ -121,5 +121,7 @@ fi
|
||||||
video_url=$(echo "$json_data" | jq -r ".[$(($selection - 1))].videoId")
|
video_url=$(echo "$json_data" | jq -r ".[$(($selection - 1))].videoId")
|
||||||
|
|
||||||
echo "Starting $player..."
|
echo "Starting $player..."
|
||||||
|
echo "please wait - this may take some time lol..."
|
||||||
|
|
||||||
|
$player "$poke_instance/watch?v=$video_url"
|
||||||
|
|
||||||
$player "https://poketube.fun/watch?v=$video_url"
|
|
||||||
|
|
Loading…
Reference in a new issue