Translating...

Cancel

Jason Mayes
3 years agoEditedPublic
How to get your tweets displaying on your website using JavaScript, without using new Twitter 1.1 API Check out code here: http://jasonmayes.com/projects/twitterApi/  - tested in IE 7, 8, 9 and 10, Firefox, Chrome, Safari and Opera :-)

Today I was quite frustrated to find out that the old API on #Twitter was depreciated and the overhead in setting up a system to perform #OAUTH just to get my already publicly available tweets was too damn high (see https://dev.twitter.com/discussions/11564 ). Even worse I couldn't find any simple solutions for #JavaScript . All code examples were server side. So after much thinking I invented the following workaround solution. It makes use of the over bloated widgets Twitter gives us to put on our sites, cuts out all the nonsense, and returns to you your raw tweet text so you can do with it as you please on your website. Instructions on how to get it working with your tweets are in the code comments, just do what it says!  Check out my JS fiddle here: http://jasonmayes.com/projects/twitterApi/  Enjoy!

UPDATE: Due to popular demand, you can now specify how many tweets you want returned which can be any number between 1 and 20, as the third parameter to the function call :-) Let me know if you have any other requests.

UPDATE 2: Due to even more requests, my solution now gets recent tweets for user, favourite tweets, list tweets, or hashtag search!

UPDATE 3: My script now handles writing HTML to an element with an ID of your choice making it even simpler to use and allows you to queue up many requests so you can have many items on the same page doing different things eg one shows recent posts with a specific hashtag, whilst the other shows your latest 5 tweets. 

UPDATE 4: Script now supports grabbing who posted the tweet, their profile photo, and link to profile. Also adds the time they posted at the end. All customizable with CSS to look how you want.

UPDATE 5: You can now specify a custom date formatting function to format the twitter post date however you wish! See comments for how to use.

Now on GitHubhttps://github.com/jasonmayes/Twitter-Post-Fetcher

For further updates please see the project website: http://jasonmayes.com/projects/twitterApi/  all new updates etc will be pushed live here in the future. Questions? Ask below.

#Solution #API #TwitterAPI  
38
+100 THX!!+2
Sam Downie3 years ago
good work Jason you #google genius !+3
Ryan Gledhill3 years ago
Hero!+1
Rodrigo Gonzales3 years ago
absolutely great ...+1
Adam R Murray3 years ago
This is a great contribution, nice work!+1
Francesco Merlo3 years ago
Thanks a lot!!!+1
Zafer Zent3 years ago
good work thanks Jason.+1
Zafer Zent3 years ago
Jason, How do I adjust the number of tweets ?
Jason Mayes3 years ago
I have been asked this by a number of people, I am editing it now so it supports this. Give me a few mins. :-)+1
Jason Mayes3 years ago
+Zafer Zent Please go to my JS fiddle and refresh and read the comments. see there is now a 3rd parameter which allows you to specify any number between 1 and 20.+1
Zafer Zent3 years ago
successful thanks +Jason Mayes :)+1
Edwin Martin3 years ago
Nice. One minor thing: there is no difference between a tweet and a retweet from someone else.+1
Jason Mayes3 years ago
Nice mod +Edwin Martin 
Jason Mayes3 years ago
Due to requests, solution now gets recent tweets for user, favourite tweets, list tweets, or hashtag search!+1
Jason Mayes3 years ago
UPDATE3: My script now handles writing HTML to an element with an ID of your choice making it even simpler to use and allows you to queue up many requests so you can have many items on the same page doing different things eg one shows recent posts with a specific hashtag, whilst the other shows your latest 5 tweets. +1
Zafer Zent3 years ago
The only thing missing time to tweet :) example : 1 min ago+1
Jason Mayes3 years ago
+Zafer Zent will look in to this, along with name of person. Have had a few requests for this. Shall see if possible. Stay tuned.
Jason Mayes3 years ago
UPDATE 4: Script now supports grabbing who posted the tweet, their profile photo, and link to profile. Also adds the time they posted at the end. All customizable with CSS to look how you want.+2
Ines Opifanti3 years ago
Super awesome, thanks man!+1
Blake Ferm3 years ago
Thank you!+1
Jeremiah Lewis3 years ago
It seems awesome, but I can't get it to work on my page. I get the following error: Uncaught ReferenceError: twitterFetcher is not defined 

Which doesn't make sense. I've tested with the ID I've generated on your jsfiddle and it works fine. I also copied your code verbatim onto my site and it returns the same error above. What am I missing?

EDIT: I figured it out. It has to be placed outside the document.ready
+1
Jason Mayes3 years ago
+Jeremiah Lewis Yes it must be in the global scope as it makes use of JSONP+1
Šime Vidas3 years ago
Wait, you're updating the jsFiddle? How are we supposed to know which revision represents the latest code? You provide a link to the original fiddle, but not to any of your subsequent revisions. Anyways, consider putting the code gist.github.com.
Nathan Mazars3 years ago
Thanks a lot! I've one question, how do you do to change user's color and i would like delete the certificate logo ? Thanks
Jason Mayes3 years ago
+Šime Vidas the latest version is always available at the link above. As I make the latest code the base version! 
Jason Mayes3 years ago
+Nathan Mazars I dont quite understand? The colour of the text can be changed using CSS. I am not sure what you mean by certificate logo...
joris heijne3 years ago
Since the update of twitter it has become much harder to get the tweets that you want. I was searching to get a good example of how it now works with api 1.1. But with this script it's become so much easier. I want to thank you for this. Best Code Since.+1
Jason Mayes3 years ago
Thank you so much +joris heijne please spread the word so people find the link :-)+1
Pontus Dreij3 years ago
Trying to fix time / date of each tweet into Swedish. Tried to change "lang" (before the callback) to sv and se. Also added sv in html lang. But no luck. Any thought of how I can solve this? And thanks for a awesome code!+1
Jason Mayes3 years ago
Good question +Pontus Dreij maybe I can expose the raw date to you as an attribute and you can customize the format to suit your needs and overwrite content? Would that help you?
Jason Mayes3 years ago
PS what should it look like in Swedish?
Pontus Dreij3 years ago
+Jason Mayes if its possible I would like hh:mm dd/mm+1
Jason Mayes3 years ago
+Pontus Dreij I shall look in to this when I get home tonight.
Šime Vidas3 years ago
+Jason Mayes hm, from my experience with jsfiddle, whenever i edit the code and click the Update button, the revision number increments and this is reflected in the Url. I'll look into this when I get in front of a computer
Jason Mayes3 years ago
+Šime Vidas I am not using JS fiddle like this as I am forcing latest to become the default.+1
Gavin Taylor3 years ago
any chance you could swap the prefix on the twitter url to // in your next revision? http:// causes insecure content errors on https sites and I keep forgetting to remove it. Plus it will save you a few more chars too :)

eg. b.src="//cdn.syndication.twimg.com/widgets/timelines/"
Jason Mayes3 years ago
Good spot +Gavin Taylor will do! This was actually on my todo list :-)
Jason Mayes3 years ago
+Gavin Taylor Done :-)
Gavin Taylor3 years ago
ta :)+1
Šime Vidas3 years ago
+Jason Mayes Ah you're doing "Set as base". Didn't know about that. Sorry for the confusion :-)
David Beaumont3 years ago
Not sure why the original comment got removed.. but i modified it a bit last Friday. Whilst the CSS is a bit more complex, the JS is a lot simpler and should continue working if Twitter alter the widget totally http://jsfiddle.net/DJB31st/uuWEh/3/+1
Jason Mayes3 years ago
+David Beaumont This certainly is lighter on the JS and more robust if twitter changes everything, but has a few potential things to consider - which is why I didnt just take the twitter html directly as you have done in the example:

1) You can not specify not to render certain parts eg time posted, user name / photo - a request I got from many people. You could use CSS to hide, but this is a little messy, if it isnt wanted/needed, it shouldnt be in the DOM.

2) Check the markup it produces on your beautiful semantic standards compliant website. It made me cry. They use the <b> tag to make text bold and that is just for starters.

Start editing for the above two points, and a few other tweaks requested, and you end up with my code above :-) If you do not need / care about the above two points, then this is fine of course. :-) Personally I refuse to have <b> tags on my site - mixing style as part of markup makes me not sleep at night. CSS FTW!
+2
David Beaumont3 years ago
Fair points about the <b> tags! TBH i am very much back end and didn't really take the time to consider everything in as much detail as your solution. I've just been shouted at by the frontend guy who took my solution when there was nothing bold in the tweet! The whole needing to auth for each request is just such a headache its a shame we have to even look at these solutions really!+1
Sherin Rafeer3 years ago
hi, i am trying to creat a mobile app using jquery mobile to display a person's home twitter feed. will you be able to direct me where to look into for it? since this doesnt work anymore :"http://search.twitter.com/search.json?callback=?&rpp=";
Jason Mayes3 years ago
Link to my code is in my post - click expand and then click the link +Sherin Rafeer  then read the comments for how to use.
Thomas Greve3 years ago
Thank you for your good work. ;-)+1
Jason Mayes3 years ago
UPDATE 5: You can now specify a custom date formatting function to format the twitter post date however you wish! See comments for how to use. +Pontus Dreij  :-)+2
Matt Thomas3 years ago
Any chance that this could be made to scroll the tweets, like a sports ticker?
Jason Mayes3 years ago
+Matt Thomas That can be done using CSS. I have left "style" to the user so it can be customised to any site. You just need to make CSS styles for it.+1
Blake Ferm3 years ago
Hi Jason. How can I open an "_blank" window from a click on my Twitter handle? the bit.ly works perfect opening a new tab/window. Since the 4th param of the twitterFetcher.fetch() method takes into account both hyperlinks with one boolean, I'm kind of stuck here.

Thanks in advance!
Jason Mayes3 years ago
Update: I am creating an official project page for this. http://jasonmayes.com/projects/twitterApi/ Updates will be posted to this page to have it all in once central place to reference. Feel free to post on G+ for bugs/feature requests etc. Yes I will make it look prettier when I have a moment.+3
Ken Blakey3 years ago
Thanks for this, hopefully twitter doesn't see this as an exploit and close it off.+1
Jason Mayes3 years ago
Most welcome +Ken Blakey :-) Please spread the word!
Lia Insidelia3 years ago
Any idea how to use it on Blogger? Thanks.
Jason Mayes3 years ago
+Lia Insidelia Briefly, you will want to navigate to the Layout tab and click the "Add a Page Element" option and select the "HTML/Javascript" sub-option. One example:
http://www.google.com/support/blogger/bin/answer.py?hl=en&answer=43708
+1
Jason Mayes3 years ago
I am fixing the ie issue tonight when I get home. I am not using jquery as I want this to be as lightweight as possible and have no dependencies +Mathew overton
Blake Ferm3 years ago
Hi Jason,

When I refresh my page the feed disappears. Any ideas?

Link to the example:
http://int.pushpointmobile.com/blake/marketing_site_040113/index.html

Thanks!
Lia Insidelia3 years ago
Okay, thanks. :-)+1
Jason Mayes3 years ago
+Blake Ferm works fine for me...
Blake Ferm3 years ago
Thanks for looking in to it, Jason! Much appreciated.+1
Lia Insidelia3 years ago
Is there a way I can make a link out of date posted? It only shows with picture and I removed it, it takes too much space for me.
Jason Mayes3 years ago
+Matthew Overton It now works in IE 7 and 8. Please refresh the site or the JS Fiddle to get latest code.
Jason Mayes3 years ago
+Lia Insidelia I am not sure I quite understand? You want to only display the dates?
Jason Mayes3 years ago
+Matthew Overton Fixed. See v7
Jason Mayes3 years ago
+Blake Ferm You need to ensure the javascript you write is executed AFTER the DOM has been constructed. You need to wait for document.ready event and then use my function. Otherwise it wont be able to find the HTML element you are trying to inject content to as it doesnt exist yet! This should fix your issue. One way to do this is simply move my js function call to bottom of page right before the closing </body> tag and import it there.
Blake Ferm3 years ago
+Jason Mayes You are a Jedi. Thank you.+1
Jonathan Le3 years ago
Thank you soooo much for this! Awesome work! Btw is there a way to distinguish between Tweets and Retweets?
Jason Mayes3 years ago
Not yet. I'm working on it. Doing this is my free time (which there is not much of!) So stay tuned on the official project website as it will be there when it is available. +Jonathan Le +1
Lia Insidelia3 years ago
I have last tweet showing with a date "Posted x hours ago". I would like that date to be a hyperlink to my Twitter account - like it used to be in an older version. In your version the only available link shows up with an image (avatar) I don't want.
Jason Mayes3 years ago
+Trevor Wilcox you would have to overwrite link behavior using JavaScript eg prevent default and then do your own thing.+1
Jason Mayes3 years ago
+Lia Insidelia yes you can do this - see the advanced example which allows you to customize date output. You could set this to return link instead of date+1
Richard Shea3 years ago
Great work mate, hopefully you can add an option to exclude re-tweets (exclude_rts=false) as it works on the official widget, that would be perfect.+1
Jason Mayes3 years ago
Working on it +Richard Shea +1
Jason Mayes3 years ago
Oh I see. I shall have to check tonight :-) thanks for clarifying.
Lia Insidelia3 years ago
But I want date to be showed, I would like it to be also a hyperlink. And I'm not that advanced in PHP or JS. :-( Well, thanks for replying.
Jason Mayes3 years ago
+Lia Insidelia Your code would be something like this. Change "your_id_here" to your widget id, and then change the url at the bottom to your site

twitterFetcher.fetch('YOUR_ID_HERE', 'tweets', 5, true, true, true, dateFormatter);

// For advanced example which allows you to customize how tweet time is
// formatted you simply define a function which takes a JavaScript date as a
// parameter and returns a string!
// See http://www.w3schools.com/jsref/jsref_obj_date.asp for properties
// of a Date object.
function dateFormatter(date) {
return '<a href="http://www.yourwebsite.com/">' + date.toTimeString() + '</a>';
}
Lia Insidelia3 years ago
Ohhh, thank you!!! :-)+1
Richard Lockwood3 years ago
HI Jason - really good job, but you might like to note it doesn't work in IE7 or IE8 (I know, I know!) due to those browsers not understanding getElementsByClassName.  It can be made to work in IE8 by substituting querySelectorAll(".e-entry-title") for getElementsByClassName("e-entry-title") - and the other two instances - but that seems to break the "number of tweets" parameter.  (IE7 doesn't support querySelectorAll either).

Thought you might like the feedback!

Cheers,

R.
Jason Mayes3 years ago
+Richard Lockwood It does support all of these browsers - I am guessing you are not using the latest version of my code (v7 at time of writing this) see http://www.jasonmayes.com/projects/twitterApi/ I patched this yesterday. Also querySelectorAll is not supported by IE7. My new code supports 7+. Thanks for the feedback though :-)+2
Richard Lockwood3 years ago
Ah - you're right.  I only downloaded it yesterday, but I've got v.6.0 - let me grab the new version.  Thanks!+1
Richard Lockwood3 years ago
You sir, are a star.  :-)+1
Yong Hee Lee3 years ago
thank you!!!! it's really great!!!+1
James Leonard3 years ago
Brilliant - thank you Jason - I was starting to pull my hair out!
I am looking to recreate a rotating feed that scrolled through my x most recent tweets. Any chance you will be adding something like that into this?Alternatively how would I specify say the 3rd most recent tweet and display it by itself?
Thanks again!
+1
Jason Mayes3 years ago
+James Leonard This is probably not something I will add to this component as it a style thing mainly. I want this to be as flexible as possible so left style / behaviour to the user meaning it can be anything you want it to be. It would be quite simple to do with say some CSS and JavaScript you just need to hide the nth tweet and then cycle through. If you use CSS transitions it would look real sweet. :-) if there is enough demand for it i can make an example that does this 
Daniel Lieske3 years ago
I'm quite a noob when it comes to coding. I've got this question: The tweet data seems to be rendered into a list item so that a bulletin point shows up before the tweet when I create a DIV element called "tweet". I was able to get rid of the bulletin point via the global list element style. But how do I get rid of the indenting? Is is possible for me to change the script so that the tweet data gets not rendered into a list element? I only want to display one tweet at a time and don't need list functionality anyway... 
Jason Mayes3 years ago
+Daniel Lieske No problems! Indeed for semantic reasons I used a list as it is a list of tweets. All you need to do in CSS is set the padding and margin to something different. eg

#tweet ul, #tweet ul li {
  margin:0;
  padding:0;
  list-style:none;
}

My component will always render in to a list for semantic reasons described above, but with simple styling you can make it look however you want.
+1
Daniel Lieske3 years ago
Ok, I found the <li> Tags in the Script and deleted them. However, the indenting did not disappear (the bulletin does though...). Maybe the indenting is caused somewhere in my website code that wrapped around the div. Anyway, if you've got an idae about this issue please let me know. Great script by the way! Was happy to donate to someone who saved my a lot of headache with all the Oauth crap!
Daniel Lieske3 years ago
Oh, didn't see your reply. Thanks a ton!+1
Jason Mayes3 years ago
+Daniel Lieske No problems and thank you for contributing to its development :-) It is most appreciated.
Jason Mayes3 years ago
+Daniel Lieske Can you link me to your page?
Daniel Lieske3 years ago
Just have to upload my temporary index file. One second! (BTW, your realtime support kicks ass!)+1
Daniel Lieske3 years ago
Ok, here's the link:

http://wormworldsaga.com/index_temp.php

Pasted the style snippet into the global css file. Bulletin is gone through that but indenting not.
+1
Jason Mayes3 years ago
You applied my styles to your li but not the ul. Please see my code snippet above. You need to apply new margin/padding to UL element too +Daniel Lieske  it then looks as expected
Daniel Lieske3 years ago
You are referring to the code I added to the global li element at the top of the Stylesheet document, don't you? If you scroll down in the css file you'll find your original code snippet there, too. Sorry, I'm a total loser when it comes to CSS. Maybe I'm making a silly mistake here. 
Jason Mayes3 years ago
Oh found the problem. Your div is called #tweets not #tweet change my code snippet to say #tweets +Daniel Lieske 
Daniel Lieske3 years ago
Haha, that's it! Works like a charm. Thanks SO much! Another donation inbound! :)+1
Jason Mayes3 years ago
+Daniel Lieske Thank you so much! :-)
Jason Mayes3 years ago
+Daniel Lieske Just looked at your site - you should comment out the following lines as you dont use them - they will just make errors as just example code:

twitterFetcher.fetch('347099293930377217', 'talk', 5, true, true, false);

twitterFetcher.fetch('345690956013633536', 'tweets2', 5, true, false, true, dateFormatter);

Notice how they are looking for ids of talk and tweets2 - which wont exist on your site!  You just need the first one which you edited correctly. :-)
Jason Mayes3 years ago
PS your artwork for the site is mindblowingly awesome +Daniel Lieske :-)
James Leonard3 years ago
Got it - Ill give it a go - thanks again for putting this out into the wild ! :-)+1
Works perfectly, thanks! It's good to have full css support back.
We should make a script file name contest, I've given much thought to mine and it turned out to be twitterdecrapinator.js
+1
Jason Mayes3 years ago
Update 8:  v8 is now available with support for not returning retweets! Also improved efficiency of code a bit too :-)+1
Jason Mayes3 years ago
V9 of my #JavaScript #Twitter #API solution  is now available! Get it whilst its hot (supports custom functions!) http://jasonmayes.com/projects/twitterApi/+1
Mike McLoughlin3 years ago
+Jason Mayes This has seriously saved me oodles of time - many thanks for that. The only thing I can see that is needed is a cache facility - so the twitter query quota is not busted. This is especially an issue when used on landing pages of large Colleges like mine.+1
Jason Mayes3 years ago
+Mike McLoughlin Thanks for the feedback! Feel free to cache the result if you wish - latest version allows you to specify a function to call when data is ready, so you can take that and cache it using your backend if you wish and only invoke the JS after a certain time period.+1
Jason Mayes3 years ago
Update: 3D CSS Twitter Cube Using JavaScript API demo
An extension to my original post (http://www.jasonmayes.com/projects/twitterApi) to show how flexible the component is. You can make it look however you want just using CSS. Same component, different style. Here we render tweets in a 3d Cube. The only limit is your imagination. See it in action here: http://codepen.io/jasonmayes/pen/rDyqj
Working like a charm!
Ouch! Talked too early, IE8 is giving me a unknown error at this point:
f.innerHTML=d+"</ul>"

Line 17 Character 202

Happened when retrieving only 1 tweet and trying to write the result into a div called tweet. This is my call:
twitterFetcher.fetch(widgetID, 'tweet', 1, true, false, false,'',false);

Any idea?

PD: It's a joomla 3 site. Using V9.
Jason Mayes3 years ago
+Ángel Manuel Marqués Ruiz Will look in to this tonight. Can you link me to your test page where this is occurring so I can see.
Pasquale Errico3 years ago
I have used your solution and it works perfectly!
But how can i do for limit the number of letters of the tweet?
Thanks a lot!
Jason Mayes3 years ago
You would have to use the advanced example number 2 and in your custom function, trim the tweet HTML yourself +Pasquale Errico
Jason Mayes3 years ago
+Ángel Manuel Marqués Ruiz I can not replicate your issue, I think it is something to do with your code, not mine.+1
Karen Castillo3 years ago
thanks Jason! Will try on one of our sites!+1
Jason Mayes3 years ago
+Karen Castillo no problems! Good luck!
+Jason Mayes yeah, I'm sure the problem is with my code. I'm just trying to figure out what's the problem, apparently if I disable urls and hashes it works. I wonder if mootools may be the problem. Gonna try disabling some things.

Anyway your code is awesome. Thanks! :)
+1
Pasquale Errico3 years ago
+Jason Mayes i have tried to use a function but the string passed by javascript contain all the html necessary to visualize the tweets correctly...
if i use substr with a character limit, it also cuts any html content in the string and not good ...
You can not see the posts as seen on twitter?
thank you very much
Jason Mayes3 years ago
Yes you will need to deal with HTML boundaries so not to create mal formed HTML. I might do this myself at some point but will take time to write +Pasquale Errico
Pasquale Errico3 years ago
+Jason Mayes Unfortunately, at this time I do not have too much time to devote to this problem :(
Jason Mayes3 years ago
Same here I am doing this outside of my day job.
Bill Phelps3 years ago
Many, many thanks Jason. Beer money on its way... 

Any chance of a parameter corresponding to "data-screen-name" ? That would save having to create a widget ID for each of my clients.

(And if you're really bored, it would good to be able to pass some of those other parameters across, too - but I'm probably pushing my luck there!)

But you've earned hero status already, without any of that...
+1
Jason Mayes3 years ago
+Bill Phelps Thanks so much :-) I am not sure I quite follow with regards the data-screen-name request? Can you elaborate. Twitter widgets only allow you to set up a widget per hashtag or user_name so it has to be done twitter side. Not via component for that setup part.
Bill Phelps3 years ago
At  https://dev.twitter.com/docs/embedded-timelines it says "you may override specific options on the client side by customising the embed code" - and it then goes on to document all the override parameters.

So, once I've set up a widget ID on my own Twitter account, I can use that to embed timelines for any username. This works a treat using their embed codes.

I was just wondering if your code could do the same trick if we were able to feed it the same parameters? Or have I failed to grasp something here? (It has been known to happen!)
Jason Mayes3 years ago
+Bill Phelps You can use any of the widgets they provide with my component. The problem with the twitter widgets is that you can not theme them as they are in an iframe. With my component I strip all the style and leave style to the user so you only have to worry about the CSS. the JS and HTML are taken care of for you automatically.
Bill Phelps3 years ago
+Jason Mayes
 And it's that styling flexibility that I appreciate.

I'll resign myself to having to create a widget ID for each client. Simplest solution is to get them to do it for me, following your instructions.

Thanks
+1
Julian Carstairs3 years ago
Great work man, am going to give it a go. Wish you all the best in the future. Cheers :D+1
Daniel Whitmarsh3 years ago
looks awesome - will give it a try later. cheers+1
Adnan Huda2 years ago
Hi there, just wondering how would I be able to display only the latest  tweet. I tried refreshing the website but it showing previous tweets , along with current tweet even when I limited the script to show 1
Jason Mayes2 years ago
Have you got a copy of my latest script? version 9? This definately works see http://www.jasonmayes.com/projects/twitterApi/
Adnan Huda2 years ago
Definitely using your latest script. This is happening when I set the page to automatic refresh. 
Jason Mayes2 years ago
I can not replicate your problem, I can only assume it is something incorrectly typed as I have not had anyone else report this issue either. Can you link me to your page with the script on?
Adnan Huda2 years ago
I haven't uploaded this page yet but this is on local machine. 
Adnan Huda2 years ago
If you can try set your page to automatic refresh in html. This work when manual reloading. 
Adnan Huda2 years ago
Thank you for your script. Awesome engineering. +1
Marc Remblance2 years ago
Awesome work Jason. Will be making a donation. Quick question - Is is possible to format/remove the text 'Posted' from the tweet output? So the date for example, is just shown as eg; 4 days ago?

Many thanks buddy
+1
Jason Mayes2 years ago
+Marc Remblance Yes see my advanced example using a custom date function - you can have it formatted in any way you want if you write your own function. It will pass you a JavaScript date, and you can just output it in your own format.
 Thanks for donation in advance :-) Appreciated!
Marc Remblance2 years ago
Ok, that's great. Many thanks.+1
Hi Jason, really nice script! New twitter api 1.1 is anoying with JS auth problems. Just 1 question: Is possible get how many followers have this account?

Thanks for sharing that pluggin :)
+1
Jason Mayes2 years ago
+Marc Masoliver Vial Not via the data exposed by the widget, so no. You would have to use a proxy server to grab the raw HTML from your public profile and parse the data returned to extract your follower count if you didnt want to use OAUTH.
Thanks for the info. You are so fast!+1
Thank you! 
Evgeny Sinitsyn2 years ago
Thank you for this great script.
Are there sources (not minified) available?
+Evgeny Sinitsyn i think you can run jstidy or a beautifier over the minified code to unwrap it. 
Jason Mayes2 years ago
I shall be putting non minified version up shortly.
Oksana S2 years ago
Hi Jason! I downloaded twitterFetcher_v9, unpack it and opened example.html in browser but no tweets showed up, just headers Query 1... Query 2... Any ideas?
Jason Mayes2 years ago
+Oksana Synytska Yes you can not run JavaScript on local computer via file:// as URL as your web browser security settings won't allow it. Put it on a webserver so you acccess the index.html via http:// and it will work eg localhost or your actual website
Evgeny Sinitsyn2 years ago
+Jason Mayes thank you. Keep us posted.
Mark Mailer2 years ago
Hi Jason, any chance of being able to include the tweet id (class="data-tweet-id") in the tweet output - hidden div or some such would be perfect! Great work BTW+1
Oksana S2 years ago
Thank you Jason!+1
Tineke Timmerman2 years ago
Thanks for this great solution Jason. The new API broke a lot of my clients websites.
I was wondering in what way I could find the data-widget-id of twitter accounts other then my own? I am not looking forward to contact all my clients to ask them to create that widget in order to get the ID...
+1
Jason Mayes2 years ago
You would have to create a new widget and tell it to point to a different username for each user you wanted (under twitter widget settings when you create) +Tineke Timmerman
Tineke Timmerman2 years ago
Thanks for this great solution Jason. The new API broke a lot of my clients websites.
I was wondering in what way I could find the data-widget-id of twitter accounts other then my own? I am not looking forward to contact all my clients to ask them to create that widget in order to get the ID...
+1
Tineke Timmerman2 years ago
woops, sorry, I refreshed and posted again. I just figured that by replying to a tweet of the specific account, the ID is in the URL
Tineke Timmerman2 years ago
Jason, you are right, the reply url didn't work, i just used your solution and it totally works now. Thanks so much!+1
Jason Mayes2 years ago
+Tineke Timmerman you are most welcome! :-)
Tineke Timmerman2 years ago
Yet another question you might be able to help me out with.
It works perfectly by I am trying to connect it to a jQuery newsticker.
The ticker works when I just put plain code it (<ul id="twitter"><li>test</li><li>test2</li></ul>) but not on the twitter feed.
I had it working before with my old solution of pulling twitter in (rss), but somehow it doesn't want to work with your code. Possibly has to do with running order?
http://harmoneymusic.com/
Phil Dews2 years ago
Hi Jason am loving this script many thanks it's working like a dream on my site!
just a quick question though i want to display my last 5 tweets at timed intervals that fadein and fadeout currently I am displaying just the 1 tweet as shown with this script...
function handleTweets(tweets){
    var x = tweets.length;
    var n = 0;
    var element = document.getElementById('twitterwidget');
    var html = '<ul>';
    while(n < x) {
      html += '<li>' + tweets[n] + '</li>';
      n++;
    }
    html += '</ul>';
    element.innerHTML = html;
}
not got a clue on how to change it up though! any help would be greatly appreciated
All my Best
+1
Jason Mayes2 years ago
You can grab the last 5 tweets and output them as above and then use css to make the UL only big enough to show 1 of them (set width and height of li and the ul and then set ul to be overflow:hidden). You can then use css animation to move the li around so they animate in. Alternatively you can do this in JavaScript too if you wish. Just Google a tutorial on CSS animation or JavaScript animation (eg using requestAnimationFrame is your best option so it stays smooth).+1
Phil Dews2 years ago
+Jason Mayes Awesome cheers for that have played about with my CSS but trying to get my head round with the CSS animation have a look if you like its gekkodev.com
Jason Mayes2 years ago
I highly recommend going through a CSS animation tutorial as it will explain it far better with videos and images than I can put in a comment here. If you are more comfortable with js then maybe use this :-)+1
Phil Dews2 years ago
+Jason Mayes Cheers have asked the question on stackoverflow and adding it to jsfiddle will get an answer soon! if you like I will add the JSFiddle here once i get an answer so others can use it!+1
Phil Dews2 years ago
+Jason Mayes I got it working! here is the fiddle for people wanting this.. http://jsfiddle.net/RThdu/3/ also to see it in action here is what it looks like on my site.. https://www.gekkodev.com/
Please excuse the Blatant #Spamming  
+1
Jason Mayes2 years ago
Glad to see you got it working :-)+1
Phil Dews2 years ago
Cheers it's working like a beauty! thanks again +Jason Mayes +1
wayne hooper2 years ago
Cracking script thanks! One question though...
When I exclude the image from the feed, all the other links render as plain text rather than a link (for example the tumblr links in the tweet)
http://www.inkdrawn.com
Thanks
Kenneth Guild2 years ago
Just have to say thanks! I'm developing for sharepoint 2013 and was having no end of bother getting round the api update .. works like a charm :)+1
Hello Jason! Thanks for the API. I'm using it and  want to learn that I can get topic header of user ( favourite tweets, list tweets, or hashtag search ) of tweets I shown as a data. is it possible ? is there any way ?
Thanks.
Jason Mayes2 years ago
Not that I am aware of if I understand you correctly +mustafa kaan demirkol
wayne hooper2 years ago
Hi Jason. Did you have any suggestions for my issue a few comments up? Thanks again.
Jason Mayes2 years ago
+wayne hooper This is because in your code you have set:
twitterFetcher.fetch('357839500694654977', 'twitter_update_list', 3, false, false, true);

but you actually want:

twitterFetcher.fetch('357839500694654977', 'twitter_update_list', 3, true, false, true);

Sorry your message got lost in the replies!
wayne hooper2 years ago
+Jason Mayes Thanks for the reply Jason. I thought I'd tried that combination of trues and falses, but hadn't as now all working fine. Thanks again for the help.+1
Sorry about I couldn’t have explained clearly. I asked to fetch the USERNAME which I created widget of user timeline for fetching and publishing on my web site. For example; I want to use “@badboys” as username and to print out user timeline of this user on my website. I had created my twitter widget on my twitter account and I had a Widget ID to use in the twitterAPI. Everything ok. The API run and I can fetch twitter timeline. But also I want to use “@badboys” as a title on top of my web page and it must be fetched automaticly by a programme. Is it possible to be able to do this? Is there any chance for I can this. I would be so glad if you help me. Thanks again.
Jason Mayes2 years ago
You can only get names from the tweets in the timeline as far as I know.
Thank you for the reply.+1
Jason Mayes2 years ago
UPDATE: Version 10 is now available - supports retweeting / favs / replying to tweets. http://www.jasonmayes.com/projects/twitterApi/+1
wow! this is great, many thanks.+1
Rebecca Giddings2 years ago
Forgive me if I'm missing something obvious, but I just can't get this to work for me.  Even your example documents won't display the twitter feed for me.  No error or anything - just blank space.  I'm working on Windows 8 and have tried it on multiple browsers.  (I'm a self-taught coding newbie, so be gentle!)  Thanks!  If I can get it to work, I think it's exactly what we need for our site.
Jason Mayes2 years ago
+Rebecca Giddings Can you link me to your website with the code on so I can check what you are doing wrong?
Marc Remblance2 years ago
?? Seems to have stopped working? Even on your site??
Rebecca Giddings2 years ago
Thanks for getting back to me!  I actually found a way to make the Twitter widget work for what I need.  Thanks again!+1
Jason Mayes2 years ago
+Marc Remblance Appears it is a bigger issue see https://twitter.com/search?q=widget%20broken&mode=relevance&src=typd  No ones widgets are working - even the twitter ones. It appears twitter is down. Once it goes up again it should work again as normal.
Jason Mayes2 years ago
+Marc Remblance its all fine again now. Twitter fixed their issue.
Marc Remblance2 years ago
Cheers buddy. And, again thanks for the great work!!+1
Jason Mayes2 years ago
+Marc Remblance No problems!
Jason Mayes2 years ago
+Flavia DSouza My guess is that you are not running it on a webserver. If you run the file from your hard drive eg the browser url is file:// most browsers block javascript execution.
Bhakti Patel2 years ago
I want to get 3 latest stories of the site. I have URL of the site. But How can I get the ID mainly first parameter in the script?

Thanks in advance
Jason Mayes2 years ago
+Bhakti Patel This is for bringing in your Twitter tweets, not your website blog entries.
Bhakti Patel2 years ago
If I want to get tweets then how can I get the ID?

Thanks for quick response.
Jason Mayes2 years ago
+Bhakti Patel The instructions are in the comments of the code - you just have to go to your twitter account on twitter.com, go to settings, and then widgets, create a new widget and look at the id of the widget (which you can see in the URL when you open it to configure).
Bhakti Patel2 years ago
Thank you so much. +1
Hi Jason, i'm using your twitter api fetcher but i have a huge problem, I'm from Argentina and i need some texts in spanish :( there is a way to use a templating to change all the html without touch your js? thanks!
Jason Mayes2 years ago
+Dientuki - Juan Farias You would have to use one of the examples which allows you to define a custom function to output the raw data in whatever format you wish.
Jason, i've saw the example and don't work for me :( because the raw data is html and i can't change that.
Jason Mayes2 years ago
Yes, you can. You will have to strip it yourself eg by getting the text rather than the HTML. An exercise for yourself. Eg if you are using something like jQuery you can simply do .text() to grab just the text and it strips the html out.
Adam Turtle2 years ago
Is there an unminified version available? I'd like to make a few adjustments to it, but it's difficult to navigate all the minified function names. Would also be great to share this on Github to get other people involved. Great work so far!
Hi!, I have this error.  TypeError: f is null, help pleace
Jason Mayes2 years ago
+Ezequiel Eñiguez Something you have coded is wrong. My example works fine. I suggest checking your code you edited / added as I have no idea what you did without looking at it.+1
Forget already solved thank you very much+1
wayne hooper2 years ago
Hi Jason. Back again :) 
Is there a way to just have the twitter image and tweet (with hyperlinks), nothing else (@name, twitter name, favourite, reply, retweet etc.)?
Thanks
Wayne
Jason Mayes2 years ago
I think the minimal in my solution allows image, name and tweet. you would have to use some simple css to hide the name or use a custom function as shown in the advanced examples to print out exactly as you wish.+1
wayne hooper2 years ago
Of course. I forgot about hiding with css. changing the element to width:0% and display:none have achieved what I'm after.
Adam Austin2 years ago
Hey Jason. Awesome job and everything. The code you put up on codepen works for me, I messed around with it on codepen. Though, the example file I downloaded with the library doesn't work. It just hangs for a moment and then nothing happens. It's a little bit frustrating, but I'm assuming it's me being stupid. I just can't get it to work on my end.
Jason Mayes2 years ago
+Adam Austin Probably because you are running the file in your browser using the file:// protocol. It must be accessed over http:// - make sure its on a web server eg install apache locally and go to http://localhost/file.html and it will work
Dylan Cuffy2 years ago
I'm slightly considering using this tool on my Referata wiki, The Dixwell Dossier. I'm not on Twitter, though--and don't get me started on Facebook.

I'm only into the search results part of this thing. The question is, how do I use it without having to log in/sign up?
Jason Mayes2 years ago
+Dylan Cuffy You can not. You need a twitter account (even if you dont use it) to generate  widget id.
Dylan Cuffy2 years ago
+Jason Mayes: Thanks for the clarification. With that, guess I'm stuck with G+ widgets in the meantime. (And that's not necessarily a bad thing.)
Roelant Muller2 years ago
+Jason Mayes : Great work! However, every time a user opens a page a request is going out. This maybe fine, except I'm caching a lot of stuff on our Intranet, where are over more then 200 people make a lot of request to twitter.. So i was thinking of caching this in my usercontrol (ASP.NET), but off course this cannot be done because javascript get's executed.. So I was thinking of doing the request (the url to https://cdn.syndication.twimg.com/widgets/timelines/... ETC) in my code, which gives me a response. Is there a way to handle this reponse so I can cache the twitter results?
Jason Mayes2 years ago
Why would you not just use the Twitter Api? The only point of this component is to offer a JavaScript only alternative. If you are going to use back end code then just use the official twitter api and cache that if you so wish.
Roelant Muller2 years ago
True.. but this one was so easy to use :)
But it got it working: I just call the reponse as a javascript function! 

Once more; great work!
+1
Jason Mayes2 years ago
+Roelant Muller Haha well I cant argue with that. :-) It frustrates me so much when people make things that are crazy hard to use when they do not need to be. I am glad the simplicity of this component was of use to you :-)
Due Nguyen2 years ago
Hey Jason, I put your code over local http it does work but only for #API.  How can I search using another hastag beside #API.  I looked at the fetch function it does not have option where I can input another hastag or multiple hastag.

Thanks for the great work!
Cheers
Jason Mayes2 years ago
You need to make a twitter widget that searches for hash tag you want and then use that widget I'd with my component. See the comments in code how to generate an id.
Dan Williams2 years ago
Really good stuff Jason, been looking for something like this for ages!
Marc Remblance2 years ago
Hey Jason,

All works great, but I get this error thrown in my dev toolbar, only just popped up - Cannot set property 'innerHTML' of null

thanks
Jason Mayes2 years ago
+Marc Remblance The DOM element doesnt exist. Ensure the script is placed right before the closing body tag. Or maybe you have the ID incorrect for the element you are rendering it in to?
Marc Remblance2 years ago
Hi Jason,

My bad. I had a stray element I was no longer using!! Quick question, with version 10, how do we hide the retweet/reply etc.. links if required?

I currently have this -

twitterFetcher.fetch('352711627528880128', 'twitter-fetcher-tweet', 1, true, false);

which is not hiding them.

many thanks
Jason Mayes2 years ago
+Marc Remblance Like this:

twitterFetcher.fetch('352711627528880128', 'twitter-fetcher-tweet', 1, true, true, true, '', false, undefined, false);
Zafer Zent2 years ago
Hi Jason my last tweets date format I can't timeago format (x min ago).  I do want to see x min ago.
Jason Mayes2 years ago
I have no idea what you have done Zafer from that comment. By default it is like this so unless you have changed something it will use the Twitter terminology.
Raghav Chandak2 years ago
How I can do integration of tweets on my site which deals with multiple dynamic keywords and not a fixed set of keywords?
Tineke Timmerman2 years ago
Yet another question Jason... I just noticed that even thoug I have set "show images" to false... they still load (they don't show, but are there which I figured out after doing some page performance tests).. Is there a way of not pulling the images in at all?
Jason Mayes2 years ago
Unfortunatey not without rewriting the component. As I wrote it pretty fast I use a DOM node that is never added to the page to store returned html (so i can use things like getElementById) but it appears browser is trying to be clever by pre fetching images! Would need to rewrite using regular expressions to fix that. +Tineke Timmerman
Tineke Timmerman2 years ago
Ah, I get it. No probs, happy to use ur code.
It's just that after finishing a website it's always such a challenge to get all the addons down so the pageload doesn't get affected by the twitter,google, facebook, instagram etc clients like to have all on one page... 
Jason Mayes2 years ago
Its the same "weight" as the original twitter widget For assets downliaded
Ed Valenti2 years ago
I'm not very good with code - novice coder (I'm a designer) and I'm trying to add my most recent tweet to my website with no luck. Can you help at all?
Jason Mayes2 years ago
Link to website with the code on would help.+1
Ed Valenti2 years ago
Here is my test page and the twitter code is at the bottom: http://www.ev2.me/test/
Jason Mayes2 years ago
I cant see anywhere on the page where you include my JavaScript code...
Ed Valenti2 years ago
I would simply add that to the head correct? I have tried that and it didn't seem to work. Perhaps I'm doing it wrong?
Ed Valenti2 years ago
Should I be using the HTML / CSS / Java in my type of site for the best results?
Jason Mayes2 years ago
You must place javascript just before </body> tag  or listen for the document ready event - your DOM must have been created before you can call my component as it injects tweets into the DOM. If it is not ready yet, it will fail of course.
Ed Valenti2 years ago
Not all too familiar with the DOM or Document Ready Event? Can the section or <div> created for twitter presently not be used?
Jason Mayes2 years ago
Basically just put my JavaScript just before the closing body tag with the correct id of the HTML element you want the tweets to be written to and it will work when run from a webserver. Make sure you are not accessing the file via file:// in the browser. It must be  http://
Ed Valenti2 years ago
Am I using the java from here: http://codepen.io/jasonmayes/pen/Ioype
Jason Mayes2 years ago
+Ed Valenti Just to clarify - it is JavaScript, not Java ;-) Yes that is the correct code to use - but when I checked your website I could not see where you included it anywhere??
Ed Valenti2 years ago
I added it here but it's showing as code at the bottom of the page not in the <div> created for the twitter data. Link: http://www.ev2.me/test/index2.html
Jason Mayes2 years ago
+Ed Valenti You need to surround the code you pasted with <script> and an </script> tag  to tell the browser that it is code and not text
Ed Valenti2 years ago
Okay so I added the <script> tags. Do I have to direct this JS to the <div> created for the Twitter post itself? If so how? Also, do I now need to place my twitter id into your JS and also change the number of posts?
Jason Mayes2 years ago
+Ed Valenti Please read the comments in my code - specifically look at example 1. Which looks like this:

twitterFetcher.fetch('345170787868762112', 'example1', 1, true);

The first parameter is the Twitter widget ID. You will get this when you create a widget on twitter. The second parameter is the id of the HTML element you want to write the tweets in to, and the third parameter is the number of tweets. In this case it is already 1 and just leave true set to true. That should be all you need to get going.
Nikola Kljaic2 years ago
HI Jason do you consider adding interval for refreshing tweets?
Jason Mayes2 years ago
+Nikola Kljaic No as many people would probably abuse it and do something silly like refreshing every minute when there is no need. Ask if you really need to  update it every minute. Probably not as most people dont spend longer than a few mins on a webpage anyway. So upon page load is just fine.+1
Nikola Kljaic2 years ago
Ok. Thanks. Great stuff :)+1
Azher aLI2 years ago
very nice work sir can u plz tell me how to show followers name of the user
thanx
Jason Mayes2 years ago
The twitter username?
Edward Ramos2 years ago
Thank you so much for this great solution! I have one question. How do I get hyperlinked hashes and handles to open in a new window?+1
Jason Mayes2 years ago
+Edward Ramos You would need to use the advanced example and modify it to add a 'target="_blank" attribute to every hyperlink contained in the result. You could probably do this quite easily with a regular expression global replace eg search for <a href= and replace with <a target="_blank" href= or similar...
Edward Ramos2 years ago
Thank you for the quick reply!+1
Daniel Nguyen2 years ago
Hi Jason,
Thank you for your great solution. @ Work, I ve been restricted access to the API url using OAuth. And i'm now using your solution client side to customize tweet display.

I am using the parameter true to show the retweet and tweet from a given user.
Yet do you know if theres a (future) way to get info on the origin @user of a retweet, my need is :

If @user1 is retweeting @user2, the twitter API (server side code implementation)  is showing :
"RT @user2: blabla this is the foo bar tweet from user2 retwetted by user1 blabla" 

(RT <=> Retweet)
My client wants me to display this "RT @user2" coming before the tweet text.

Thanks for your help
Daniel
Jason Mayes2 years ago
+Daniel Nguyen Thanks for the kind words and glad it is has helped you. You may want to play with the advanced example which allows you to access the raw stream of data I get back so you can manipulate it directly. There may be some data in there which I ignored to help you chive what you want - print it to console and see.
Daniel Nguyen2 years ago
+Jason Mayes Great. Thanks a lot !+1
Mike Ridyard2 years ago
Hi Jason, Not sure if I'm doing something wrong but I can't seem to separate the tweet poster's name and their @username. It's all mixed into the same href. Is this intentional as it's proving impossible to style? Also, have you seen any sites that use your code in a really impressive way?
Jason Mayes2 years ago
+Mike Ridyard Twitter might have changed something. It used to be. You might need to use the advanced example to parse the data yourself if it has changed. A few people have shown it in use on their sites if you search twitter for twitterFetcher but I do not have links to hand - one was quite cool for a fantasy game site with some really breathtaking artwork.
Mike Ridyard2 years ago
Thanks for the reply. I have had to resort to a hack to split name from handle. See fiddle: http://jsfiddle.net/Cumbria/VzLSL/ the CSS is at line #44 (#twitter .user span span:before) BUT it's looking fabulous now. Thanks for all the hard work.  Oh, and btw I hardcoded FontAwesome icons into the JS. Will send you a link when it's live.+1
Shubham Kanodia2 years ago
Hey Jason, thanks a ton for this tool ! Was just wondering if there is a way for images to display as images rahter than "pic.twitter" links. Am i missing something?+1
Chris Goering2 years ago
Hi Jason-
I'm trying to implement this with the option to callback a function when the data is ready.  However, it doesn't seem as if the tweets array is being passed into function (tweets.length is coming back as 0).  If I use the simple implementation of the function without the callback, I am able to view the twitter data, so it seems to be something specific to calling this function.  For testing purposes, I'm using the exact code for the function that you have in your examples.  Is there something that I'm missing.  My code is here: http://jsfiddle.net/3KDQ6/

Thanks!
Jason Mayes2 years ago
+Chris Goering It wont work on JSFiddle due to their new policies on JSONP callbacks. It will never see the function you expose as it is not global. If you run it on your own webserver or codepen.io it will work fine.
Michael Groth1 year ago
Hi Jason, I´am really happy about your code. But as mentioned before: is there a way to display images instead the pic.twitter links??
Chris Bell1 year ago
Beautiful solution.+1
Archie Smith III11 months ago
Jason your solution is great! Thank you. Is there a parameter to make the tweets update in the stream without reloading the page similar to how they do in the native twitter widget?+1
Jason Mayes11 months ago
+Archie Smith III that is pretty simple using a timer that calls my component say every minute. I wouldn't do it any faster than that though as I doubt you tweet every minute...
Archie Smith III11 months ago
Ok thank you! I'm using keyword searches, so every minute or 30 seconds should be fine. Where do I find the timer value?
Jason Mayes11 months ago
Just Google setTimeout.
Archie Smith III11 months ago
Thank you very much Jason. The javascript syntax confuses me as I'm used to PHP but I'm sure I can find someone to do this right. So far I keep just breaking the script smacks head
Stephen Jones9 months ago
Awesome work +Jason Mayes. Is there any good way to get retweets to show the actual retweet instead of just the link to it, or is the only good workaround to set showRetweet to false? Example: http://ds.bucpd.com/problem.png +1
Jason Mayes9 months ago
Hmmm that's odd it used to show the text... Does it do that for all?
Stephen Jones9 months ago
Yeah, it does. Also, strangely enough, I have showRetweet set to false, so (if I'm understanding correctly) they shouldn't be showing at all. 
Jason Mayes9 months ago
+Stephen Jones Correct, though maybe it is part of the widget settings. It is possible Twitter changed something since this was made. Check the settings within the twitter widget on twitter.com and see if show retweets is an option.
Stephen Jones9 months ago
+Jason Mayes You're right, I should have checked there first. The widget shows it exactly as in the picture I posted (with the link rather than the text), and there is no setting for retweets. I'll probably just use the custom handling option and do some regex magic to screen out the retweets manually. Thanks for your help - I'll be buying you a beer definitely. 
Jason Mayes9 months ago
+Stephen Jones I think the advanced example is probably the way to go in this case. Thank you in advance for the beer :-)
Stephen Jones9 months ago
+Jason Mayes Well, I feel stupid. Since I'm not a Twitter user, I didn't know the difference between a retweet and and embedded tweet. Now I know. :)+1
Jason Mayes9 months ago
Ah! Glad you figured it out!
Alex Onciu8 months ago
Thanks for the great piece of code :)
Do you know if (and how) I can make the links in the tweets rel="nofollow"?
I would like to keep the links but make them nofollow.
I did it already for the interaction and the date but I can't figure it out how it can be done for links in the actual tweet body.
+1
Jason Mayes8 months ago
You would have to use one of the advanced examples and parse each tweet yourself through your own sanitizing function so to speak.
John-David Deubl7 months ago
Thanks for your Code,
since Firefox 42.0 if the 'do-not-track' is active the twitter timeline is blocked.
Jason Mayes7 months ago
+John-David Deubl​thanks for the heads up.
Sergio Palma7 months ago
Hi, its it possible for it to make searches for any text, using a variable as parameter?
Jason Mayes7 months ago
+Sergio Palma​ when you create the twitter widget you can customise that to follow a hashtag, but it is not variable unless you manually change it via twitter account widget setting
Rajae Moumen6 months ago
+Jason Mayes  thanks for the code, it works perfectly on Google Chrome.But nothing is displayed on firefox and IE. There are no errors though... Can you help me sorti it out? Thanks
Jason Mayes6 months ago
Works for me, you must have changed something. View: http://jasonmayes.com/projects/twitterApi/ in Firefox - loads fine.
Liam Franklin6 months ago
I'm actually having the same problem where nothing is showing in Firefox. Even in the example link above or codepen. ^

Any ideas? JS is enabled, I've disabled AdBlocker and tried on both my laptop and PC.

Thanks,
Jason Mayes6 months ago
Just tried and it works for me so it is either something you have changed, or something you have installed on your browser. I'm on 43.0.1 ff.
John-David Deubl6 months ago
Hello Jason do have a solution if the user have https://support.mozilla.org/en-US/kb/tracking-protection-pbm
activated?
Jason Mayes6 months ago
If someone is blocking access to twitter cdn domain which is the only external resource we are fetching, then there is nothing I can do about that in JavaScript.
John-David Deubl6 months ago
Okay thank's
+Jason Mayes
+1
Rajae Moumen5 months ago
Hi, I have been running your code on my website, and it worked fine, thanks for that. I 'm facing a trouble though. A recent tweet contains smileys. They appear very big in my website and force the text to disapear (since i m fixin the div's height at 50px). Do you have any idea how can i resize the smileys,  regarding the fact that there are not images, but just characters in the text like ;) or :). Thanks for your help.
Jason Mayes5 months ago
+Rajae Moumen​ I'm afraid I've not encountered this issue before. Maybe try changing font to one that supports the smiley you speak of.
Mariano Echegoyen5 months ago
Hi Jason, thanks for making such a great app. I need to pull a post from a particular user with a certain hashtag. So I need to search the user id and receive data of posts with one specific hashtag from this user's posts. Is there any way to achieve this with your app? Thanks in advanced.
Jason Mayes5 months ago
If the twitter widget can do it, then yes. Else you will have to use the official api or modify response to filter yourself.
Ramesh Vishwakarma5 months ago
Hi I am using twitter-feed.js and it does work perfect in chrome browser, but don't know why its not working in firefox :( .... Please check your link as well in firefrox... http://www.jasonmayes.com/projects/twitterApi/  

I am using Firefox version: 43.0.4
Jason Mayes5 months ago
+Ramesh Vishwakarma It appears that in latest version of FF, it has tracking protection and for some reason it is blocking the domain that is hosting the tweet feed. I assume Twitter uses this domain to drop cookies or such so has been blacklisted by FF. The only way around this would be to write a proxy an then force my script to point at that instead as your domain wont be blacklisted. The resource at. Exact error message is: "https://cdn.syndication.twimg.com/" was blocked because tracking protection is enabled. So this is not an issue with TwitterFetcher but the domain Twitter is hosting the JSON file on.
Devesh Panday3 months ago
I have make my own office site for twitter but , i am not able to setup the linkup of updates and current notification through the twitter .... in our office site in Latest news column
http://www.webfoxinfo.com/deepak/sivit/index.html
plz tell how to set it...
Jason Mayes3 months ago
Update: See latest updates on github for fix following recent twitter change!
Devesh Panday3 months ago
hiii

the link which you have given, from that the tweets are occurring in dialog
box in vertical format ..but i have to get in horizontal way......
just like the link given below...
http://codecanyon.net/item/modern-news-ticker/full_screen_preview/2347950
Jason Mayes3 months ago
You will need to write your own CSS to change style
Venancio Orozco3 months ago
Hi! thanks for this nice lib, do you know what kind of settings do i need to show the tweets? where do i find th id? is the same located on settings/twitter_data ? ...
Jason Mayes3 months ago
All the instructions are in the example JavaScript on github with regards generating ID. You do this via Twitter settings by making widget
Venancio Orozco3 months ago
Thanks so much! it works!! +1
Sri Ravipati3 months ago
hi jason,   I am using this code in our work environment from past 2 years. IE(7,8,9),Chrome,FF were working fine till lask week.  Starting from this week. The twiiter is blank. I verified the the url :-
https://cdn.syndication.twimg.com/widgets/timelines/

I am receiving a message saying that the page doesn't exists. Is there anything i am missing. Can you please let me know....
Jason Mayes3 months ago
Please make sure you are using the latest version from GitHub as twitter changed everything recently and I had to update script
Kezia Kong2 months ago
Hi Jason, thank you so much for the code it's amazing! Was wondering if you've figured out a way to customise the in_reply_to page/webintent as well.  +1
Jason Mayes2 months ago
+Kezia Kong​ no that is not possible as far as I know. Glad you like the script though!
Kezia Kong2 months ago
Thanks for the swift reply. Cheers!+1
Brad Eynon1 week ago
Hi - it seems the twitter widget setup has changed and I can't see where to find the twitter widget ID any longer?
Jason Mayes1 week ago
See latest update on github for my twitter fetcher which no longer needs id