data_for_seo/entity/serp/youtube/video_info.rs
1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4/// YouTube video-info advanced result object.
5/// See <https://docs.dataforseo.com/v3/serp/youtube/video_info/task_get/advanced/>.
6#[derive(Debug, Default, Serialize, Deserialize, Clone)]
7pub struct SerpApiYoutubeVideoInfoTaskAdvanced {
8 /// YouTube video identifier.
9 pub video_id: Option<String>,
10 /// Search-engine domain the results were taken from.
11 pub se_domain: Option<String>,
12 /// DataForSEO location code the search was run for.
13 pub location_code: Option<i32>,
14 /// Language code the search was run for.
15 pub language_code: Option<String>,
16 /// Direct URL to reproduce the search on the search engine.
17 pub check_url: Option<String>,
18 /// UTC timestamp when the result was received.
19 pub datetime: Option<String>,
20 /// Search-engine spelling correction applied to the query, if any.
21 pub spell: Option<Value>,
22 /// Distinct element types present in the returned SERP.
23 pub item_types: Option<Vec<String>>,
24 /// Number of items returned in this result.
25 pub items_count: Option<i64>,
26 /// Parsed elements of the result.
27 pub items: Option<Vec<SerpApiElementYoutubeVideoInfo>>,
28}
29
30/// `youtube_video_info` item describing a single video.
31#[derive(Debug, Default, Serialize, Deserialize, Clone)]
32pub struct SerpApiElementYoutubeVideoInfo {
33 /// Element type as reported by the DataForSEO API.
34 #[serde(rename = "type")]
35 pub type_of_element: Option<String>,
36 /// Rank of the element among elements of the same type.
37 pub rank_group: Option<i64>,
38 /// Absolute rank of the element across the whole SERP.
39 pub rank_absolute: Option<i64>,
40 /// YouTube video identifier.
41 pub video_id: Option<String>,
42 /// Title of the result.
43 pub title: Option<String>,
44 /// URL of the result.
45 pub url: Option<String>,
46 /// Snippet / description text of the result.
47 pub description: Option<String>,
48 /// URL of the thumbnail image.
49 pub thumbnail_url: Option<String>,
50 /// Category of the entity.
51 pub category: Option<String>,
52 /// YouTube channel identifier.
53 pub channel_id: Option<String>,
54 /// Name of the YouTube channel.
55 pub channel_name: Option<String>,
56 /// URL of the YouTube channel.
57 pub channel_url: Option<String>,
58 /// URL of the channel's logo image.
59 pub channel_logo: Option<String>,
60 /// Subscriber count of the channel.
61 pub channel_subscribers_count: Option<SerpApiYoutubeSubscribersCount>,
62 /// Number of views.
63 pub views_count: Option<i64>,
64 /// Number of likes.
65 pub likes_count: Option<i64>,
66 /// Total number of comments on the video.
67 pub comments_count: Option<i64>,
68 /// Human-readable publication date.
69 pub publication_date: Option<String>,
70 /// UTC timestamp associated with the result.
71 pub timestamp: Option<String>,
72 /// `true` if the video is a live stream.
73 pub is_live: Option<bool>,
74 /// `true` if the video can be embedded.
75 pub is_embeddable: Option<bool>,
76 /// Duration as a formatted string.
77 pub duration_time: Option<String>,
78 /// Duration in seconds.
79 pub duration_time_seconds: Option<i64>,
80 /// Keywords.
81 pub keywords: Option<Vec<String>>,
82 /// Subtitle tracks available for the video.
83 pub subtitles: Option<Vec<SerpApiYoutubeVideoSubtitleTrack>>,
84 /// Streaming-quality options available for the video.
85 pub streaming_quality: Option<Vec<SerpApiYoutubeStreamingQuality>>,
86}
87
88/// Channel subscriber count with both the raw and displayed forms.
89#[derive(Debug, Default, Serialize, Deserialize, Clone)]
90pub struct SerpApiYoutubeSubscribersCount {
91 /// Count as displayed (e.g. "1.2M").
92 pub displayed_count: Option<String>,
93 /// Numeric count.
94 pub count: Option<i64>,
95}
96
97/// A subtitle track available for the video.
98#[derive(Debug, Default, Serialize, Deserialize, Clone)]
99pub struct SerpApiYoutubeVideoSubtitleTrack {
100 /// Language code of the track.
101 pub language: Option<String>,
102 /// `true` if the subtitle track can be auto-translated.
103 pub is_translatable: Option<bool>,
104 /// `true` if the subtitles were auto-generated.
105 pub is_auto_generated: Option<bool>,
106}
107
108/// A streaming-quality option available for the video.
109#[derive(Debug, Default, Serialize, Deserialize, Clone)]
110pub struct SerpApiYoutubeStreamingQuality {
111 /// Human-readable label.
112 pub label: Option<String>,
113 /// Width of the bounding box, in pixels.
114 pub width: Option<i64>,
115 /// Height of the bounding box, in pixels.
116 pub height: Option<i64>,
117 /// Bitrate of the stream, in bits per second.
118 pub bitrate: Option<i64>,
119 /// MIME type of the stream.
120 pub mime_type: Option<String>,
121 /// Frames per second of the stream.
122 pub fps: Option<i64>,
123}