0

So the goal of my project was to create a simple html file that would get the 'x' most recent tweets and loop through them. After doing some research it appears as if the twitter API v1.1 doesn't allow this anymore without authentication.

This stack question then helped with saying the authentication requires a server side script to authenticate?

I can't do this as the application I'm using can only take an html file, no php or aspx, etc...

So my question is, how is this javascript getting tweets, and is there a way to utilize this to separate each tweet and loop through it?

 !function(d,s,id) { 
        var js, fjs = d.getElementsByTagName(s)[0], p=/^http:/.test(d.location) ? 'http':'https';
        if( !d.getElementById(id)) { 
          js = d.createElement(s);
          js.id = id;
          js.src = p + "://platform.twitter.com/widgets.js";
          fjs.parentNode.insertBefore(js,fjs);
          alert(fjs.parentNode);
        }
      }
      (document,"script","twitter-wjs");

Here is the html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="dcterms.created" content="Mon, 01 Jun 2015 17:27:01 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<title>Twitter Mentions</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<style type="text/css">
<!--
body {
  color:#000000;
  background-color:#FFFFFF;
  background-image:url('Background Image');
  background-repeat:no-repeat;
}
a  { color:#0000FF; }
a:visited { color:#800080; }
a:hover { color:#008000; }
a:active { color:#FF0000; }
-->
</style>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="tweetFeed"></div>
<a class="twitter-timeline" href="https://twitter.com/McKCleveland" width="200" height="400" data-tweet-limit="4" data-chrome="noheader nofooter noborders noscrollbar transparent" data-widget-id="605427272837935104">Tweets by @McKCleveland</a>

If someone has an alternative way of achieving what I'm looking for in the meantime while I continue to research, that would be great too!

Thanks again for any advice! Andy

Community
  • 1
  • 1
Andy Giebel
  • 223
  • 1
  • 14
  • That comes from https://dev.twitter.com/web/javascript/loading – Barmar Jul 17 '15 at 21:14
  • To expand on @Barmar's comment, that JS is just the loader code that inserts a script tag into the DOM, which in turn loads the twitter widget code. It will be in the latter script that the tweets are fetched. – brian Jul 17 '15 at 21:44
  • Hm okay, thanks guys! So is there another way to achieve this? – Andy Giebel Jul 23 '15 at 13:01

0 Answers0