sonnyt / tweetie

Simple jQuery Twitter feed plugin
https://sonnyt.com/tweetie
312 stars 116 forks source link

Hashtags #46

Closed brandudno closed 9 years ago

brandudno commented 9 years ago

I'm having issues with hashtags and documentation seems to be limited - can anyone help?

Currently I'm trying to pull through a specific hashtag using the following snippet -

  $('.tweet').twittie({

        hashtag: 'networktoolkit',
        dateFormat: '%b. %d, %Y',
        template: '<strong class="date">{{date}}</strong> - {{screen_name}} {{tweet}}',
        count: 10
    }, function () {
        setInterval(function() {
            var item = $('.tweet ul').find('li:first');

            item.animate( {marginLeft: '-220px', 'opacity': '0'}, 500, function() {
                $(this).detach().appendTo('.tweet ul').removeAttr('style');
            });
        }, 5000);
    });

This just pulls through my twitter feed with no reference to the hashtag. What am i doing wrong?

jenbuzz commented 9 years ago

Your snippet is correct. The Twitter Search API just doesn't seem to go as far back in time as the last tweet containing "#networktoolkit". I tested it by writing a new tweet with "#networktoolkit" as a hashtag and it showed up in the feed - and yes, I used the same snippet as you above. Try using another tag or writing new tweets containing the hashtag and you will see, that it works fine.

brandudno commented 9 years ago

Thanks for getting back to me so promptly!

I've had a quick look and I'm still not sure it's working 100%.

Does this work for anyone who tweets that hashtag? I only want tweets from anybody who contain that hashtag

jenbuzz commented 9 years ago

As I wrote: "I tested it by writing a new tweet with "#networktoolkit" as a hashtag and it showed up in the feed". Try that yourself.

brandudno commented 9 years ago

Thanks, just tried this again and it just seems to be pulling through all tweets regardless of hashtag.

jenbuzz commented 9 years ago

Problem is somewhere else then. I'm having no problems with it. Can I see it somewhere?

brandudno commented 9 years ago

Yep, thanks for helping with this -

http://digitronixcloud.co.uk/dev/cihm-toolkit/

Scroll down just a little and you should see the feed.

At the moment, I'm just trying to pull through a trending hashtag so it's current.

   $('.tweet').twittie({
        hashtag: 'PremiosGoya',
        template: '<div class="single-tweet"><p>{{tweet}}</p><br /> <span class="username">{{screen_name}}</span></div>',
        count: 10
    }, function () {
        setInterval(function() {
            var item = $('.tweet ul').find('li:first');

            item.animate( {marginLeft: '-780px', 'opacity': '0'}, 500, function() {
                $(this).detach().appendTo('.tweet ul').removeAttr('style');
            });
        }, 5000);
    });
jenbuzz commented 9 years ago

I copied your script and it works.

Maybe you have a caching problem? It seems you are requesting all tweets with: http://digitronixcloud.co.uk/dev/cihm-toolkit/wp-content/themes/nhs-network-tool/assets/api/tweet.php?username=&list=&count=10&exclude_replies=false But your code doesn't match this request. Clear caches and try again.

brandudno commented 9 years ago

No luck /:

Could the server be caching?

I noticed if I add &hashtag to that url it pulls through all tweets

http://digitronixcloud.co.uk/dev/cihm-toolkit/wp-content/themes/nhs-network-tool/assets/api/tweet.php?username=&list=&count=5&exclude_replies=false&hashtag=PremiosGoya

jenbuzz commented 9 years ago

Yes, it could. You could also try fixing all the js errors on the page. Anyways the problem is not Tweetie.

brandudno commented 9 years ago

Thanks, could I have a look at your example and see if I am missing something? Thanks!

jenbuzz commented 9 years ago

The same code. Just try it out locally or somewhere else instead.