Merge branch 'update_versions' into 'master'

Update various shits and give tokio compat 0.2

See merge request veretcle/scootaloo!10
This commit is contained in:
VC
2021-03-10 21:45:20 +00:00
3 changed files with 650 additions and 118 deletions

746
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "scootaloo" name = "scootaloo"
version = "0.2.0" version = "0.2.1"
authors = ["VC <veretcle+framagit@mateu.be>"] authors = ["VC <veretcle+framagit@mateu.be>"]
edition = "2018" edition = "2018"
@@ -8,14 +8,18 @@ edition = "2018"
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
toml = "^0.5" toml = "^0.5"
clap = "^2.33" clap = "^2.33"
tokio = "^0.2" tokio = { version = "1", features = ["rt-multi-thread"]}
egg-mode = "^0.14" tokio-compat-02 = "0.2"
elefren = "^0.20" egg-mode = "^0.15"
reqwest = "^0.9" elefren = "^0.22"
reqwest = { version="^0.11", features = ["blocking"] }
htmlescape = "^0.3" htmlescape = "^0.3"

View File

@@ -11,6 +11,7 @@ use std::{
//tokio //tokio
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
use tokio_compat_02::FutureExt;
// toml // toml
use serde::Deserialize; use serde::Deserialize;
@@ -36,7 +37,7 @@ use elefren::{
}; };
// reqwest // reqwest
use reqwest::Client; use reqwest::blocking::Client;
// htmlescape // htmlescape
use htmlescape::decode_html; use htmlescape::decode_html;
@@ -77,10 +78,11 @@ fn get_oauth2_token(config: &Config) -> Token {
/// Get twitter user timeline /// Get twitter user timeline
fn get_user_timeline(config: &Config, token: Token, lid: Option<u64>) -> Result<Vec<Tweet>, Box<dyn Error>> { fn get_user_timeline(config: &Config, token: Token, lid: Option<u64>) -> Result<Vec<Tweet>, Box<dyn Error>> {
// fix the page size to 200 as it is the maximum Twitter authorizes // fix the page size to 200 as it is the maximum Twitter authorizes
let mut rt = Runtime::new()?; let rt = Runtime::new()?;
let (_timeline, feed) = rt.block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token) let (_timeline, feed) = rt.block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token)
.with_page_size(200) .with_page_size(200)
.older(lid))?; .older(lid)
.compat())?;
Ok(feed.to_vec()) Ok(feed.to_vec())
} }