Created
April 19, 2024 21:43
-
-
Save cirrusUK/fbd1c4f3b0021a87386eb6caefd419b9 to your computer and use it in GitHub Desktop.
xhamster.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# ▓▓▓▓▓▓▓▓▓▓ | |
# ░▓ author ▓ cirrus <[email protected]> | |
# ░▓ 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