use std::lazy::SyncLazy;
use tokio::runtime::Runtime;
#[doc(inline)]
#[cfg(any(feature = "descramble", doc))]
#[doc(cfg(feature = "descramble"))]
pub use descrambler::VideoDescrambler;
#[doc(inline)]
#[cfg(any(feature = "fetch", doc))]
#[doc(cfg(feature = "fetch"))]
pub use fetcher::VideoFetcher;
#[doc(inline)]
#[cfg(any(feature = "descramble", doc))]
#[doc(cfg(feature = "descramble"))]
pub use video::Video;
pub static RT: SyncLazy<Runtime> = SyncLazy::new(||
Runtime::new().expect("Unable to start the tokio Runtime")
);
#[macro_export]
#[doc(cfg(feature = "blocking"))]
#[cfg(any(feature = "blocking", doc))]
macro_rules! block {
(async $future:block) => { $crate::blocking::RT.block_on(async $future) };
(async move $future:block) => { $crate::blocking::RT.block_on(async move $future) };
($future:expr) => {
$crate::blocking::RT.block_on(async {
$future.await
})
};
}
#[doc(hidden)]
#[cfg(any(feature = "fetch", doc))]
#[doc(cfg(feature = "fetch"))]
pub mod fetcher;
#[doc(hidden)]
#[cfg(any(feature = "descramble", doc))]
#[doc(cfg(feature = "descramble"))]
pub mod descrambler;
#[doc(hidden)]
#[cfg(any(feature = "descramble", doc))]
#[doc(cfg(feature = "descramble"))]
pub mod video;
#[inline]
#[cfg(any(all(feature = "download", feature = "regex"), doc))]
#[doc(cfg(all(feature = "download", feature = "regex")))]
pub fn download_best_quality(video_identifier: &str) -> crate::Result<std::path::PathBuf> {
block!(crate::download_best_quality(video_identifier))
}
#[inline]
#[cfg(any(all(feature = "download", feature = "regex"), doc))]
#[doc(cfg(all(feature = "download", feature = "regex")))]
pub fn download_worst_quality(video_identifier: &str) -> crate::Result<std::path::PathBuf> {
block!(crate::download_worst_quality(video_identifier))
}