website changed fixed

pull/26/head
gotbletu 5 years ago
parent d53142b83a
commit da72a7039c

@ -1,18 +1,26 @@
#!/bin/bash #!/usr/bin/env bash
# _ _ _ _ ### _ _ _ _
# __ _ ___ | |_| |__ | | ___| |_ _ _ ### __ _ ___ | |_| |__ | | ___| |_ _ _
# / _` |/ _ \| __| '_ \| |/ _ \ __| | | | ### / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
#| (_| | (_) | |_| |_) | | __/ |_| |_| | ###| (_| | (_) | |_| |_) | | __/ |_| |_| |
# \__, |\___/ \__|_.__/|_|\___|\__|\__,_| ### \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
# |___/ ### |___/
# http://www.youtube.com/user/gotbletu ### https://www.youtube.com/user/gotbletu
# https://twitter.com/gotbletu ### https://twitter.com/gotbletu
# https://plus.google.com/+gotbletu ### https://github.com/gotbletu
# https://github.com/gotbletu ### gotbletu@gmail.com
# gotbletu@gmail.com ###
### Author : gotbletu
# demo video: https://www.youtube.com/watch?v=cDtVEXjiKTw ### Name : dl_wallhaven_wallpapers.sh
# A script to download random wallpaper and delete old wallpaper at the sametime (wallhaven.cc) ### Version : 0.2
### Date : 20190811
### Description : A script to download random wallpaper and delete old wallpaper at the sametime (wallhaven.cc)
### Depends On : bash coreutils grep findutils lynx wget
### Video Demo : https://www.youtube.com/watch?v=cDtVEXjiKTw
### Release Notes : 20190811 -- v0.2 minor fixes to get it working again
### 20170121 -- v0.1 it has begun
# Variable (you can change any of these to your liking) # Variable (you can change any of these to your liking)
real_wall_dir=~/Pictures/Wallpapers real_wall_dir=~/Pictures/Wallpapers
@ -26,14 +34,9 @@ mkdir -p $temp_wall_dir
cd $temp_wall_dir cd $temp_wall_dir
# get links of images and download it # get links of images and download it
get_random_url=$(lynx -dump "https://alpha.wallhaven.cc/random" | awk '/\/wallpaper\// && !/favorites/ && !/thumbTags/ && !/html/ {print $2}') get_random_url=$(lynx -listonly -nonumbers -dump "https://wallhaven.cc/random" | grep '/w/')
get_images_url=$(echo "$get_random_url" | while read line; do lynx -source "$line" | grep -Po '<img id="wallpaper" src="\K[^"]+' ; done )
get_images_url=$(echo "$get_random_url" | while read line; do lynx -source "$line" | grep -Po '(<img id="wallpaper" src=")[^"]*' | cut -d '/' -f3- ; done ) dl_images=$(echo "$get_images_url" | while read line; do wget -N "$line" ; done)
add_https_prefix=$(echo "$get_images_url" | while read line; do echo "https://"$line"" ; done )
dl_images=$(echo "$add_https_prefix" | while read line; do wget -N "$line" ; done)
# delete any file under 200k in size (to avoid shitty thumnbails or crap quality) # delete any file under 200k in size (to avoid shitty thumnbails or crap quality)
find . -type f -iname "*.jp*g" -size -200k -exec rm {} \; find . -type f -iname "*.jp*g" -size -200k -exec rm {} \;
@ -52,3 +55,4 @@ find . -type f -iname "*.png" -exec mv {} $real_wall_dir \;
# delete wallpaper image older then X days and remove temp folder # delete wallpaper image older then X days and remove temp folder
rm -rf $temp_wall_dir rm -rf $temp_wall_dir
find $real_wall_dir -mtime +$expire_wall_date -exec rm {} \; find $real_wall_dir -mtime +$expire_wall_date -exec rm {} \;

Loading…
Cancel
Save