Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望支持来自Unsplash的壁纸 #276

Closed
MkQtS opened this issue Dec 28, 2021 · 6 comments · Fixed by #395
Closed

希望支持来自Unsplash的壁纸 #276

MkQtS opened this issue Dec 28, 2021 · 6 comments · Fixed by #395

Comments

@MkQtS
Copy link
Contributor

MkQtS commented Dec 28, 2021

目前只支持本地文件和bing壁纸,前几天bing挂了,就只能用本地文件。

Unsplash的图片允许免费使用,比如一个浏览器插件Tabliss在unsplash上的collection,也很漂亮

@OiCkilL
Copy link

OiCkilL commented Jan 3, 2022

+1,Unsplash的壁纸确实不错,免费而且质量高

@jerrykuku
Copy link
Owner

我也一直用unspalsh 但是貌似没有找到合适的接口

@MkQtS
Copy link
Contributor Author

MkQtS commented Jan 4, 2022

Unsplash提供了开发者文档,需要注册以后获取Unsplash的Access Key,然后就可以使用Unsplash的api了

@moonerick
Copy link

Unsplash提供了开发者文档,需要注册以后获取Unsplash的Access Key,然后就可以使用Unsplash的api了

我也一直用unspalsh 但是貌似没有找到合适的接口

https://www.mangoxo.com/blog/OozZLnog
可以参考这个

@jerrykuku
Copy link
Owner

可以考虑,只是argon目前在做大的css重构,进行了一半,鸽子了好久。。。。

@MkQtS
Copy link
Contributor Author

MkQtS commented Sep 21, 2022

试了一下,可以直接curlsource.unsplash.com得到图片链接(不加-L不会重定向),不需要Unsplash的Key

比如curl "https://source.unsplash.com/random"或者curl "https://source.unsplash.com/collection/562095"

得到一个这样的结果

<html><body>You are being <a href="https://images.unsplash.com/photo-1489176876421-3b720db0fb3d?crop=entropy&amp;cs=tinysrgb&amp;fit=max&amp;fm=jpg&amp;ixid=MnwxfDB8MXxyYW5kb218MHw1NjIwOTV8fHx8fHx8MTY2Mzc0MzczNw&amp;ixlib=rb-1.2.1&amp;q=80&amp;utm_campaign=api-credit&amp;utm_medium=referral&amp;utm_source=unsplash_source&amp;w=1080">redirected</a>.</body></html>

用sed处理一下,可以得到这种比较理想的链接:https://images.unsplash.com/photo-1489176876421-3b720db0fb3d?fm=jpg&w=1920&h=1080

大概这样

curl -sS "https://source.unsplash.com/collection/562095" \
| sed -E 's#^.*href=\"([^?]+)\?.*$#\1?fm=jpg\&w=1920\&h=1080#'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants