关于Localhost的推文和关注(Twitter)

时间:2013-12-05 17:01:38

标签: javascript twitter playframework tweets

是否可以获取用户的推文并使用我的开发环境关注用户,我的意思是使用localhost。我从twitter获取代码以获取用户的推文并关注该用户。这是我试过的

<div class="span4 offset5 top_twitter">
   <span class="tweet query" id="ticker">
      <a class="twitter-timeline" href="https://twitter.com/wearybands/favorites" data-widget-id="407316719342870528">Tweets by wearybands</a>
   </span>
   <span class="icon-twitter">
      <a href="https://twitter.com/wearybands" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow Us</a>
   </span>
</div> 

两者的javascript都是

  <script>!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);}}(document,"script","twitter-wjs");</script>
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

我既没有得到用户的推文,也没有能够关注用户

2 个答案:

答案 0 :(得分:2)

是的,您可以在本地测试。您尝试使用的小部件ID链接到wearyband / favorites。这个Twitter用户没有任何收藏夹,因此是空的时间线。尝试创建与主时间轴关联的新窗口小部件ID。

替换

<a class="twitter-timeline" href="https://twitter.com/wearybands/favorites" data-widget-id="407316719342870528">Tweets by wearybands</a>

使用

<a class="twitter-timeline" href="https://twitter.com/wearybands" data-widget-id="408647058245971968">Tweets by @wearybands</a>

答案 1 :(得分:-1)

关注@ asa1122e

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);}}(document, 'script', 'twitter-wjs');