mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-21 17:34:37 +02:00
feat: async treatment of all accounts
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use crate::config::MastodonConfig;
|
||||
use crate::config::TwitterConfig;
|
||||
use crate::util::cache_media;
|
||||
use crate::ScootalooError;
|
||||
@@ -30,20 +29,15 @@ pub fn get_oauth2_token(config: &TwitterConfig) -> Token {
|
||||
|
||||
/// Gets Twitter user timeline
|
||||
pub async fn get_user_timeline(
|
||||
config: &MastodonConfig,
|
||||
screen_name: &str,
|
||||
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 (_, feed) = user_timeline(
|
||||
UserID::from(config.twitter_screen_name.to_owned()),
|
||||
true,
|
||||
false,
|
||||
token,
|
||||
)
|
||||
.with_page_size(200)
|
||||
.older(lid)
|
||||
.await?;
|
||||
let (_, feed) = user_timeline(UserID::from(screen_name.to_owned()), true, false, token)
|
||||
.with_page_size(20)
|
||||
.older(lid)
|
||||
.await?;
|
||||
|
||||
Ok(feed.to_vec())
|
||||
}
|
||||
|
Reference in New Issue
Block a user