mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
add split feature for SNS
This commit is contained in:
4
ani-cli
4
ani-cli
@@ -181,7 +181,7 @@ open_episode () {
|
|||||||
case $video_url in
|
case $video_url in
|
||||||
*streamtape*)
|
*streamtape*)
|
||||||
# If direct download not available then scrape streamtape.com
|
# If direct download not available then scrape streamtape.com
|
||||||
BROWSER=${BROWSER:-firefox}
|
BROWSER=${BROWSER:-google-chrome-stable}
|
||||||
printf "scraping streamtape.com\n"
|
printf "scraping streamtape.com\n"
|
||||||
video_url=$(curl -s "$video_url" | sed -n -E '
|
video_url=$(curl -s "$video_url" | sed -n -E '
|
||||||
/^<script>document/{
|
/^<script>document/{
|
||||||
@@ -198,6 +198,7 @@ open_episode () {
|
|||||||
" "$logfile" > "${logfile}.new" && mv "${logfile}.new" "$logfile"
|
" "$logfile" > "${logfile}.new" && mv "${logfile}.new" "$logfile"
|
||||||
|
|
||||||
setsid -f $player_fn "$video_url" >/dev/null 2>&1
|
setsid -f $player_fn "$video_url" >/dev/null 2>&1
|
||||||
|
printf "$video_url\n"
|
||||||
else
|
else
|
||||||
printf "Downloading episode $episode ...\n"
|
printf "Downloading episode $episode ...\n"
|
||||||
printf "%s\n" "$video_url"
|
printf "%s\n" "$video_url"
|
||||||
@@ -219,6 +220,7 @@ open_episode () {
|
|||||||
trap "printf '$c_reset'" INT HUP
|
trap "printf '$c_reset'" INT HUP
|
||||||
|
|
||||||
dep_ch "$player_fn" "curl" "sed" "grep"
|
dep_ch "$player_fn" "curl" "sed" "grep"
|
||||||
|
alias v="nvim"
|
||||||
|
|
||||||
# option parsing
|
# option parsing
|
||||||
is_download=0
|
is_download=0
|
||||||
|
|||||||
20
youtube
20
youtube
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# script for downloading youtube videos and split it into pieces..
|
||||||
|
|
||||||
|
# defining shell colors for distinction
|
||||||
c_red="\033[1;31m"
|
c_red="\033[1;31m"
|
||||||
c_green="\033[1;32m"
|
c_green="\033[1;32m"
|
||||||
c_yellow="\033[1;33m"
|
c_yellow="\033[1;33m"
|
||||||
@@ -8,7 +11,7 @@ c_magenta="\033[1;35m"
|
|||||||
c_cyan="\033[1;36m"
|
c_cyan="\033[1;36m"
|
||||||
c_reset="\033[0m"
|
c_reset="\033[0m"
|
||||||
|
|
||||||
|
#function to download full video
|
||||||
full_video()
|
full_video()
|
||||||
{
|
{
|
||||||
video=$1
|
video=$1
|
||||||
@@ -16,6 +19,7 @@ full_video()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# function to download part of a video and also split it for SNS...
|
||||||
part_video()
|
part_video()
|
||||||
{
|
{
|
||||||
video=$1
|
video=$1
|
||||||
@@ -23,8 +27,18 @@ part_video()
|
|||||||
read start
|
read start
|
||||||
printf "${c_yellow}Enter Upto Seconds:${c_cyan}"
|
printf "${c_yellow}Enter Upto Seconds:${c_cyan}"
|
||||||
read dur
|
read dur
|
||||||
ffmpeg -i $(youtube-dl -f best --get-url "$video") -ss $start -t $dur $HOME/Videos/$(date +%s).mp4
|
printf "Do you want to split video for SNS?? (y or n) :"
|
||||||
}
|
read x
|
||||||
|
if [ $x == 'n' ]; then
|
||||||
|
ffmpeg -i $(youtube-dl -f best --get-url "$video") -ss $start -t $dur $HOME/Videos/$(date +%T_%F).mp4
|
||||||
|
else
|
||||||
|
out=$(date +%T_%F)
|
||||||
|
ffmpeg -i $(youtube-dl -f best --get-url "$video") -map 0 -codec copy -f segment -segment_time 30 -ss $start -t $dur $HOME/Videos/${out}_%03d.mp4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#program starts from here..
|
||||||
|
|
||||||
printf "${c_blue}Input Youtube link :${c_magenta}"
|
printf "${c_blue}Input Youtube link :${c_magenta}"
|
||||||
read x
|
read x
|
||||||
|
|||||||
Reference in New Issue
Block a user