Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Last active January 17, 2019 13:20
Show Gist options
  • Save hoangdh/1fc5e6403725d7843e15bc371e66716d to your computer and use it in GitHub Desktop.
Save hoangdh/1fc5e6403725d7843e15bc371e66716d to your computer and use it in GitHub Desktop.
Download videos from Pixibay
#!/bin/bash
get_link(){
for x in `seq 1 11`
do
echo "Crawling page: $x"
curl -s https://pixabay.com/en/videos/list/landscape/?pagi=${x} | grep -oP "<a href=\"[^\"]*[0-9]" | grep -Ev 'list|blog|:|photos' | sed 's/\"/ /g' | awk {'print $3'} >> /tmp/link-pixabay.txt
done
}
download(){
cat /tmp/link-pixabay.txt | sort -u | while read -r l; do
name=$(echo $l | awk -F '/' {'print $4'})
id=$(echo $l | grep -Eo '[0-9]+')
echo "Downloading: $name"
curl -Ls "https://pixabay.com/en/videos/download/video-${id}_source.mp4?attachment" -o ${name}.mp4
done
}
get_link
download
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment