Problem pulling Tweets with media using Dukt's Twitter API plugin {% set tweets = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended' }) %}

{% for tweet in tweets %}
    &lt;li&gt;

    {% if tweet.extended_entities.media is defined %}
        {% for item in tweet.extended_entities.media if item.type == 'photo' %}
            &lt;img src="{{ item.media_url }}"&gt;
        {% endfor %}
    {% endif %}

    &lt;/li&gt;
{% endfor %}


Anything obviously wrong here? I tested the API with a {{ dump(tweets) }} which seems fine.

This thread describes a similar issue but without a solution.
The return from craft.twitter.get() is not an array of tweets, but a response object, where the actual tweets are nested in an attribute called data.

Not tested, but from looking at the plugin docs, something like this should do it:

{% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended' }) %}

{% if response.success %}
    {% for tweet in response.data %}
        ...
    {% endfor %}
{% endif %}