Skip to content

Instantly share code, notes, and snippets.

@pry0cc
Created September 13, 2016 21:09
Show Gist options
  • Save pry0cc/6ec69eb46ca6e1e7a5803a94740ecb2b to your computer and use it in GitHub Desktop.
Save pry0cc/6ec69eb46ca6e1e7a5803a94740ecb2b to your computer and use it in GitHub Desktop.
Be a badass, with wallpapers.
#!/bin/bash
echo "How many pages of images you would like?"
### Sets threshold for loop ###
read max_pages
echo "At what resolution would you like them."
echo "1] 1920x1080"
echo "2] 3840x2160"
echo "3] Custom - (Careful!)"
read res
if [ $res = 1 ]
then
res_set="1920x1080"
elif [ $res = 2 ]
then
res_set="3840x2160"
elif [ $res = 3 ]
then
echo "Please enter your custom resolution"
echo "e.g 1280x800 if it doesn't exist, then it won't work. However mos res's work."
read cus_res
res_set=$cus_res
fi
dir=$(pwd)
echo $res_set
### Download pages until hit max_pages threshold as described ^^ ###
for (( page=0; page <= $max_pages; page++ ));
do
### Find links, filter, and pass to x ###
x=$(wget --user-agent=MOZILLA -O - http://interfacelift.com/wallpaper/downloads/rating/3_screens/${res_set}/index${page}.html | grep "/wallpaper/" | grep $res_set | grep "jpg" | sed 's/<a href="/interfacelift.com/g' | sed -r 's/<script([^<]|<[^\/]|<\/[^s]|<\/s[^c])*<\/script>|<style([^<]|<[^\/]|<\/[^s]|<\/s[^t])*<\/style>|<[^>]*>//g' | sed 's/\">//g')
### Download stringed together links ###
wget -N -P ${dir} --user-agent=MOZILLA $x
done
echo "There you go buddy. Have a nice day ;)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment