fix: handling new podcast links

This commit is contained in:
ThetaDev 2023-11-04 01:14:54 +01:00
parent ba06e2c8c8
commit 452f765ffd
11 changed files with 147 additions and 116 deletions

View file

@ -6,7 +6,9 @@ use serde::{Deserialize, Deserializer};
use serde_with::{serde_as, DeserializeAs, VecSkipError};
use crate::{
client::response::url_endpoint::{MusicVideoType, NavigationEndpoint, PageType},
client::response::url_endpoint::{
MusicPage, MusicPageType, MusicVideoType, NavigationEndpoint, PageType,
},
model::UrlTarget,
util,
};
@ -419,6 +421,23 @@ impl TextComponent {
| TextComponent::Text { text } => text,
}
}
pub fn music_page(self) -> Option<MusicPage> {
match self {
TextComponent::Video {
video_id, vtype, ..
} => Some(MusicPage {
id: video_id,
typ: MusicPageType::Track { vtype },
}),
TextComponent::Browse {
page_type,
browse_id,
..
} => Some(MusicPage::from_browse(browse_id, page_type)),
_ => None,
}
}
}
impl From<TextComponent> for String {