Skip to content

Instantly share code, notes, and snippets.

@haydonryan
Created December 20, 2019 16:37
Show Gist options
  • Save haydonryan/94fb059b9b2773d3ff792cf3e527cf9c to your computer and use it in GitHub Desktop.
Save haydonryan/94fb059b9b2773d3ff792cf3e527cf9c to your computer and use it in GitHub Desktop.
#/bin/bash
newfile () {
fname=$1
count=0
while [ -e "$fname" ]
do
# fname="$1.$((++count)).mp4"
fname="$(basename $1 .mp4).$((++count)).mp4"
done
echo "$fname"
}
if [ $# -eq 0 ]
then
echo "Tiktok scraper"
echo "Usage:"
echo "get_tiktok_video.sh <URL to get>"
fi
URL=$(wget -q "$1" -O - 2>&1 | grep "video playsinline" | grep -Eoi 'loop="".src="[^\"]+"' | grep -Eoi 'https[^\"]+')
echo "Getting Video URL $URL"
echo "as $(newfile video.mp4)"
wget -O $(newfile video.mp4) "$URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment