| Crates.io | wirewave |
| lib.rs | wirewave |
| version | 0.1.4 |
| created_at | 2024-07-22 21:21:25.347988+00 |
| updated_at | 2024-07-30 17:34:33.373767+00 |
| description | Use WireWay's Wave API to fetch music by search query |
| homepage | |
| repository | https://github.com/waradu/wirewave |
| max_upload_size | |
| id | 1312054 |
| size | 8,169 |
Use Wave API Wave API to fetch music by search query
Get Music vec by search query:
let music_items = WaveMusic::new("example search term".to_string());
for item in music_items.unwrap() {
println!("{}", item);
}
Get and save thumpnail from music:
let music_items = WaveMusic::new("example search term".to_string()).unwrap();
if let Some(item) = music_items.first() {
let mut thumbnail_response = item.thumbnail().unwrap();
let name = format!("{}.png", item.id.as_ref().unwrap());
let path = Path::new(&name);
let mut file = File::create(&path).unwrap();
copy(&mut thumbnail_response, &mut file).unwrap();
println!("Image fetched and saved to {:?}", path);
}