Is it possible to see text of tweets longer than 140 characters in Standard: search / Tweets endpoint?

search
api
standard

#1

Is it possible to see text of tweets longer than 140 characters in Standard: search / Tweets endpoint?
Or only in Premium: Search Tweets API: 30-Days or more Can you see all the text of Tweets longer than 140 characters?


#2

Yes!

There is a parameter for tweet_mode=extended

Check the docs here: https://developer.twitter.com/en/docs/tweets/tweet-updates


#3

Any reason why I can’t seem to get full_text tweets for the following query?

https://api.twitter.com/1.1/search/tweets.json?q=%40slpng_giants&tweet_mode=extended 

{
    "created_at": "Sun Jul 15 07:39:54 +0000 2018",
    "id": 1018399744559853600,
    "id_str": "1018399744559853573",
    "text": "@crowder @whiskyfiddle @slpng_giants @facebook True. But as far as I'm aware the same issues of data sharing, data… https://t.co/r1S5R5PQjZ",
    "truncated": true,
    "entities": {
        "hashtags": [],
        "symbols": [],
        "user_mentions": [
            {
                "screen_name": "crowder",
                "name": "ℭ𝔯𝔬𝔴𝔡𝔢𝔯",
                "id": 3288561,
                "id_str": "3288561",
                "indices": [
                    0,
                    8
                ]
            },
            {
                "screen_name": "whiskyfiddle",
                "name": "whiskyfiddle",
                "id": 822887113817550800,
                "id_str": "822887113817550848",
                "indices": [
                    9,
                    22
                ]
            },
            {
                "screen_name": "slpng_giants",
                "name": "Sleeping Giants",
                "id": 799047255378391000,
                "id_str": "799047255378391040",
                "indices": [
                    23,
                    36
                ]
            },
            {
                "screen_name": "facebook",
                "name": "Facebook",
                "id": 2425151,
                "id_str": "2425151",
                "indices": [
                    37,
                    46
                ]
            }
        ],
        "urls": [
            {
                "url": "https://t.co/r1S5R5PQjZ",
                "expanded_url": "https://twitter.com/i/web/status/1018399744559853573",
                "display_url": "twitter.com/i/web/status/1…",
                "indices": [
                    116,
                    139
                ]
            }
        ]
    },
    "metadata": {
        "iso_language_code": "en",
        "result_type": "recent"
    },
    "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>",
    "in_reply_to_status_id": 1018283514209288200,
    "in_reply_to_status_id_str": "1018283514209288192",
    "in_reply_to_user_id": 3288561,
    "in_reply_to_user_id_str": "3288561",
    "in_reply_to_screen_name": "crowder",
    "user": {
        "id": 451460545,
        "id_str": "451460545",
        "name": "(((Snigdha)))",
        "screen_name": "snigskitchen",
        "location": "London, England",
        "description": "Snigdha Nag: blogger, cook, trainee gastronaut, legal writer, university lecturer, music fan, social media nut, Barrister. Views my own. https://t.co/4zL4kJZL1P",
        "url": "https://t.co/dkupOMOlDq",
        "entities": {
            "url": {
                "urls": [
                    {
                        "url": "https://t.co/dkupOMOlDq",
                        "expanded_url": "http://snigskitchen.blogspot.co.uk/",
                        "display_url": "snigskitchen.blogspot.co.uk",
                        "indices": [
                            0,
                            23
                        ]
                    }
                ]
            },
            "description": {
                "urls": [
                    {
                        "url": "https://t.co/4zL4kJZL1P",
                        "expanded_url": "http://snigskitchen.tumblr.com",
                        "display_url": "snigskitchen.tumblr.com",
                        "indices": [
                            137,
                            160
                        ]
                    }
                ]
            }
        },
        "protected": false,
        "followers_count": 8524,
        "friends_count": 8789,
        "listed_count": 238,
        "created_at": "Sat Dec 31 13:40:56 +0000 2011",
        "favourites_count": 89085,
        "utc_offset": null,
        "time_zone": null,
        "geo_enabled": true,
        "verified": false,
        "statuses_count": 90186,
        "lang": "en",
        "contributors_enabled": false,
        "is_translator": false,
        "is_translation_enabled": false,
        "profile_background_color": "000000",
        "profile_background_image_url": "http://abs.twimg.com/images/themes/theme10/bg.gif",
        "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme10/bg.gif",
        "profile_background_tile": false,
        "profile_image_url": "http://pbs.twimg.com/profile_images/999740987810467840/HPm7__O0_normal.jpg",
        "profile_image_url_https": "https://pbs.twimg.com/profile_images/999740987810467840/HPm7__O0_normal.jpg",
        "profile_banner_url": "https://pbs.twimg.com/profile_banners/451460545/1402052974",
        "profile_link_color": "981CEB",
        "profile_sidebar_border_color": "000000",
        "profile_sidebar_fill_color": "000000",
        "profile_text_color": "000000",
        "profile_use_background_image": false,
        "has_extended_profile": false,
        "default_profile": false,
        "default_profile_image": false,
        "following": null,
        "follow_request_sent": null,
        "notifications": null,
        "translator_type": "none"
    },
    "geo": null,
    "coordinates": null,
    "place": null,
    "contributors": null,
    "is_quote_status": false,
    "retweet_count": 0,
    "favorite_count": 0,
    "favorited": false,
    "retweeted": false,
    "lang": "en"
}

#4

I’m unable to reproduce this using twurl - the full_text extended Tweets come through just fine using those same parameters.


#5

Hi Andy,

Thanks for the reply. I was using Python’s request module, though I just gave twurl a go as well:

twurl /1.1/search/tweets.json?q=%40slpng_giants&tweet_mode=extended

I still seem unable to get results with the full_text parameter though. I’m using account authentication in both cases if that matters.

Thanks,
Michael


#6

Facepalm. I got twurl to give me extended results. Turns out my shell lopped off everything after &. Just had to wrap the url in quotes:

twurl "/1.1/search/tweets.json?q=%40slpng_giants&tweet_mode=extended"

Now to see why it isn’t working in Python…


#7

@andypiper, think I figured out why this confused me in Python.

I made use of next_results in the search_metadata section of the results to load consecutive pages. The queries in next_results and refresh_url omit tweet_mode=extended for the /search/tweets end point:

twurl "/1.1/search/tweets.json?q=%40slpng_giants&tweet_mode=extended"
{
    "search_metadata": {
        "completed_in": 0.049,
        "max_id": 1027809850019831800,
        "max_id_str": "1027809850019831808",
        "next_results": "?max_id=1027809648697438207&q=%2540slpng_giants&include_entities=1",
        "query": "%2540slpng_giants",
        "refresh_url": "?since_id=1027809850019831808&q=%2540slpng_giants&include_entities=1",
        "count": 15,
        "since_id": 0,
        "since_id_str": "0"
    }
}

This works for other end points, such as /statuses/user_timeline, so I was expecting it to work across the board.

I am now manually injecting tweet_mode=extended into the query which solves it for me

url = f'{base_url}{endpoint}.json'
if more_results:
    url += more_results
    if 'tweet_mode=extended' not in url:
        url += '&tweet_mode=extended'

#8