fix: parsing text components with empty navigation endpoints
This commit is contained in:
parent
e012489473
commit
9d243fa0ad
1 changed files with 4 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ use std::convert::TryFrom;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
use serde_with::{serde_as, DeserializeAs, VecSkipError};
|
use serde_with::{serde_as, DefaultOnError, DeserializeAs, VecSkipError};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
client::response::url_endpoint::{
|
client::response::url_endpoint::{
|
||||||
|
|
@ -122,10 +122,13 @@ struct RichTextInternal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TextLinkRun is a single component from a YouTube text with links
|
/// TextLinkRun is a single component from a YouTube text with links
|
||||||
|
#[serde_as]
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct RichTextRun {
|
struct RichTextRun {
|
||||||
text: String,
|
text: String,
|
||||||
|
#[serde(default)]
|
||||||
|
#[serde_as(as = "DefaultOnError")]
|
||||||
navigation_endpoint: Option<NavigationEndpoint>,
|
navigation_endpoint: Option<NavigationEndpoint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue