feat!: add handle to ChannelItem, remove video_count

This commit is contained in:
ThetaDev 2024-08-17 02:59:56 +02:00
parent e6715700d9
commit 1cffb27cc0
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
5 changed files with 28 additions and 30 deletions

View file

@ -610,28 +610,26 @@ impl<T> YouTubeListMapper<T> {
fn map_channel(&mut self, channel: ChannelRenderer) -> ChannelItem {
// channel handle instead of subscriber count (A/B test 3)
let (sc_txt, vc_text) = if channel
let (handle, sc_txt) = if channel
.subscriber_count_text
.as_ref()
.map(|txt| txt.starts_with('@'))
.unwrap_or_default()
{
(channel.video_count_text, None)
} else {
(channel.subscriber_count_text, channel.video_count_text)
} else {
(None, channel.subscriber_count_text)
};
ChannelItem {
id: channel.channel_id,
name: channel.title,
handle,
avatar: channel.thumbnail.into(),
verification: channel.owner_badges.into(),
subscriber_count: sc_txt.and_then(|txt| {
util::parse_large_numstr_or_warn(&txt, self.lang, &mut self.warnings)
}),
video_count: vc_text.and_then(|txt| {
util::parse_large_numstr_or_warn(&txt, self.lang, &mut self.warnings)
}),
short_description: channel.description_snippet,
}
}