More cleanup (#2)

* Make functions take references, moved user agent into lib

* Improved error handling
This commit is contained in:
Schmiddiii 2021-10-06 12:19:11 +02:00 committed by GitHub
parent 412a8ffa52
commit 8a7a87824f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 152 additions and 119 deletions

View file

@ -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())