aboutsummaryrefslogtreecommitdiff
path: root/import/src/infojson.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-04 12:37:07 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-04 12:37:07 +0200
commit9bef55396cc9a9a4d83970a26bf56f07d5f0377d (patch)
tree8709da46cd02df8c97338a84fafd3183837b3fb3 /import/src/infojson.rs
parent016b8fec6ed9908e11e72ec7b9930e5908d58a02 (diff)
downloadjellything-9bef55396cc9a9a4d83970a26bf56f07d5f0377d.tar
jellything-9bef55396cc9a9a4d83970a26bf56f07d5f0377d.tar.bz2
jellything-9bef55396cc9a9a4d83970a26bf56f07d5f0377d.tar.zst
infojson schema
Diffstat (limited to 'import/src/infojson.rs')
-rw-r--r--import/src/infojson.rs123
1 files changed, 123 insertions, 0 deletions
diff --git a/import/src/infojson.rs b/import/src/infojson.rs
new file mode 100644
index 0000000..6f98eaa
--- /dev/null
+++ b/import/src/infojson.rs
@@ -0,0 +1,123 @@
+/*
+ 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: usize,
+ pub chapters: Vec<YChapter>,
+ pub heatmap: Vec<YHeatmapSample>,
+ pub like_count: usize,
+ pub channel: String,
+ pub channel_follower_count: usize,
+ pub channel_is_verified: 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: 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 playlist_autonumber: 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: String,
+ pub ext: String, //"vtt" | "json3" | "srv1" | "srv2" | "srv3" | "ttml",
+ pub protocol: Option<String>,
+ pub name: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct YFormat {
+ pub format_id: String,
+ pub format_note: String,
+ pub ext: String,
+ pub protocol: String,
+ pub acodec: String,
+ pub vcodec: String,
+ pub url: String,
+ pub width: u32,
+ pub height: u32,
+ pub fps: f64,
+ pub columns: u32,
+ pub fragments: Vec<YFragment>,
+ pub resolution: Vec<String>,
+ pub dynamic_range: Option<String>,
+ pub aspect_ratio: f64,
+ pub http_headers: HashMap<String, String>,
+ pub audio_ext: String,
+ pub video_ext: String,
+ pub vbr: usize,
+ pub abr: usize,
+ 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: String,
+ pub value: f64,
+}