Trick 2: Bulk download 4K wallpapers from alphacoders.com

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?

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

4. Download the image and store in a file

5. Loop through all the pages

Complete snippet:

That’s it!

UPDATE:

Here are stats for my download process. Obviously speed stinks but I was able to 99.9% of 4K Wallpapers.

Downloaded: 3501 Skipped: 5
Total size: 8.66gb Speed: 370.86kb/s Elapsed time:  6h 48m 18.7s

FacebookTwitterGoogleLinkedIn


2 thoughts on “Trick 2: Bulk download 4K wallpapers from alphacoders.com”

  1. Thanks for the snippet , but I get

Leave a Reply

Your email address will not be published. Required fields are marked *