Skip to content

Instantly share code, notes, and snippets.

@krisek
Last active November 19, 2020 21:56
Show Gist options
  • Save krisek/127481a6e3f9f5e334c155e9521e754e to your computer and use it in GitHub Desktop.
Save krisek/127481a6e3f9f5e334c155e9521e754e to your computer and use it in GitHub Desktop.
Spotlight photos on X

This Gist contains a bash and a fish shell script to get MS Spotlight photos on your Linux machine.

Depends on curl, jq and sed.

#!/usr/bin/fish
argparse 'h/help' 'd/destination' -- $argv
if [ "$argv" = "" ]
set argv /usr/share/backgrounds/spotlight.jpg
end
set date (date +'%Y-%m-%dT%H:%M:%SZ')
set wallpaper (curl -s "https://arc.msn.com/v3/Delivery/Cache?pid=209567&fmt=json&rafb=0&ua=WindowsShellClient%2F0&disphorzres=9999&dispvertres=9999&lo=80217&pl=en-US&lc=hu-HU&ctry=hu&time=$date" | jq .batchrsp.items[0].item | sed 's/\\\\"/"/g' | sed 's/^\"//' | sed 's/\"$//' | jq -r .ad.image_fullscreen_001_landscape.u)
curl -s "$wallpaper" -o $argv
#!/usr/bin/bash
destination=/usr/share/backgrounds/spotlight.jpg
while getopts "d:" OPTION; do
case "$OPTION" in
d)
destination=$OPTARG
;;
\?) echo "Usage: cmd [-d]"
;;
esac
done
date=$(date +'%Y-%m-%dT%H:%M:%SZ')
wallpaper=$(curl -s "https://arc.msn.com/v3/Delivery/Cache?pid=209567&fmt=json&rafb=0&ua=WindowsShellClient%2F0&disphorzres=9999&dispvertres=9999&lo=80217&pl=en-US&lc=hu-HU&ctry=hu&time=$date" | jq .batchrsp.items[0].item | sed 's/\\\\"/"/g' | sed 's/^\"//' | sed 's/\"$//' | jq -r .ad.image_fullscreen_001_landscape.u)
curl -s "$wallpaper" -o $destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment