1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize)]
pub struct YVideo {
pub id: String,
pub title: String,
pub formats: Vec<YFormat>,
pub thumbnails: Vec<YThumbnail>,
pub thumbnail: String,
pub description: String,
pub channel_id: String,
pub duration: f64,
pub view_count: usize,
pub average_rating: Option<String>,
pub age_limit: usize,
pub webpage_url: String,
pub categories: Vec<String>,
pub tags: Vec<String>,
pub playable_in_embed: bool,
pub automatic_captions: HashMap<String, Vec<YCaption>>,
pub comment_count: Option<usize>,
pub chapters: Option<Vec<YChapter>>,
pub heatmap: Option<Vec<YHeatmapSample>>,
pub like_count: usize,
pub channel: String,
pub channel_follower_count: usize,
pub channel_is_verified: Option<bool>,
pub uploader: String,
pub uploader_id: String,
pub uploader_url: String,
pub upload_date: String,
pub availability: String, // "public" | "private" | "unlisted",
pub original_url: Option<String>,
pub webpage_url_basename: String,
pub webpage_url_domain: String,
pub extractor: String,
pub extractor_key: String,
pub playlist_count: usize,
pub playlist: String,
pub playlist_id: String,
pub playlist_title: String,
pub playlist_uploader: String,
pub playlist_uploader_id: String,
pub n_entries: usize,
pub playlist_index: usize,
pub display_id: String,
pub fulltitle: String,
pub duration_string: String,
pub is_live: bool,
pub was_live: bool,
pub epoch: usize,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YCaption {
pub url: Option<String>,
pub ext: String, //"vtt" | "json3" | "srv1" | "srv2" | "srv3" | "ttml",
pub protocol: Option<String>,
pub name: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YFormat {
pub format_id: String,
pub format_note: Option<String>,
pub ext: String,
pub protocol: String,
pub acodec: Option<String>,
pub vcodec: Option<String>,
pub url: Option<String>,
pub width: Option<u32>,
pub height: Option<u32>,
pub fps: Option<f64>,
pub columns: Option<u32>,
pub fragments: Option<Vec<YFragment>>,
pub resolution: String,
pub dynamic_range: Option<String>,
pub aspect_ratio: Option<f64>,
pub http_headers: HashMap<String, String>,
pub audio_ext: String,
pub video_ext: String,
pub vbr: Option<f64>,
pub abr: Option<f64>,
pub format: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YFragment {
pub url: String,
pub duration: f64,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YThumbnail {
pub url: String,
pub preference: i32,
pub id: String,
pub height: Option<u32>,
pub width: Option<u32>,
pub resolution: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YChapter {
pub start_time: f64,
pub end_time: f64,
pub title: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct YHeatmapSample {
pub start_time: f64,
pub end_time: f64,
pub value: f64,
}
|