faebser / beautiful-wallpaper-every-day Goto Github PK
View Code? Open in Web Editor NEWUsing the unsplash.com API to retrieve a new beautiful 4k wallpaper image
Using the unsplash.com API to retrieve a new beautiful 4k wallpaper image
$ cargo run
XDG_PICTURES_DIR is "/home/wmoore"
wrote faulty json to "jsons/h6dT4DJ80n"
thread 'main' panicked at 'JSON PARSE ERROR: Error { kind: Json(ErrorImpl { code: Message("duplicate field `user`"), line: 1, column: 3128 }), url: None }
""', src/main.rs:239:21
Problematic JSON:
{"id":"XQqOpGtnD6U","updated_at":"2018-03-23T12:24:56-04:00","username":"grakozy","name":"Greg Rakozy","first_name":"Greg","last_name":"Rakozy","twitter_username":"grakozy","portfolio_url":"http://grakozy.com","bio":"Like my photos? https://buymeacoff.ee/grakozy","location":"Salt Lake City, Utah","links":{"self":"https://api.unsplash.com/users/grakozy","html":"https://unsplash.com/@grakozy","photos":"https://api.unsplash.com/users/grakozy/photos","likes":"https://api.unsplash.com/users/grakozy/likes","portfolio":"https://api.unsplash.com/users/grakozy/portfolio","following":"https://api.unsplash.com/users/grakozy/following","followers":"https://api.unsplash.com/users/grakozy/followers"},"profile_image":{"small":"https://images.unsplash.com/profile-1495388545592-e4e376925c59?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&fit=crop&h=32&w=32&s=4a6479456ed968ba331e01668f231990","medium":"https://images.unsplash.com/profile-1495388545592-e4e376925c59?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&fit=crop&h=64&w=64&s=12ae79a24d842721d9a2e3969a24c1f8","large":"https://images.unsplash.com/profile-1495388545592-e4e376925c59?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&fit=crop&h=128&w=128&s=913fbf5443cc4c00c436535f78b6d0aa","custom":"https://images.unsplash.com/profile-1495388545592-e4e376925c59?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=3840&fit=crop&s=2210724d2bfd4bc75d4851a26ff18cd9"},"total_collections":19,"instagram_username":"grakozy","total_likes":164,"total_photos":75},"current_user_collections":[],"slug":null,"location":{"title":"Hardware Ranch WMA, Hyrum, United States","name":"Hardware Ranch WMA","city":"Hyrum","country":"United States","position":{"latitude":41.6188037,"longitude":-111.5647165}},"exif":{"make":"Canon","model":"EOS 5D Mark II","exposure_time":"25","aperture":"2.8","focal_length":"14","iso":1600},"views":1949080,"downloads":14745}
rustc 1.24.0
FreeBSD 11.1-RELEASE-p6
GNOME 3.18.2
as per https://www.reddit.com/r/rust/comments/86w7cu/i_wrote_a_small_util_that_querys_the_unsplash_api/dw8ytfh/ put all the macro arguments in one line
currently clippy has some problems and is unable to run. This issue is just here to remind me to do it again.
$ cargo run
XDG_PICTURES_DIR is "/home/david/Pictures"
wrote faulty json to "jsons/wYL9CJnbcG"
thread 'main' panicked at 'JSON PARSE ERROR: Error { kind: Json(ErrorImpl { code: Message("invalid type: null, expected a string"), line: 1, column: 3450 }), url: None }
""', src/main.rs:256:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
The json seems to be incomplete:
"country":"United States","position":{"latitude":33.702679446692,"longitude":-117.010282939209}},"exif":{"make":"Sony","model":"ILCE-7RM2","exposure_time":"1/4000","aperture":"5.0","focal_length":"55","iso":100},"views":1537820,"downloads":16720}
Anyway, I'm thinking some String
field in a struct should actually be Option<String>
, I just can't tell which.
I'm kinda new to Serializing/Deserializing, and I'm wondering how to determine the struct type info. Is there some rule, or is it documented at unsplash?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.