data_for_seo/entity/content_analysis/search.rs
1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4/// Result of `content_analysis/search/live`: citations found for a keyword.
5/// See <https://docs.dataforseo.com/v3/content_analysis/search/live/>.
6#[derive(Debug, Default, Serialize, Deserialize, Clone)]
7pub struct ContentAnalysisApiSearch {
8 /// Token to pass back as `offset_token` to page beyond 10,000 results.
9 pub offset_token: Option<String>,
10 /// Total number of matching citations in the database.
11 pub total_count: Option<i64>,
12 /// Number of citations returned in `items`.
13 pub items_count: Option<i64>,
14 /// Citations found for the keyword.
15 pub items: Option<Vec<ContentAnalysisApiSearchItem>>,
16}
17
18/// A single citation (`content_analysis_search` element).
19#[derive(Debug, Default, Serialize, Deserialize, Clone)]
20pub struct ContentAnalysisApiSearchItem {
21 /// Element type, always `content_analysis_search`.
22 #[serde(rename = "type")]
23 pub element_type: Option<String>,
24 /// URL where the citation was found.
25 pub url: Option<String>,
26 /// Domain name.
27 pub domain: Option<String>,
28 /// Main domain.
29 pub main_domain: Option<String>,
30 /// Rank of the URL (0–100 or 0–1000 per `rank_scale`), from the DataForSEO
31 /// Backlink Index.
32 pub url_rank: Option<i64>,
33 /// Backlink spam score of the URL, from the DataForSEO Backlink Index.
34 pub spam_score: Option<i64>,
35 /// Rank of the domain (0–100 or 0–1000 per `rank_scale`), from the
36 /// DataForSEO Backlink Index.
37 pub domain_rank: Option<i64>,
38 /// UTC datetime the crawler last visited the page
39 /// (`yyyy-mm-dd hh-mm-ss +00:00`).
40 pub fetch_time: Option<String>,
41 /// ISO country code of the domain registration.
42 pub country: Option<String>,
43 /// Main language of the domain.
44 pub language: Option<String>,
45 /// Citation prominence score; higher means a more valuable citation.
46 pub score: Option<f64>,
47 /// Product/service category IDs relevant to the page.
48 pub page_category: Option<Vec<i64>>,
49 /// Page type classifications (e.g. blogs, news, ecommerce).
50 pub page_types: Option<Vec<String>>,
51 /// Ratings found on the page via microdata.
52 pub ratings: Option<Vec<ContentAnalysisRating>>,
53 /// Social media engagement metrics for the page.
54 pub social_metrics: Option<Vec<ContentAnalysisSocialMetric>>,
55 /// Detailed content data for the citation.
56 pub content_info: Option<ContentAnalysisContentInfo>,
57}
58
59/// Microdata-based rating attached to a citation. Values are strings as
60/// returned by the API.
61#[derive(Debug, Default, Serialize, Deserialize, Clone)]
62pub struct ContentAnalysisRating {
63 /// Rating name (e.g. `Max5`, `Percents`, `CustomMax`).
64 pub name: Option<String>,
65 /// The rating value.
66 pub rating_value: Option<String>,
67 /// Number of votes.
68 pub rating_count: Option<String>,
69 /// Maximum value for the rating name.
70 pub max_rating_value: Option<String>,
71 /// Rating normalized relative to its maximum.
72 pub relative_rating: Option<String>,
73}
74
75/// Social engagement metric for a citation.
76#[derive(Debug, Default, Serialize, Deserialize, Clone)]
77pub struct ContentAnalysisSocialMetric {
78 /// Social platform the metric comes from.
79 #[serde(rename = "type")]
80 pub element_type: Option<String>,
81 /// Number of likes.
82 pub like_count: Option<i64>,
83}
84
85/// Detailed content data for a citation.
86#[derive(Debug, Default, Serialize, Deserialize, Clone)]
87pub struct ContentAnalysisContentInfo {
88 /// Content classification (e.g. `page_content`, `comment`).
89 pub content_type: Option<String>,
90 /// Citation title.
91 pub title: Option<String>,
92 /// Page title.
93 pub main_title: Option<String>,
94 /// Title of the preceding content block.
95 pub previous_title: Option<String>,
96 /// Heading level of the title, 1 (top) to 6 (bottom).
97 pub level: Option<i64>,
98 /// Content author.
99 pub author: Option<String>,
100 /// Content excerpt.
101 pub snippet: Option<String>,
102 /// Character length of the snippet.
103 pub snippet_length: Option<i64>,
104 /// Social media engagement metrics for the content.
105 pub social_metrics: Option<Vec<ContentAnalysisSocialMetric>>,
106 /// Highlighted text from the snippet.
107 pub highlighted_text: Option<String>,
108 /// Content language.
109 pub language: Option<String>,
110 /// Probability index per sentiment connotation (anger, happiness, love,
111 /// sadness, share, fun).
112 pub sentiment_connotations: Option<HashMap<String, f64>>,
113 /// Probability index per sentiment polarity (positive, negative, neutral).
114 pub connotation_types: Option<HashMap<String, f64>>,
115 /// Text category IDs of the content.
116 pub text_category: Option<Vec<i64>>,
117 /// UTC datetime the content was published
118 /// (`yyyy-mm-dd hh-mm-ss +00:00`).
119 pub date_published: Option<String>,
120 /// Quality score derived from word, sentence, and character counts.
121 pub content_quality_score: Option<f64>,
122 /// HTML semantic element the citation sits in (e.g. `article`, `header`).
123 pub semantic_location: Option<String>,
124 /// Content rating related to this citation.
125 pub rating: Option<ContentAnalysisRating>,
126 /// UTC datetime used to group citations by date — publication date or first
127 /// crawl (`yyyy-mm-dd hh-mm-ss +00:00`).
128 pub group_date: Option<String>,
129}