Dynamically embed Twitter timeouts (API V 1.1)

Twitter's new built-in timelines do not seem to allow dynamic creation of embedded timelines.

Here is the section on their website: https://dev.twitter.com/docs/embedded-timelines

In older versions of the API, it was possible to dynamically switch the username in widgets, but the new API forces you to store the full widget on your servers and access it through the widget ID. How to get around this?

+5
source share
4 answers

I did this too. This example did a great job and learned to use scala for this: http://bcomposes.wordpress.com/2013/02/09/using-twitter4j-with-scala-to-access-streaming-tweets/

, twitter oauth twitter4j, javascript. regex javascript, .

0

Nope:( , Twitter ( ) id s. , id , Twitter, .

:

  • / -
  • AJAX script, .

, , . , PHP .NET, , ( ).

+4

This works great for Timeline with the new Twitter 1.1 API.

1) Download twitter4j-core-3.0.3.jar at http://twitter4j.org/en/ 2) Try using this code:

private static final String TWITTER_CONSUMER_KEY = "xxxxxxxxxxxxxxxxxx";
private static final String TWITTER_SECRET_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
private static final String TWITTER_ACCESS_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxx";
private static final String TWITTER_ACCESS_TOKEN_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxx";

ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
    .setOAuthConsumerKey(TWITTER_CONSUMER_KEY)
    .setOAuthConsumerSecret(TWITTER_SECRET_KEY)
    .setOAuthAccessToken(TWITTER_ACCESS_TOKEN)
    .setOAuthAccessTokenSecret(TWITTER_ACCESS_TOKEN_SECRET);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
try {
    Query query = new Query("MrEdPanama");
    QueryResult result;
    do {
        result = twitter.search(query);
        List<Status> tweets = result.getTweets();
        for (Status tweet : tweets) {
            System.out.println("@" + tweet.getUser().getScreenName() + " - " + tweet.getText());
        }
    } while ((query = result.nextQuery()) != null);
    System.exit(0);
} catch (TwitterException te) {
    te.printStackTrace();
    System.out.println("Failed to search tweets: " + te.getMessage());
    System.exit(-1);
}
+2
source

I understand that this question was asked a few months ago, but this can be achieved quite simply by adding "data-" tags to your URL.

Check out the Twitter page to set up built-in timelines: https://dev.twitter.com/docs/embedded-timelines#customization

+1
source

All Articles