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
//! A Library for extracting information from YouTube pages.
//!
//! # Notes
//!
//! ##### Subscriber count
//!
//! All functions that return subscriber counts only return 3-digit precision
//! values as that is all that youtube returns. That means if channel has
//! exactly `164_583` subscribers, this library will return `164_000`.
//!
//! # Basic Example
//!
//! ```rust
//! # #[async_std::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Get a Client for making request
//! let client = ytextract::Client::new().await?;
//!
//! // Get information about the Video identified by the id "nI2e-J6fsuk".
//! let video = client.video("nI2e-J6fsuk".parse()?).await?;
//!
//! // Print the title of the Video
//! println!("Title: {}", video.title());
//! # Ok(())
//! # }
//! ```

#![deny(missing_docs, unsafe_code, rustdoc::missing_crate_level_docs)]

#[macro_use]
pub(crate) mod id;

pub mod channel;
mod client;
pub mod error;
pub(crate) mod player;
pub mod playlist;
pub mod stream;
mod thumbnail;
pub mod video;
pub(crate) mod youtube;

pub use channel::Channel;
pub use client::Client;
pub use error::Error;
pub use playlist::Playlist;
pub use stream::Stream;
pub use thumbnail::Thumbnail;
pub use video::Video;

/// The Result type used by this library
pub type Result<T> = std::result::Result<T, Error>;