使用Unsplash API和Shortcut为IPhone定时更换壁纸 · oolong | 您所在的位置:网站首页 › iphone换壁纸捷径 › 使用Unsplash API和Shortcut为IPhone定时更换壁纸 · oolong |
使用Unsplash API和Shortcut为IPhone定时更换壁纸
Posted Sep 25, 2022 ![]() 今年IPhone 14 Pro 系列增加了Apple Watch的熄屏显示(Always On Display)功能。这个功能真的很香,大约每小时多消耗1%的电量,同时在无光环境下(如放口袋里、夜晚关灯后)屏幕会自动熄灭。当然我相信苹果肯定做了系统优化防止OLED烧屏,至少过保前肯定不会烧是吧。 Unsplash API API简介Authorization Public Authentication Most actions can be performed without requiring authentication from a specific user. For example, searching, fetching, or downloading a photo does not require a user to log in. To authenticate requests in this way, pass your application’s access key via the HTTP Authorization header: Authorization: Client-ID YOUR_ACCESS_KEYYou can also pass this value using a client_id query parameter: https://api.unsplash.com/photos/?client_id=YOUR_ACCESS_KEYGet a random photo Retrieve a single random photo, given optional filters. GET /photos/randomAPI获取图片链接 #YOUR_ACCESS_KEY Application Access Key #/photos/random 为获得随机的图片 #orientation=portrait 图片风格竖屏、横屏等(Valid values: landscape, portrait, squarish) #query=wallpapers 搜索图片类型 curl https://api.unsplash.com/photos/random?client_id=YOUR_ACCESS_KEY&orientation=portrait&query=wallpapers #返回内容中含有图片链接词典 "urls":{"raw":"https://images.unsplash.com/photo-1499262222376-d10eb3d5183f?ixid=MnwzNjY2MTl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjQwNzMxODQ&ixlib=rb-1.2.1","full":"https://images.unsplash.com/photo-1499262222376-d10eb3d5183f?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzNjY2MTl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjQwNzMxODQ&ixlib=rb-1.2.1&q=80","regular":"https://images.unsplash.com/photo-1499262222376-d10eb3d5183f?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzNjY2MTl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjQwNzMxODQ&ixlib=rb-1.2.1&q=80&w=1080","small":"https://images.unsplash.com/photo-1499262222376-d10eb3d5183f?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzNjY2MTl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjQwNzMxODQ&ixlib=rb-1.2.1&q=80&w=400","thumb":"https://images.unsplash.com/photo-1499262222376-d10eb3d5183f?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwzNjY2MTl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjQwNzMxODQ&ixlib=rb-1.2.1&q=80&w=200","small_s3":"https://s3.us-west-2.amazonaws.com/images.unsplash.com/small/photo-1499262222376-d10eb3d5183f"}这里有几种类型的图片raw full regular small thumb small_s3 ,对应的键值为该质量图片的下载链接。 full returns the photo in jpg format with its maximum dimensions. For performance purposes, we don’t recommend using this as the photos will load slowly for your users. regular returns the photo in jpg format with a width of 1080 pixels. small returns the photo in jpg format with a width of 400 pixels. thumb returns the photo in jpg format with a width of 200 pixels. raw returns a base image URL with just the photo path and the ixid parameter for your API application. Use this to easily add additional image parameters to construct your own image URL.同时可以通过以下参数调整图像大小质量 w, h: for adjusting the width and height of a photo crop: for applying cropping to the photo fm: for converting image format auto=format: for automatically choosing the optimal image format depending on user browser q: for changing the compression quality when using lossy file formats fit: for changing the fit of the image within the specified dimensions dpr: for adjusting the device pixel ratio of the image #例如想要匹配IPhone宽度1290 https://images.unsplash.com/photo-1499262222376-d10eb3d5183f?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzNjY2MTl8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NjQwNzMxODQ&ixlib=rb-1.2.1&q=80&w=1290 下面是配置步骤 注册一个账号 创建一个Application,获取Access Key ①创建Application至此取得Access Key Shortcut快捷指令设置可以使用或参考我分享的Shortcut,在YOUR_ACCESS_KEY填入前面复制的KEY。 关闭运行前询问,运行更无感。 该演示为全程锁屏状态下 Your browser does not support the video tag. 参考 使用 Shortcut 自动更换 Unsplash 的壁纸 Change the wallpaper with unsplash API by using Shortcuts Unsplash API Documentation |
CopyRight 2018-2019 实验室设备网 版权所有 |