Add support for extracting videos.

This commit is contained in:
FireMasterK 2021-04-30 11:39:32 +05:30
parent dabd19981c
commit d81633205f
No known key found for this signature in database
GPG key ID: 8DFF5DD33E93DB58
3 changed files with 93 additions and 0 deletions

View file

@ -20,3 +20,7 @@ path = "playlist.rs"
[[example]]
name = "trending"
path = "trending.rs"
[[example]]
name = "video"
path = "video.rs"

21
examples/video.rs Normal file
View file

@ -0,0 +1,21 @@
use piped::piped::PipedClient;
use reqwest::ClientBuilder;
#[tokio::main]
async fn main() {
let httpclient = ClientBuilder::new()
.user_agent("Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0")
.build()
.unwrap();
let instance = "https://pipedapi.kavin.rocks".to_string();
let client = PipedClient::new(httpclient, instance);
let video = client
.get_video_from_id("__hYx6ZzFbQ".to_string())
.await
.unwrap();
println!("{:?}", video);
}