Hacker News new | ask | show | jobs
by shubb 2975 days ago
You might want to async the downloading part. It is often faster to download 5 images at once than to download them one after another.

In the choices section you use input("text") properly one place but not others. You use a couple different ways of decoding codes, and the dict way is nicer, but also consistency is nice. Also, I am not sure you handle bad input (default all?)...

Personally, I'd pull the meat out of the loops in main() into functions - GetImageList() and GetImage(). Relatively complex there so it would be easier to read and spot errors in those bits of code in isolation.

2 comments

Unless you're in dire need of thousands of wallpapers (most of them you are going to delete anyway) it's better not to hammer the website. I'd even limit the download rate.
Agreed - I looked at the code hoping for a good example of async in python as suggested by the “at once” in the title.