Skip to content

Instantly share code, notes, and snippets.

@nanpuyue
Created April 18, 2018 15:02
Show Gist options
  • Save nanpuyue/71efbe5a3b1bbaa65d2cc2ef82846375 to your computer and use it in GitHub Desktop.
Save nanpuyue/71efbe5a3b1bbaa65d2cc2ef82846375 to your computer and use it in GitHub Desktop.
a you-get gui
#!/bin/bash
# file: you-get.sh
# date: 2018-04-18
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
URL=$(zenity --entry --text=请输入视频地址)
INFO=$(you-get -i "$URL"|sed 's/\x1b\[\wm//g')
TITLE="$(echo "$INFO"|grep -Po '(?<=title:).*'|sed -r 's/^\s*//')"
LIST=$(echo "$INFO"|grep -Po 'format:.*$|(?<=video-profile:).*$|(?<=size:).*MiB|(?<=container:).*$'|\
while read line; do
if [[ $line =~ format ]]; then
echo s
echo $line|grep -Po '(?<=format:).*$'
elif [[ $line =~ MiB ]]; then
echo $line|tr -d ' '
else
echo "$line"
fi
done)
FORMAT=$(zenity --list \
--height=600 --width=800 \
--title="$TITLE" \
--radiolist --hide-column=2 \
--column=select \
--column=format \
--column=container \
--column=video-profile \
--column=size \
$LIST)
DIR=$(xdg-user-dir VIDEOS)
you-get --format=$FORMAT -o "$DIR" "$URL"|zenity --progress --text="正在下载 $TITLE"
zenity --info --text="下载完成"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment