mirror of
https://github.com/TeamPiped/piped-rust-sdk.git
synced 2024-08-14 23:56:06 +00:00
More cleanup (#2)
* Make functions take references, moved user agent into lib * Improved error handling
This commit is contained in:
parent
412a8ffa52
commit
8a7a87824f
10 changed files with 152 additions and 119 deletions
|
@ -1,16 +1,13 @@
|
|||
use piped::PipedClient;
|
||||
use reqwest::ClientBuilder;
|
||||
use reqwest::Client;
|
||||
|
||||
const INSTANCE: &'static str = "https://pipedapi.kavin.rocks";
|
||||
|
||||
#[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 httpclient = Client::new();
|
||||
|
||||
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||
|
||||
let client = PipedClient::new(httpclient, instance);
|
||||
let client = PipedClient::new(&httpclient, INSTANCE);
|
||||
|
||||
let channel = client
|
||||
.channel_from_id("UCXuqSBlHAE6Xw-yeJA0Tunw".to_string())
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
use piped::PipedClient;
|
||||
use reqwest::ClientBuilder;
|
||||
use reqwest::Client;
|
||||
|
||||
const INSTANCE: &'static str = "https://pipedapi.kavin.rocks";
|
||||
|
||||
#[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 httpclient = Client::new();
|
||||
|
||||
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||
|
||||
let client = PipedClient::new(httpclient, instance);
|
||||
let client = PipedClient::new(&httpclient, INSTANCE);
|
||||
|
||||
let comments = client
|
||||
.comments_from_id("__hYx6ZzFbQ".to_string())
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
use piped::PipedClient;
|
||||
use reqwest::ClientBuilder;
|
||||
use reqwest::Client;
|
||||
|
||||
const INSTANCE: &'static str = "https://pipedapi.kavin.rocks";
|
||||
|
||||
#[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 httpclient = Client::new();
|
||||
|
||||
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||
|
||||
let client = PipedClient::new(httpclient, instance);
|
||||
let client = PipedClient::new(&httpclient, INSTANCE);
|
||||
|
||||
let playlist = client
|
||||
.playlist_from_id("PLQSoWXSpjA38FIQCvwnVNPlGPVA63WTD8".to_string())
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
use piped::PipedClient;
|
||||
use reqwest::ClientBuilder;
|
||||
use reqwest::Client;
|
||||
|
||||
const INSTANCE: &'static str = "https://pipedapi.kavin.rocks";
|
||||
|
||||
#[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 httpclient = Client::new();
|
||||
|
||||
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||
|
||||
let client = PipedClient::new(httpclient, instance);
|
||||
let client = PipedClient::new(&httpclient, INSTANCE);
|
||||
|
||||
let suggestions = client
|
||||
.search_suggestions("techlore".to_string())
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
use piped::PipedClient;
|
||||
use reqwest::ClientBuilder;
|
||||
use reqwest::Client;
|
||||
|
||||
const INSTANCE: &'static str = "https://pipedapi.kavin.rocks";
|
||||
|
||||
#[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 httpclient = Client::new();
|
||||
|
||||
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||
|
||||
let client = PipedClient::new(httpclient, instance);
|
||||
let client = PipedClient::new(&httpclient, INSTANCE);
|
||||
|
||||
let streams = client.trending("US".to_string()).await.unwrap();
|
||||
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
use piped::PipedClient;
|
||||
use reqwest::ClientBuilder;
|
||||
use reqwest::Client;
|
||||
|
||||
const INSTANCE: &'static str = "https://pipedapi.kavin.rocks";
|
||||
|
||||
#[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 httpclient = Client::new();
|
||||
|
||||
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||
|
||||
let client = PipedClient::new(httpclient, instance);
|
||||
let client = PipedClient::new(&httpclient, INSTANCE);
|
||||
|
||||
let video = client
|
||||
.video_from_id("__hYx6ZzFbQ".to_string())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue