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]
name = "scootaloo"
version = "0.2.0"
version = "0.2.1"
authors = ["VC <veretcle+framagit@mateu.be>"]
edition = "2018"
@@ -8,14 +8,18 @@ edition = "2018"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
toml = "^0.5"
clap = "^2.33"
tokio = "^0.2"
egg-mode = "^0.14"
tokio = { version = "1", features = ["rt-multi-thread"]}
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"

View File

@@ -11,6 +11,7 @@ use std::{
//tokio
use tokio::runtime::Runtime;
use tokio_compat_02::FutureExt;
// toml
use serde::Deserialize;
@@ -36,7 +37,7 @@ use elefren::{
};
// reqwest
use reqwest::Client;
use reqwest::blocking::Client;
// htmlescape
use htmlescape::decode_html;
@@ -77,10 +78,11 @@ fn get_oauth2_token(config: &Config) -> Token {
/// Get twitter user timeline
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
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)
.with_page_size(200)
.older(lid))?;
.older(lid)
.compat())?;
Ok(feed.to_vec())
}