Tag Archives: 4k

A year ago I had posted about how you can bulk download 1080p wallpapers from Microsoft’s website. You can read the post here. That tricked worked very well and allowed me to download a total of 543 1080p wallpapers in one go. Now, I am using the same concept to download wallpapers from alphacoders.com albeit this time it’s 4K, baby! (3840×2160)

Since the level of our pixel gorgeousness has increased we will step up our game a bit by using a Python script to automate the download. Actually, that’s not the main reason… While using lynx, grep and wget worked previously, it may be a bit untidy here. We are dealing with 117 pages full of 4K wallpapers. I estimate around 3000+ wallpapers here. That’s >6 times as previously.

Using Python requests, BeautifulSoup and shutil, it’s very easy. Here’s how I did it.

DISCLAIMER: The code here is only for educational purposes. Use it at your own risk. I am thankful to the original posters of these 4K wallpapers. They deserve due credit.
1. Construct the page URL that shows thumbnails for 4K wallpapers
The first page is this: http://wall.alphacoders.com/by_resolution.php?w=3840&h=2160
Page 2 is this: http://wall.alphacoders.com/by_resolution.php?w=3840&h=2160&page=2
…you get the pattern, right?

1

2

3

url='http://wall.alphacoders.com/by_resolution.php?w=3840&amp;h=2160'

ifpage_no&gt;1:

url+='&amp;page='+str(page_no)

2. On the page, look for image tags with ‘alt’ attribute starting with ‘HD Wallpaper’

3. Loop through all the thumbnails, extract their ‘src’ values and strip ‘thumb-350-‘ string from the ‘src’ values to get the actual 4K wallpaper URL
Input = http://images.alphacoders.com/488/thumb-350-488146.jpg
Output = http://images.alphacoders.com/488/488146.jpg