chore: update quick-xml
This commit is contained in:
parent
d8889ed5d4
commit
4cc069fba2
2 changed files with 31 additions and 17 deletions
|
|
@ -50,7 +50,7 @@ ress = "0.11.4"
|
||||||
phf = "0.11.1"
|
phf = "0.11.1"
|
||||||
base64 = "0.21.0"
|
base64 = "0.21.0"
|
||||||
urlencoding = "2.1.2"
|
urlencoding = "2.1.2"
|
||||||
quick-xml = { version = "0.26.0", features = ["serialize"], optional = true }
|
quick-xml = { version = "0.27.1", features = ["serialize"], optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
|
|
|
||||||
|
|
@ -3,61 +3,65 @@ use time::OffsetDateTime;
|
||||||
|
|
||||||
use crate::util;
|
use crate::util;
|
||||||
|
|
||||||
use super::Thumbnail;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub(crate) struct ChannelRss {
|
pub(crate) struct ChannelRss {
|
||||||
#[serde(rename = "$unflatten=yt:channelId")]
|
#[serde(rename = "channelId")]
|
||||||
pub channel_id: String,
|
pub channel_id: String,
|
||||||
#[serde(rename = "$unflatten=title")]
|
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub author: Author,
|
pub author: Author,
|
||||||
#[serde(rename = "$unflatten=published", with = "time::serde::rfc3339")]
|
#[serde(rename = "published", with = "time::serde::rfc3339")]
|
||||||
pub create_date: OffsetDateTime,
|
pub create_date: OffsetDateTime,
|
||||||
pub entry: Vec<Entry>,
|
pub entry: Vec<Entry>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub(crate) struct Entry {
|
pub(crate) struct Entry {
|
||||||
#[serde(rename = "$unflatten=yt:videoId")]
|
#[serde(rename = "videoId")]
|
||||||
pub video_id: String,
|
pub video_id: String,
|
||||||
#[serde(rename = "$unflatten=yt:channelId")]
|
#[serde(rename = "channelId")]
|
||||||
pub channel_id: String,
|
pub channel_id: String,
|
||||||
#[serde(rename = "$unflatten=title")]
|
|
||||||
pub title: String,
|
pub title: String,
|
||||||
#[serde(rename = "$unflatten=published", with = "time::serde::rfc3339")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub published: OffsetDateTime,
|
pub published: OffsetDateTime,
|
||||||
#[serde(rename = "$unflatten=updated", with = "time::serde::rfc3339")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub updated: OffsetDateTime,
|
pub updated: OffsetDateTime,
|
||||||
#[serde(rename = "$unflatten=media:group")]
|
#[serde(rename = "group")]
|
||||||
pub media_group: MediaGroup,
|
pub media_group: MediaGroup,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub(crate) struct MediaGroup {
|
pub(crate) struct MediaGroup {
|
||||||
#[serde(rename = "$unflatten=media:thumbnail")]
|
|
||||||
pub thumbnail: Thumbnail,
|
pub thumbnail: Thumbnail,
|
||||||
#[serde(rename = "$unflatten=media:description")]
|
|
||||||
pub description: String,
|
pub description: String,
|
||||||
#[serde(rename = "$unflatten=media:community")]
|
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize)]
|
||||||
|
pub(crate) struct Thumbnail {
|
||||||
|
#[serde(rename = "@url")]
|
||||||
|
pub url: String,
|
||||||
|
#[serde(rename = "@width")]
|
||||||
|
pub width: u32,
|
||||||
|
#[serde(rename = "@height")]
|
||||||
|
pub height: u32,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub(crate) struct Community {
|
pub(crate) struct Community {
|
||||||
#[serde(rename = "$unflatten=media:starRating")]
|
#[serde(rename = "starRating")]
|
||||||
pub rating: Rating,
|
pub rating: Rating,
|
||||||
#[serde(rename = "$unflatten=media:statistics")]
|
|
||||||
pub statistics: Statistics,
|
pub statistics: Statistics,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub(crate) struct Rating {
|
pub(crate) struct Rating {
|
||||||
|
#[serde(rename = "@count")]
|
||||||
pub count: u64,
|
pub count: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub(crate) struct Statistics {
|
pub(crate) struct Statistics {
|
||||||
|
#[serde(rename = "@views")]
|
||||||
pub views: u64,
|
pub views: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +70,16 @@ pub(crate) struct Author {
|
||||||
pub uri: String,
|
pub uri: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Thumbnail> for crate::model::Thumbnail {
|
||||||
|
fn from(tn: Thumbnail) -> Self {
|
||||||
|
crate::model::Thumbnail {
|
||||||
|
url: tn.url,
|
||||||
|
width: tn.width,
|
||||||
|
height: tn.height,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<ChannelRss> for crate::model::ChannelRss {
|
impl From<ChannelRss> for crate::model::ChannelRss {
|
||||||
fn from(feed: ChannelRss) -> Self {
|
fn from(feed: ChannelRss) -> Self {
|
||||||
let id = if feed.channel_id.is_empty() {
|
let id = if feed.channel_id.is_empty() {
|
||||||
|
|
|
||||||
Reference in a new issue