Last active
October 5, 2023 15:27
-
-
Save stepbrobd/fe2f44cbb26b2fa90e9ef3a5fcb56830 to your computer and use it in GitHub Desktop.
download macos wallpapers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import plistlib | |
import requests | |
from urllib.request import urlretrieve | |
def xml(url: str) -> list[str]: | |
result = [] | |
for asset in plistlib.loads( | |
requests.get(url).text.encode() | |
)["Assets"]: | |
result.append(asset["__BaseURL"] + asset["__RelativePath"]) | |
return result | |
def main() -> int: | |
urls = xml("https://mesu.apple.com/assets/macos/com_apple_MobileAsset_DesktopPicture/com_apple_MobileAsset_DesktopPicture.xml") | |
for idx, url in enumerate(urls): | |
urlretrieve(url, f"{idx}.zip") | |
return 0 | |
if __name__ == "__main__": | |
raise SystemExit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment