diff --git a/src/client/music_artist.rs b/src/client/music_artist.rs index 218ec04..0311eb0 100644 --- a/src/client/music_artist.rs +++ b/src/client/music_artist.rs @@ -272,12 +272,18 @@ fn map_artist_page( let mapped = mapper.group_items(); static WIKIPEDIA_REGEX: Lazy = - Lazy::new(|| Regex::new(r"https://[a-z]+\.wikipedia.org/wiki/[^()\s]+").unwrap()); + Lazy::new(|| Regex::new(r"\(?https://[a-z\d-]+\.wikipedia.org/wiki/[^\s]+").unwrap()); let wikipedia_url = header.description.as_deref().and_then(|h| { - WIKIPEDIA_REGEX - .captures(h) - .and_then(|c| c.get(0)) - .map(|m| m.as_str().to_owned()) + WIKIPEDIA_REGEX.captures(h).and_then(|c| c.get(0)).map(|m| { + let m = m.as_str(); + match m.strip_prefix('(') { + Some(m) => match m.strip_suffix(')') { + Some(m) => m.to_owned(), + None => m.to_owned(), + }, + None => m.to_owned(), + } + }) }); let radio_id = header.start_radio_button.and_then(|b| { diff --git a/src/client/snapshots/rustypipe__client__music_artist__tests__map_music_artist_no_more_albums.snap b/src/client/snapshots/rustypipe__client__music_artist__tests__map_music_artist_no_more_albums.snap index b4185f6..7151028 100644 --- a/src/client/snapshots/rustypipe__client__music_artist__tests__map_music_artist_no_more_albums.snap +++ b/src/client/snapshots/rustypipe__client__music_artist__tests__map_music_artist_no_more_albums.snap @@ -33,7 +33,7 @@ MusicArtist( ), ], description: Some("Senta-Sofia Delliponti is a German singer, songwriter and actress. Since January 2014, she used the stage name Oonagh, until she changed it to Senta in 2022. Her signature musical style is inspired by the mystical lore of J. R. R. Tolkien\'s universe and by ethnic sounds throughout the world.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Oonagh_(singer)) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"), - wikipedia_url: Some("https://en.wikipedia.org/wiki/Oonagh_"), + wikipedia_url: Some("https://en.wikipedia.org/wiki/Oonagh_(singer)"), subscriber_count: Some(34200), tracks: [ TrackItem(