1

I am using DUKT's Twitter 1.0.32 but am fresh at reading APIs, so would like a little help. I would like to request tweets with image only from our main ID.

 {% set tweets = craft.twitter.get('statuses/user_timeline', {count:3}) %}

This works fine, but even an attempt to play around with the other parameters within user_timeline baffles me.

Could I ask for some examples to display tweet text & image, plus some other relevant parameters?

Nutmeg
  • 598
  • 1
  • 4
  • 17

1 Answers1

1

I have used it like this. You can find the documentation for most fields on Twitter. Truth be told, the DUKT documentation is not too transparent.

{% set tweets = craft.twitter.get('statuses/user_timeline', { user_id:'', count: 10, trim_user: false }) %}
{% if tweets %}
    <ul class="tweet__list">
        {% for tweet in tweets %}
        <li">
           <img src="{{ tweet.user.profile_image_url }}" alt="">
           <p>{{tweet.text|autoLinkTweet}}</p>
           <span class="date">{{ tweet.created_at | twitterTimeAgo )}</span>        
        </li>
        {% endfor %}
    </ul>
{% endif %}

Update

You have several entities in the data you get back from Twitter API (as described by Twitter): media, urls, user_mentions, hashtags, and symbols. The DUKT plugin, however only gives back urls, user_mentions, hashtags, and symbols as far as I see in the error messages they provide.

 {{tweet.entities}}
Jan_dh
  • 858
  • 4
  • 13
  • Bedankt Jan, the {{ tweet.created_at)} tag renders an error, but I am looking for the tag which produces the tweeted image, not the user profile image. – Nutmeg Oct 02 '16 at 20:59
  • I have tried all sorts of combos with and but neither work.... – Nutmeg Oct 03 '16 at 06:12
  • updated the answer and the created_at tag ;) – Jan_dh Oct 03 '16 at 07:46
  • Thanks again, Jan your answer explains the deafening silence by DUKT. The image tag is the main feature by my client, so no use for this plugin then..... – Nutmeg Oct 03 '16 at 07:55
  • 1
    Found an answer on this thread; (http://craftcms.stackexchange.com/questions/17305/is-it-possible-to-get-a-tweet-image-when-using-twitter-plugin) – Nutmeg Oct 18 '16 at 05:46