Skip to content

Instantly share code, notes, and snippets.

@cirrusUK
Created April 19, 2024 21:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cirrusUK/fbd1c4f3b0021a87386eb6caefd419b9 to your computer and use it in GitHub Desktop.
Save cirrusUK/fbd1c4f3b0021a87386eb6caefd419b9 to your computer and use it in GitHub Desktop.
xhamster.sh
#!/bin/bash
#
# ▓▓▓▓▓▓▓▓▓▓
# ░▓ author ▓ cirrus <cirrus@archlinux.info>
# ░▓ code ▓ https://gist.github.com/cirrusUK
# ░▓ mirror ▓ http://cirrus.turtil.net
# ░▓▓▓▓▓▓▓▓▓▓
# ░░░░░░░░░░
display_usage() {
echo -e "DESCRIPTION:\n search www.empflix.com from command line, then streams video using mplayer"
echo -e "\nREQUIREMENTS:\n lynx mplayer youtube-dl"
echo -e "\nUSAGE:\n$0 [search words] \n"
}
# if no arguments supplied, display usage
if [ $# -le 0 ]
then
display_usage
exit 1
fi
# code begins
keyword="$(echo "&what=$@&category=&sb=relevance&su=anytime&sd=all&dir=desc" | sed 's/ /\%20/g')"
pagenum=3
pagenum_to_url=$(for num in $(seq 1 "$pagenum"); do echo \
"https://xhamster.com/search.php?page=$num$keyword"; done )
videourl=$(echo "$pagenum_to_url" | while read line; do lynx -dump "$line" \
| awk '/xhamster\.com\/videos/ {print $2}' | awk '!x[$0]++' | tac ; done)
# Set to endless loop
while true
do
# Set the prompt for the select command
PS3="Type a number to play or 'Ctrl+C' to quit: "
tput setaf 2
# Create a list of files to display
fileList=$(echo $videourl)
tput setaf 1
# Show a menu and ask for input. If the user entered a valid choice,
# then invoke the player on that file
select fileName in $fileList; do
if [ -n "$fileName" ]; then
mpv $( yt-dlp -g "${fileName}" )
fi
break
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment