Update various shits and give tokio compat 0.2

This commit is contained in:
VC
2021-03-10 20:59:42 +01:00
parent fdbb365149
commit 367377c090
3 changed files with 650 additions and 118 deletions

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