rustytweet

Crates.iorustytweet
lib.rsrustytweet
version0.1.0
sourcesrc
created_at2022-03-02 08:07:25.873769
updated_at2022-03-02 08:07:25.873769
descriptionCrate for Twitter API
homepage
repository
max_upload_size
id542065
size14,025
Akhil (akhildevelops)

documentation

README

rustytweet


Library for Twitter V2 API.

Currently the library accepts App-Access token i.e Bearer Token.

To generate access token for using twitter api. Follow this twitter dev link.

Below are the few examples to access the twitter data.

Examples:

Below is a basic example for fetching tweets with hashtag #nyc

let twitter_client = TwitterClient::builder()
        .set_bearer_token("<bearer_token>".to_string())
        .build().unwrap();

let resp = twitter_client
        .search_recent_tweets("#nyc")
        .send();

For more Tweet related content about author of the tweet, location, etc..,. use expansions. Refer to Twitter Expansions

let twitter_client = TwitterClient::builder()
        .set_bearer_token("<bearer_token>".to_string())
        .build();

    let media_expansion = Expansion::User(&["description", "created_at", "location"]);
    let tweet_expansion = Expansion::Tweet(&[
        "author_id",
        "created_at",
        "in_reply_to_user_id",
        "referenced_tweets",
    ]);
    let resp = twitter_client
        .unwrap()
        .search_recent_tweets("#nyc")
        .expansion(&[media_expansion, tweet_expansion])
        .send();
Commit count: 0

cargo fmt