Update to egg-mode 0.14, need to find a fix for async call of user_timeline

This commit is contained in:
VC
2020-05-18 13:38:36 +02:00
parent 2e8bdfbd39
commit fe9bd55c01

View File

@@ -9,6 +9,9 @@ use std::{
error::Error, error::Error,
}; };
//async_std
use async_std::task;
// toml // toml
use serde::Deserialize; use serde::Deserialize;
@@ -17,12 +20,12 @@ use egg_mode::{
Token, Token,
KeyPair, KeyPair,
entities::{UrlEntity, MediaEntity, MentionEntity, MediaType}, entities::{UrlEntity, MediaEntity, MentionEntity, MediaType},
user::UserID,
tweet::{ tweet::{
Tweet, Tweet,
user_timeline, user_timeline,
}, },
}; };
use tokio::runtime::current_thread::block_on_all;
// mammut // mammut
use mammut::{ use mammut::{
@@ -76,7 +79,7 @@ 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 (_timeline, feed) = block_on_all(user_timeline(&config.twitter.username, true, false, &token) let (_timeline, feed) = task::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))?;