Re:Show HN: A Python Script to Download Thousands of Wallpap...
by kpenc on Monday April 23, 2018 @11:51AM
(#16904472)
Every function has side effects. Could've written the whole thing in one function. Also, PEP8.
[ Parent
| on HN ]
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by apetresc on Monday April 23, 2018 @11:52AM
(#16904482)
One function? Could've written the whole thing in one `wget` call.
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by pknerd on Monday April 23, 2018 @12:21PM
(#16904800)
teach me how.
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by apetresc on Monday April 23, 2018 @12:35PM
(#16904964)
Here's a start:
for x in $(curl -s https://alpha.wallhaven.cc/random | pcregrep -o1 "https://alpha.wallhaven.cc/wallpaper/(\d+)" | sort | uniq) ; do wget "https://wallpapers.wallhaven.cc/wallpapers/full/wallhaven-$x.jpg" ; done
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by akx on Monday April 23, 2018 @01:20PM
(#16905427)
bash, curl, pcregrep, sort, uniq and wget is not what I'd call "one wget call".
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by slenk on Monday April 23, 2018 @01:38PM
(#16905605)
To the hardcore bash users, I think they call that 'easy'. I have someone like that on my team - holy crap some of the bash stuff they can come up with
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by lou1306 on Monday April 23, 2018 @01:53PM
(#16905739)
Hardcore bash sure sounds like fun, but when things start getting too big or messy I usually find a Python script with some `subprocess` [0] tricks to be way easier on the eye.
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by zo1 on Monday April 23, 2018 @01:52PM
(#16905728)
I hope none of that stuff makes it into your main codebase? If there is even a remote chance of requiring maintenance by someone other than the person that wrote it, that is. Which is probably 99.99% the chance, unless it's temporary/throwaway code.
Re:Show HN: A Python Script to Download Thousands of Wallpap...
by shubb on Monday April 23, 2018 @12:31PM
(#16904925)
I guess wget has a useful spidering function that could probably page through the websites search results page, downloading all the preview and real images. You'd have to do the login bit as a different call and fetch the first search pages url yourself?