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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! Rust bindings for the [Invidious API](https://docs.invidious.io/api).
//!
//! ## Quickstart
//!
//! Get started by creating a client with `ClientSync::default()` and use the functions from there.
//!
//! ### Blocking API
//!
//! ```
//! use invidious::*;
//!
//! fn main() {
//! let client = ClientSync::default();
//! let video = client.video("fBj3nEdCjkY", None).unwrap();
//! let seach_results = client.search(Some("q=testing")).unwrap();
//! }
//! ```
//!
//! ### Async API
//!
//! Enable feature `reqwest_async`.
//!
//! ```toml
//! invidious = { version = "0.6", no-default-features = true, features = ["reqwest_async"]}
//! ```
//!
//! ```
//! # use invidious::*;
//! #[tokio::main]
//! async fn main() {
//! let client = ClientAsync::default();
//! let vidio = client.video("fBj3nEdCjkY", None).await.unwrap();
//! let seach_results = client.search(Some("q=testing")).await.unwrap();
//! }
//! ```
//!
//! Read more about [`ClientSync`](./struct.ClientSync.html) and [`ClientAsync`](./struct.ClientAsync.html) to see all avaliable functions.
//!
//! ## Methods
//!
//! Control how the client is making the web requests.
//!
//! ### Changing methods
//!
//! For example, to use `isahc` instead of `reqwest` for sending requests in `ClientAsync`, first
//! enable the `isahc_async` feature and optionally disable the `reqwest_async` feature (if
//! enabled).
//!
//! ```toml
//! invidious = { version = "6.0", no-default-features = true, features = ["isahc_async"]}
//! ```
//!
//! ```
//! # use invidious::*;
//! # #[tokio::main]
//! # async fn main() {
//! let video = ClientAsync::default()
//! .method(MethodAsync::Isahc)
//! .video("fBj3nEdCjkY", None).await.unwrap();
//! # }
//! ```
//!
//! If none of the fetch methods matches your needs, consider implmenting your own client struct.
//! ([Sync](./trait.ClientSyncTrait.html) and [async](./trait.ClientAsyncTrait.html))
//!
//! ## Features
//!
//! This crate utilises features for specifying which crates to use for fetching the http(s) responses. Only crates that are needed are included. Different features result in various compile times and performances. The compile times of each feature can be found in [`MethodSync`](./enum.MethodSync.html) and [`MethodAsync`](./enum.MethodAsync.html).
//!
//! All avaliable features are listed below.
//!
//! |Feature|Crate used|
//! |---|---|
//! |`httpreq_sync` (enabled by default)|[http_req](https://crates.io/crates/http_req)|
//! |`ureq_sync`|[ureq](https://crates.io/crates/ureq)|
//! |`minreq_sync`|[minreq](https://crates.io/crates/minreq) with https feature|
//! |`minreq_http_sync`|[minreq](https://crates.io/crates/minreq)|
//! |`reqwest_sync`|[reqwest](https://crates.io/crates/reqwest) with blocking feature|
//! |`reqwest_async`|[reqwest](https://crates.io/crates/reqwest)|
//! |`isahc_sync`|[isahc](https://crates.io/crates/isahc)|
//! |`isahc_async`|[isahc](https://crates.io/crates/isahc)|
//!
//! ## General usage
//!
//! Most functions look something like:
//!
//! ```rs
//! client.function_name(id: &str, params: Option<&str>) // when id is needed.
//! client.function_name(params: Option<&str>) // when id is not needed, for example search.
//! ```
//!
//! ### Params
//!
//! Params allows user to include URL params as specified in the [Invidious API docs](https://docs.invidious.io/api).
//!
//! The beginning question mark `?` is omitted.
//!
//! ## How this works
//!
//! [Invidious](https://invidious.io) is an alternative frontend for YouTube, and also offering an API.
//!
//! This crate includes structs for each of the API endpoints, and allowing users to include any extra parameters they want. Then uses the [serde](https://crates.io/crates/serde) crate to serialize and deserialize json responses from the [Invidious API](https://docs.invidious.io/api).
//!
//! ## Contributing
//!
//! Contributions are welcome! Make a pull request at [GitHub](https://github.com/siriusmart/invidious-rs) if you do.
//!
//! - Make changes to outdated bindings structs.
//! - Add new fetch methods with either faster compile time or runtime.
//! - Improve documentation.
pub use InvidiousError;
pub use *;
pub use *;
/// Default instance used in `ClientSync/ClientAsync::default()`.
pub const INSTANCE: &str = "https://inv.bp.projectsegfau.lt";
/// Some instances required a user agent to be set, but it is not implmented yet
pub const USER_AGENT: &str = concat!;
pub use async_trait;
pub use http_req;
pub use isahc;
pub use minreq;
pub use reqwest;
pub use ureq;