From 574ddb8a1209d132479600c4c2b0ddf6db736e37 Mon Sep 17 00:00:00 2001 From: Pierce Thompson Date: Sun, 7 May 2023 04:38:29 -0400 Subject: [PATCH] Cleanup lyrics::get_song_id --- src/lyrics.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lyrics.rs b/src/lyrics.rs index acb5a90..89576c4 100644 --- a/src/lyrics.rs +++ b/src/lyrics.rs @@ -66,17 +66,15 @@ pub async fn lyrics(info: web::Query) -> Result { } fn get_song_id(document: &Html) -> crate::Result { - let meta = document + Ok(document .select(&SONG_ID_SELECTOR) .next() - .ok_or("Failed to find meta tag with song ID")?; - let id = meta + .ok_or("Failed to find meta tag with song ID")? .value() .attr("content") .and_then(|content| content.strip_prefix("genius://songs/")) .ok_or("Failed to find content attribute")? - .parse::()?; - Ok(id) + .parse::()?) } fn scrape_lyrics(document: &Html) -> Vec {