mirror of
https://framagit.org/veretcle/tootube.git
synced 2025-07-20 20:41:17 +02:00
First functional version
This commit is contained in:
@@ -14,6 +14,7 @@ pub struct PeerTubeVideo {
|
||||
pub description: String,
|
||||
#[serde(rename = "streamingPlaylists")]
|
||||
pub streaming_playlists: Option<Vec<PeerTubeVideoStreamingPlaylists>>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -36,7 +37,7 @@ pub struct PeerTubeVideoStreamingPlaylistsFilesResolution {
|
||||
|
||||
/// This gets the last video uploaded to the PeerTube server
|
||||
pub fn get_latest_video(u: &str) -> Result<PeerTubeVideo, Box<dyn Error>> {
|
||||
let body = reqwest::blocking::get(format!("{}/api/v1/videos?count=1&sort=-publishedAt", u))?
|
||||
let body = reqwest::blocking::get(format!("{}/api/v1/videos?count=1&sort=publishedAt", u))?
|
||||
.json::<PeerTubeVideos>()?;
|
||||
|
||||
let vid = get_video_detail(u, &body.data[0].uuid)?;
|
||||
@@ -45,7 +46,7 @@ pub fn get_latest_video(u: &str) -> Result<PeerTubeVideo, Box<dyn Error>> {
|
||||
}
|
||||
|
||||
/// This returns the direct download URL for with the maximum resolution
|
||||
pub fn get_max_resolution_dl(p: &Vec<PeerTubeVideoStreamingPlaylists>) -> String {
|
||||
pub fn get_max_resolution_dl(p: &[PeerTubeVideoStreamingPlaylists]) -> String {
|
||||
let mut res = 0;
|
||||
let mut dl_url = String::new();
|
||||
|
||||
|
Reference in New Issue
Block a user